diff --git a/src/ao_two_e_ints/cholesky.irp.f b/src/ao_two_e_ints/cholesky.irp.f index 3cd400f8..6778d5c7 100644 --- a/src/ao_two_e_ints/cholesky.irp.f +++ b/src/ao_two_e_ints/cholesky.irp.f @@ -66,6 +66,10 @@ END_PROVIDER integer :: fd(2) logical :: delta_on_disk + PROVIDE nproc + PROVIDE nucl_coord ao_two_e_integral_schwartz + call set_multiple_levels_omp(.False.) + call wall_time(wall0) ! Will be reallocated at the end @@ -87,7 +91,7 @@ END_PROVIDER call resident_memory(mem0) - rank_max = min(ndim8,274877906944_8/1_8/ndim8) + rank_max = min(ndim8,(qp_max_mem*1024_8*1024_8*1024_8/8_8)/ndim8) call mmap(trim(ezfio_work_dir)//'cholesky_ao_tmp', (/ ndim8, rank_max /), 8, fd(1), .False., .True., c_pointer(1)) call c_f_pointer(c_pointer(1), L, (/ ndim8, rank_max /)) ! Deleting the file while it is open makes the file invisible on the filesystem, @@ -209,7 +213,7 @@ END_PROVIDER + np*memory_of_double(nq) !print *, 'mem = ', mem - if (mem > 300.d0) then ! 300GB max for Delta + if (mem > qp_max_mem/2) then s = s*2.d0 else exit @@ -231,9 +235,12 @@ END_PROVIDER enddo ! d., e. - mem = mem0 & + mem = mem0 & + memory_of_int(nq) &! computed(nq) + np*memory_of_int(nq) &! computed(nq) + + memory_of_double(np) &! Delta_col(np) + + 7*memory_of_double(ndim8) &! D, Lset, Dset, D_sorted, addr[1-3] + + np*memory_of_double(nq) &! Delta(np,nq) + (np+nq)*memory_of_double(block_size) ! Ltmp_p(np,block_size) + Ltmp_q(nq,block_size) if (mem > qp_max_mem) then diff --git a/src/utils/fortran_mmap.c b/src/utils/fortran_mmap.c index fdf7fb6f..711a9c34 100644 --- a/src/utils/fortran_mmap.c +++ b/src/utils/fortran_mmap.c @@ -49,10 +49,9 @@ void* mmap_fortran(char* filename, size_t bytes, int* file_descr, int read_only, } if (single_node == 1) { - map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_HUGETLB , fd, 0); + map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_POPULATE | MAP_NONBLOCK, fd, 0); } else { - map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_HUGETLB, fd, 0); + map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); } } diff --git a/src/utils/mmap.f90 b/src/utils/mmap.f90 index 723cb771..af3fe6ed 100644 --- a/src/utils/mmap.f90 +++ b/src/utils/mmap.f90 @@ -46,9 +46,9 @@ module mmap_module type(c_ptr), intent(out) :: map ! C Pointer integer(c_size_t) :: length - integer(c_int) :: fd_ + integer(c_int) :: fd_, read_only_, single_node_ - integer :: i, read_only_, single_node_ + integer :: i read_only_ = 0 single_node_ = 0 @@ -60,7 +60,7 @@ module mmap_module length = length * shape(i) enddo - map = c_mmap_fortran( trim(filename)//char(0), length, fd_, read_only, single_node) + map = c_mmap_fortran( trim(filename)//char(0), length, fd_, read_only_, single_node_) fd = fd_ end subroutine