GBTOlib: library for evaluation of molecular integrals in mixed Gaussian / B-spline basis  111
Data Types | Functions/Subroutines | Variables
file_mapping_gbl Module Reference

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)
 Initialize file virtual memory mapping. More...
 
subroutine final_file_mapping (this)
 Finalize file virtual memory mapping. More...
 

Variables

logical, parameter map = .true.
 Map integrals to virtual memory instead of fully reading them to the physical memory. More...
 

Detailed Description

Virtual memory file mapping.

Author
J Benda
Date
2020

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.

Note
Currently uses mmap, which is compatible only with POSIX systems. In Windows, a different call needs to be used.

Function/Subroutine Documentation

◆ final_file_mapping()

subroutine file_mapping_gbl::final_file_mapping ( class(file_mapping), intent(inout)  this)

Finalize file virtual memory mapping.

Author
J Benda
Date
2020

Cancel the file mapping. This simply calls the POSIX munmap function.

◆ init_file_mapping()

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 
)

Initialize file virtual memory mapping.

Author
J Benda
Date
2020

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, 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.

Variable Documentation

◆ map

logical, parameter file_mapping_gbl::map = .true.

Map integrals to virtual memory instead of fully reading them to the physical memory.