10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-25 13:53:49 +01:00

Cleaning in mmap

This commit is contained in:
Anthony Scemama 2018-05-07 15:52:14 +02:00
parent 4e55e36260
commit c9865c6fde

View File

@ -9,6 +9,9 @@ subroutine map_save_to_disk(filename,map)
integer*8 :: i,k
integer :: j
integer*8 :: n_elements
n_elements = int(map % n_elements,8)
if (map % consolidated) then
stop 'map already consolidated'
@ -17,11 +20,11 @@ subroutine map_save_to_disk(filename,map)
call mmap(trim(filename)//'_consolidated_idx', (/ map % map_size + 2_8 /), 8, fd(1), .False., c_pointer(1))
call c_f_pointer(c_pointer(1),map % consolidated_idx, (/ map % map_size +2_8/))
call mmap(trim(filename)//'_consolidated_key', (/ map % n_elements /), cache_key_kind, fd(2), .False., c_pointer(2))
call c_f_pointer(c_pointer(2),map % consolidated_key, (/ map % n_elements /))
call mmap(trim(filename)//'_consolidated_key', (/ n_elements /), cache_key_kind, fd(2), .False., c_pointer(2))
call c_f_pointer(c_pointer(2),map % consolidated_key, (/ n_elements /))
call mmap(trim(filename)//'_consolidated_value', (/ map % n_elements /), integral_kind, fd(3), .False., c_pointer(3))
call c_f_pointer(c_pointer(3),map % consolidated_value, (/ map % n_elements /))
call mmap(trim(filename)//'_consolidated_value', (/ n_elements /), integral_kind, fd(3), .False., c_pointer(3))
call c_f_pointer(c_pointer(3),map % consolidated_value, (/ n_elements /))
if (.not.associated(map%consolidated_key)) then
stop 'cannot consolidate map : consolidated_key not associated'
@ -52,9 +55,6 @@ subroutine map_save_to_disk(filename,map)
map % consolidated_idx (map % map_size + 2_8) = k
map % consolidated = .True.
integer*8 :: n_elements
n_elements = int(map % n_elements,8)
print *, 'Writing data to disk...'
call msync ( (/ map % map_size + 2_8 /), 8, fd(1), c_pointer(1))
call msync ( (/ n_elements /), cache_key_kind, fd(2), c_pointer(2))