DiaColloDB::PDL::MM - DiaColloDB utilities: (temporary) mmaped PDLs
##======================================================================== ## PRELIMINARIES use DiaColloDB::PDL::MM; ##======================================================================== ## Constructors etc. $mmpdl = CLASS->new($file?, $type?, @dims, \%opts?); $mmpdl = CLASS->mmtemp($file?, $type?, @dims, \%opts?); $bool = CLASS->unlink(@basenames); undef = $obj->DESTROY(); ##======================================================================== ## Accessors $file = $mmdpl->file(); $istmp = $mmdpl->temp(); $pdl = $mmpdl->_pdl();
DiaColloDB::PDL::MM provides a simple object-oriented wrapper for (temporary) PDLs using mmap() via PDL::IO::FastRaw. This is mostly useful to ensure that the memory used by large intermediate piddles is freed when the objects are destroyed, since mmap() bypasses perl's internal memory management.
DiaColloDB::PDL::MM inherits from PDL.
Psuedo-set of all tempfiles created, used by END block.
Default log-level for debugging (default=undef: off).
$mmpdl = CLASS->new($file?, $type?, @dims, \%opts?); $mmpdl = $pdl->mmzeroes($file?, $type?, \%opts?);
Creates and returns a new mmap()ed PDL and returns the result as a blessed HASH-ref conforming to PDL inheritance conventions. %opts, %$mmpdl:
( file => $template, ##-- file basename or File::Temp template; default='pdlXXXX' suffix => $suffix, ##-- File::Temp::tempfile() suffix (default='.pdl') log => $level, ##-- logging verbosity (default=$LOG_DEFAULT) temp => $bool, ##-- delete on END (default: $file =~ /X{4}/) PDL => $pdl, ##-- guts: real underlying mmap()ed piddle (must be key 'PDL' for PDL inheritance to work) )
$mmpdl = CLASS->mmtemp($file?, $type?, @dims, \%opts?);
like new(), but always sets $opts->{temp}=1.
$opts->{temp}=1
$bool = CLASS->unlink(@basenames); $bool = $mmpdl->unlink();
Unlinks file(s) generated by mmzeroes($basename). $basename defaults to $mmpdl->{file} if called as an object method.
mmzeroes($basename)
$basename
$mmpdl->{file}
undef = $obj->DESTROY()
Destructor implicitly calls unlink(); must also handle "pure" piddles created e.g. by $mmpdl->xvals().
$file = $mmdpl->file();
Returns mmap()ed filename.
$istmp = $mmdpl->temp();
Returns true iff $mmpdl is marked as a temporary.
$pdl = $mmpdl->_pdl();
Returns "real" underlying PDL.
Bryan Jurish <moocow@cpan.org>
Copyright (C) 2015-2016 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
PDL(3pm), PDL::IO::FastRaw(3pm), DiaColloDB(3pm), perl(1), ...
To install DiaColloDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DiaColloDB
CPAN shell
perl -MCPAN -e shell install DiaColloDB
For more information on module installation, please visit the detailed CPAN module installation guide.