mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-22 20:34:58 +01:00
mmap is now shared in cholesky
This commit is contained in:
parent
c6712b0d60
commit
4b578d9849
@ -31,12 +31,11 @@ END_PROVIDER
|
|||||||
integer*8 :: ndim8
|
integer*8 :: ndim8
|
||||||
integer :: rank
|
integer :: rank
|
||||||
double precision :: tau, tau2
|
double precision :: tau, tau2
|
||||||
double precision, pointer :: L(:,:), Delta(:,:)
|
double precision, pointer :: L(:,:)
|
||||||
|
|
||||||
double precision :: s
|
double precision :: s
|
||||||
double precision :: dscale, dscale_tmp
|
|
||||||
|
|
||||||
double precision, allocatable :: D(:), Ltmp_p(:,:), Ltmp_q(:,:), D_sorted(:), Delta_col(:)
|
double precision, allocatable :: D(:), Ltmp_p(:,:), Ltmp_q(:,:), D_sorted(:), Delta_col(:), Delta(:,:)
|
||||||
integer, allocatable :: addr1(:), addr2(:)
|
integer, allocatable :: addr1(:), addr2(:)
|
||||||
integer*8, allocatable :: Lset(:), Dset(:)
|
integer*8, allocatable :: Lset(:), Dset(:)
|
||||||
logical, allocatable :: computed(:)
|
logical, allocatable :: computed(:)
|
||||||
@ -102,7 +101,7 @@ END_PROVIDER
|
|||||||
rank = 0
|
rank = 0
|
||||||
|
|
||||||
allocate( D(ndim8), Lset(ndim8), Dset(ndim8), D_sorted(ndim8))
|
allocate( D(ndim8), Lset(ndim8), Dset(ndim8), D_sorted(ndim8))
|
||||||
allocate( addr1(ndim8), addr2(ndim8), Delta_col(ndim8) )
|
allocate( addr1(ndim8), addr2(ndim8), Delta_col(ndim8), computed(ndim8) )
|
||||||
|
|
||||||
call resident_memory(mem0)
|
call resident_memory(mem0)
|
||||||
|
|
||||||
@ -149,11 +148,9 @@ END_PROVIDER
|
|||||||
Dmax = D_sorted(1)
|
Dmax = D_sorted(1)
|
||||||
|
|
||||||
! 2.
|
! 2.
|
||||||
dscale = 1.d0
|
|
||||||
dscale_tmp = dscale*dscale*Dmax
|
|
||||||
np8=0_8
|
np8=0_8
|
||||||
do p8=1,ndim8
|
do p8=1,ndim8
|
||||||
if ( dscale_tmp*D(p8) >= tau2 ) then
|
if ( Dmax*D(p8) >= tau2 ) then
|
||||||
np8 = np8+1_8
|
np8 = np8+1_8
|
||||||
Lset(np8) = p8
|
Lset(np8) = p8
|
||||||
endif
|
endif
|
||||||
@ -203,16 +200,23 @@ END_PROVIDER
|
|||||||
|
|
||||||
mem = mem0 &
|
mem = mem0 &
|
||||||
+ np*memory_of_double(nq) & ! Delta(np,nq)
|
+ 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)
|
+ (np+nq)*memory_of_double(block_size) ! Ltmp_p(np,block_size) + Ltmp_q(nq,block_size)
|
||||||
+ memory_of_int(nq) ! computed(nq)
|
|
||||||
|
|
||||||
if (mem > qp_max_mem*0.5d0) then
|
if (mem > qp_max_mem*0.5d0) then
|
||||||
nq = nq/2
|
Dmin = D_sorted(nq/2)
|
||||||
|
do ii=nq/2,np-1
|
||||||
|
if (D_sorted(ii) < Dmin) then
|
||||||
|
nq = ii
|
||||||
|
exit
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
else
|
else
|
||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
!call print_memory_usage
|
||||||
|
!print *, 'np, nq, Predicted memory: ', np, nq, mem
|
||||||
|
|
||||||
if (nq <= 0) then
|
if (nq <= 0) then
|
||||||
print *, nq
|
print *, nq
|
||||||
@ -247,8 +251,7 @@ END_PROVIDER
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
allocate(computed(nq))
|
computed(1:nq) = .False.
|
||||||
computed(:) = .False.
|
|
||||||
|
|
||||||
|
|
||||||
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(k,p,q)
|
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(k,p,q)
|
||||||
@ -406,7 +409,6 @@ END_PROVIDER
|
|||||||
|
|
||||||
deallocate(Ltmp_p)
|
deallocate(Ltmp_p)
|
||||||
deallocate(Ltmp_q)
|
deallocate(Ltmp_q)
|
||||||
deallocate(computed)
|
|
||||||
deallocate(Delta)
|
deallocate(Delta)
|
||||||
|
|
||||||
! i.
|
! i.
|
||||||
@ -419,11 +421,9 @@ END_PROVIDER
|
|||||||
|
|
||||||
Dmax = D_sorted(1)
|
Dmax = D_sorted(1)
|
||||||
|
|
||||||
dscale = 1.d0
|
|
||||||
dscale_tmp = dscale*dscale*Dmax
|
|
||||||
np8=0_8
|
np8=0_8
|
||||||
do p8=1,ndim8
|
do p8=1,ndim8
|
||||||
if ( dscale_tmp*D(p8) >= tau2 ) then
|
if ( Dmax*D(p8) >= tau2 ) then
|
||||||
np8 = np8+1_8
|
np8 = np8+1_8
|
||||||
Lset(np8) = p8
|
Lset(np8) = p8
|
||||||
endif
|
endif
|
||||||
@ -436,6 +436,10 @@ END_PROVIDER
|
|||||||
print *, '============ ============='
|
print *, '============ ============='
|
||||||
print *, ''
|
print *, ''
|
||||||
|
|
||||||
|
deallocate( D, Lset, Dset, D_sorted )
|
||||||
|
deallocate( addr1, addr2, Delta_col, computed )
|
||||||
|
|
||||||
|
|
||||||
allocate(cholesky_ao(ao_num,ao_num,rank), stat=ierr)
|
allocate(cholesky_ao(ao_num,ao_num,rank), stat=ierr)
|
||||||
|
|
||||||
if (ierr /= 0) then
|
if (ierr /= 0) then
|
||||||
|
@ -49,10 +49,13 @@ void* mmap_fortran(char* filename, size_t bytes, int* file_descr, int read_only,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (single_node == 1) {
|
if (single_node == 1) {
|
||||||
|
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
|
/*
|
||||||
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_POPULATE | MAP_NONBLOCK | MAP_NORESERVE, fd, 0);
|
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_POPULATE | MAP_NONBLOCK | MAP_NORESERVE, fd, 0);
|
||||||
if (map == MAP_FAILED) {
|
if (map == MAP_FAILED) {
|
||||||
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user