|
GBTOlib: library for evaluation of molecular integrals in mixed Gaussian / B-spline basis 111
|
Virtual memory file mapping. More...
Data Types | |
| type | file_mapping |
| An auxiliary derived type which holds the pointer to the mapped data file window and performs the mapping and unmapping on call to init or final. More... | |
| interface | map_file_window |
| interface | unmap_file_window |
Functions/Subroutines | |
| subroutine | init_file_mapping (this, filename, offset, length, read_write, unique_name, create_new) |
| Initialize file virtual memory mapping. | |
| subroutine | finalize_file_mapping (this) |
| Finalize file virtual memory mapping. | |
| subroutine | destruct_file_mapping (this) |
| Destructor of the type "file_mapping". | |
Variables | |
| logical, parameter | map = .false. |
| Map integrals to virtual memory instead of fully reading them to the physical memory. | |
Virtual memory file mapping.
Direct mapping of disk files into virtual memory. This allows direct access to data in files without actually reading them to memory. The system performs all necessary I/O on the fly, to obtain the required values at the requested position. For simplicity, this module is accompanied with a C source code, which calls the necessary system API.
| subroutine file_mapping_gbl::destruct_file_mapping | ( | type(file_mapping), intent(inout) | this | ) |
Destructor of the type "file_mapping".
Called when an instance of "file_mapping" is being destructed.
| subroutine file_mapping_gbl::finalize_file_mapping | ( | class(file_mapping), intent(inout) | this | ) |
Finalize file virtual memory mapping.
Cancel the file mapping. This simply calls the POSIX munmap function.
| subroutine file_mapping_gbl::init_file_mapping | ( | class(file_mapping), intent(inout) | this, |
| character(len=*), intent(in) | filename, | ||
| integer(int64), intent(in) | offset, | ||
| integer(int64), intent(in) | length, | ||
| logical, intent(in), optional | read_write, | ||
| logical, intent(in), optional | unique_name, | ||
| logical, intent(in), optional | create_new ) |
Initialize file virtual memory mapping.
Set up a data file mapping window. The file name, byte offset and byte length of the window within the file needs to be given. Internally, this opens the file using the POSIX function open (or OpenFileMapping in Windows), requests the mapping starting from the virtual memory page boundary just below the requested offset as needed by mmap, and constructs the pointer to the actually wanted window, which starts at the specified offset.
If create_new is given and set to .true., then the file is created first before mapping from it. If read_write is given and set to .true., the mapped view will be writable. If unique_name is given and set to .true., the provided file name is interpreted only as a prefix for a file path, which will be suffixed to generate a unique file path. (This makes sense only together with create_new.) In this last case the file will be considered temporary and removed once the file mapping ends.
| [in] | this | A file mapping object. |
| [in] | filename | Name of file to open (or prefix if unique_name is given). |
| [in] | offset | Position in file where to start mapped segment. |
| [in] | length | Length of the mapped segment. |
| [in] | read_write | Whether to enable writing. |
| [in] | unique_name | Whether to suffix filename with characters in order to make a unique file name. |
| logical, parameter file_mapping_gbl::map = .false. |
Map integrals to virtual memory instead of fully reading them to the physical memory.