mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-24 13:23:41 +01:00
Parallelism and static
This commit is contained in:
parent
651fabe295
commit
09c0de9054
@ -204,7 +204,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error)
|
||||
nproc_target = min(nproc_target,nproc)
|
||||
endif
|
||||
|
||||
call omp_set_nested(.true.)
|
||||
call omp_set_nested(.false.)
|
||||
|
||||
!$OMP PARALLEL DEFAULT(shared) NUM_THREADS(nproc_target+1) &
|
||||
!$OMP PRIVATE(i)
|
||||
|
@ -4,6 +4,7 @@ program selection_slave
|
||||
! Helper program to compute the PT2 in distributed mode.
|
||||
END_DOC
|
||||
|
||||
call omp_set_nested(.false.)
|
||||
read_wf = .False.
|
||||
distributed_davidson = .False.
|
||||
SOFT_TOUCH read_wf distributed_davidson
|
||||
|
@ -16,7 +16,8 @@ END_PROVIDER
|
||||
integer :: e
|
||||
e = elec_num - n_core_orb * 2
|
||||
pt2_n_tasks_max = 1 + min((e*(e-1))/2, int(dsqrt(dble(N_det_generators)))/10)
|
||||
do i=1,N_det_generators
|
||||
pt2_F(:) = 1
|
||||
do i=1,min(10000,N_det_generators)
|
||||
pt2_F(i) = 1 + dble(pt2_n_tasks_max)*maxval(dsqrt(dabs(psi_coef_sorted_gen(i,1:N_states))))
|
||||
enddo
|
||||
|
||||
@ -25,7 +26,7 @@ END_PROVIDER
|
||||
pt2_N_teeth = 1
|
||||
else
|
||||
pt2_minDetInFirstTeeth = min(5, N_det_generators)
|
||||
do pt2_N_teeth=100,2,-1
|
||||
do pt2_N_teeth=50,2,-1
|
||||
if(testTeethBuilding(pt2_minDetInFirstTeeth, pt2_N_teeth)) exit
|
||||
end do
|
||||
end if
|
||||
@ -127,7 +128,7 @@ END_PROVIDER
|
||||
&BEGIN_PROVIDER [ integer, dress_N_cp ]
|
||||
implicit none
|
||||
integer :: N_c, N_j, U, t, i, m
|
||||
double precision :: v
|
||||
double precision :: v, dt
|
||||
double precision, allocatable :: tilde_M(:)
|
||||
logical, allocatable :: d(:)
|
||||
integer, external :: dress_find_sample
|
||||
@ -172,11 +173,13 @@ END_PROVIDER
|
||||
U = 0
|
||||
|
||||
m = 1
|
||||
! TODO Slow loop : to optimize
|
||||
do while(N_j < N_det_generators)
|
||||
!ADD_COMB
|
||||
N_c += 1
|
||||
dt = 0.d0
|
||||
do t=0, pt2_N_teeth-1
|
||||
v = pt2_u_0 + pt2_W_T * (dble(t) + pt2_u(N_c))
|
||||
v = pt2_u_0 + pt2_W_T * (dt + pt2_u(N_c))
|
||||
i = dress_find_sample(v, pt2_cW)
|
||||
tilde_M(i) += 1d0
|
||||
if(.not. d(i)) then
|
||||
@ -184,6 +187,7 @@ END_PROVIDER
|
||||
pt2_J_(N_j) = i
|
||||
d(i) = .true.
|
||||
end if
|
||||
dt = dt + 1.d0
|
||||
end do
|
||||
|
||||
!FILL_TOOTH
|
||||
@ -193,7 +197,7 @@ END_PROVIDER
|
||||
N_j += 1
|
||||
pt2_J_(N_j) = U
|
||||
d(U) = .true.
|
||||
exit;
|
||||
exit
|
||||
end if
|
||||
end do
|
||||
|
||||
@ -254,7 +258,7 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error)
|
||||
state_average_weight(dress_stoch_istate) = 1.d0
|
||||
TOUCH state_average_weight dress_stoch_istate
|
||||
|
||||
provide nproc mo_bielec_integrals_in_map mo_mono_elec_integral psi_selectors pt2_F
|
||||
provide nproc mo_bielec_integrals_in_map mo_mono_elec_integral psi_selectors pt2_F pt2_N_teeth dress_M_m
|
||||
|
||||
print *, '========== ================= ================= ================='
|
||||
print *, ' Samples Energy Stat. Error Seconds '
|
||||
@ -350,8 +354,6 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error)
|
||||
nproc_target = min(nproc_target,nproc)
|
||||
endif
|
||||
|
||||
call omp_set_nested(.true.)
|
||||
|
||||
!$OMP PARALLEL DEFAULT(shared) NUM_THREADS(2) &
|
||||
!$OMP PRIVATE(i)
|
||||
i = omp_get_thread_num()
|
||||
@ -372,7 +374,6 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error)
|
||||
enddo
|
||||
FREE dress_stoch_istate
|
||||
state_average_weight(:) = state_average_weight_save(:)
|
||||
! call omp_set_nested(.false.)
|
||||
TOUCH state_average_weight
|
||||
deallocate(delta,delta_s2)
|
||||
|
||||
@ -631,7 +632,7 @@ integer function dress_find_sample(v, w)
|
||||
r = N_det_generators
|
||||
|
||||
do while(r-l > 1)
|
||||
i = (r+l) / 2
|
||||
i = ishft(r+l,-1)
|
||||
if(w(i) < v) then
|
||||
l = i
|
||||
else
|
||||
|
@ -43,6 +43,7 @@ subroutine run_dress_slave(thread,iproce,energy)
|
||||
integer :: ntask_tbd, task_tbd(Nproc), i_gen_tbd(Nproc), subset_tbd(Nproc)
|
||||
logical :: interesting
|
||||
|
||||
PROVIDE dress_dot_F psi_coef dress_stoch_istate dress_e N_int
|
||||
|
||||
allocate(delta_det(N_states, N_det, 0:pt2_N_teeth+1, 2))
|
||||
allocate(cp(N_states, N_det, dress_N_cp, 2))
|
||||
@ -71,6 +72,8 @@ subroutine run_dress_slave(thread,iproce,energy)
|
||||
provide psi_energy
|
||||
ending = dress_N_cp+1
|
||||
ntask_tbd = 0
|
||||
call omp_set_nested(.true.)
|
||||
|
||||
!$OMP PARALLEL DEFAULT(SHARED) &
|
||||
!$OMP PRIVATE(interesting, breve_delta_m, task_id) &
|
||||
!$OMP PRIVATE(tmp,fac,m,l,t,sum_f,n_tasks) &
|
||||
@ -81,6 +84,7 @@ subroutine run_dress_slave(thread,iproce,energy)
|
||||
zmq_socket_push = new_zmq_push_socket(thread)
|
||||
integer, external :: connect_to_taskserver
|
||||
!$OMP CRITICAL
|
||||
call omp_set_nested(.false.)
|
||||
if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then
|
||||
print *, irp_here, ': Unable to connect to task server'
|
||||
stop -1
|
||||
@ -292,6 +296,7 @@ subroutine run_dress_slave(thread,iproce,energy)
|
||||
!$OMP END CRITICAL
|
||||
|
||||
!$OMP END PARALLEL
|
||||
call omp_set_nested(.false.)
|
||||
! do i=0,dress_N_cp+1
|
||||
! call omp_destroy_lock(lck_sto(i))
|
||||
! end do
|
||||
|
@ -8,6 +8,7 @@ program shifted_bk
|
||||
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_gen_order psi_bilinear_matrix_order
|
||||
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
|
||||
PROVIDE psi_bilinear_matrix_transp_order
|
||||
PROVIDE psi_energy
|
||||
|
||||
|
||||
!call diagonalize_CI()
|
||||
|
@ -151,10 +151,8 @@ subroutine run_w
|
||||
IRP_ENDIF
|
||||
|
||||
if (.true.) then
|
||||
!$OMP PARALLEL PRIVATE(i)
|
||||
i = omp_get_thread_num()
|
||||
call omp_set_nested(.True.)
|
||||
call run_dress_slave(0,i,dress_e0_denominator)
|
||||
!$OMP END PARALLEL
|
||||
endif
|
||||
print *, 'PT2 done'
|
||||
FREE state_average_weight
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash -x
|
||||
#
|
||||
# Creates a self-contained binary distribution in the form of a tar.gz file
|
||||
#
|
||||
@ -22,7 +22,7 @@ if [[ -f quantum_package.rc \
|
||||
&& -d ocaml \
|
||||
&& -d scripts ]]
|
||||
then
|
||||
head -1 README.md | grep "Quantum package" > /dev/null
|
||||
head -1 README.md | grep "IMPORTANT" > /dev/null
|
||||
if [[ $? -ne 0 ]]
|
||||
then
|
||||
echo "This doesn't look like a quantum_package directory (README.md)"
|
||||
@ -35,14 +35,11 @@ fi
|
||||
|
||||
|
||||
# Build all sources
|
||||
for dir in ${QP_ROOT}/{src,ocaml}
|
||||
do
|
||||
make -C ${dir}
|
||||
if [[ $? -ne 0 ]]
|
||||
then
|
||||
echo "Error building ${dir}"
|
||||
fi
|
||||
done
|
||||
#ninja
|
||||
#if [[ $? -ne 0 ]]
|
||||
#then
|
||||
# echo "Error building ${dir}"
|
||||
#fi
|
||||
|
||||
|
||||
# Copy the files in the static directory
|
||||
@ -68,10 +65,10 @@ echo "Creating root of static directory"
|
||||
# ---------------------------------
|
||||
|
||||
rm -rf -- ${QPACKAGE_STATIC}
|
||||
mkdir -p -- ${QPACKAGE_STATIC}/{bin,lib,extra_lib,data}
|
||||
mkdir -p -- ${QPACKAGE_STATIC}/{bin,lib,extra_lib,data,install}
|
||||
if [[ $? -ne 0 ]] ;
|
||||
then
|
||||
echo "Error creating ${QPACKAGE_STATIC}/{bin,lib,extra_lib,data}"
|
||||
echo "Error creating ${QPACKAGE_STATIC}/{bin,lib,extra_lib,data,install}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -97,7 +94,7 @@ fi
|
||||
cp -- ${FORTRAN_EXEC} ${OCAML_EXEC} ${QPACKAGE_STATIC}/bin
|
||||
if [[ $? -ne 0 ]] ;
|
||||
then
|
||||
echo 'cp -- ${FORTRAN_EXEC} ${OCAML_EXEC} ${QPACKAGE_STATIC}/bin'
|
||||
cp -- ${FORTRAN_EXEC} ${OCAML_EXEC} ${QPACKAGE_STATIC}/bin
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -143,10 +140,10 @@ cp -- ${QPACKAGE_STATIC}/extra_lib/lib{[gi]omp*,mkl*,lapack*,blas*,z*} ${QPACKAG
|
||||
echo "Copying EMSL_Basis directory"
|
||||
# ----------------------------
|
||||
|
||||
cp -r -- ${QP_ROOT}/EMSL_Basis ${QPACKAGE_STATIC}/
|
||||
cp -r -- ${QP_ROOT}/install/emsl ${QPACKAGE_STATIC}/install
|
||||
if [[ $? -ne 0 ]] ;
|
||||
then
|
||||
echo 'cp -r -- ${QP_ROOT}/EMSL_Basis ${QPACKAGE_STATIC}/'
|
||||
echo 'cp -r -- ${QP_ROOT}/install/emsl ${QPACKAGE_STATIC}/'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -169,12 +166,27 @@ echo "Creating quantum_package.rc"
|
||||
|
||||
cat << EOF > ${QPACKAGE_STATIC}/quantum_package.rc
|
||||
export QP_ROOT=\$( cd \$(dirname "\${BASH_SOURCE}") ; pwd -P )
|
||||
export LD_LIBRARY_PATH="\${QP_ROOT}"/lib:\${LD_LIBRARY_PATH}
|
||||
export LIBRARY_PATH="\${QP_ROOT}"/lib:\${LIBRARY_PATH}
|
||||
export PYTHONPATH="\${QP_ROOT}"/scripts:\${PYTHONPATH}
|
||||
export PATH="\${QP_ROOT}"/scripts:\${PATH}
|
||||
export PATH="\${QP_ROOT}"/bin:\${PATH}
|
||||
export PATH="\${QP_ROOT}"/ocaml:\${PATH}
|
||||
|
||||
export QP_EZFIO=\${QP_ROOT}/install/EZFIO
|
||||
export QP_PYTHON=\${QP_ROOT}/scripts:\${QP_ROOT}/scripts/ezfio_interface:\${QP_ROOT}/scripts/utility:\${QP_ROOT}/scripts/module:\${QP_ROOT}/scripts/pseudo:\${QP_ROOT}/scripts/compilation:\${QP_ROOT}/install/bats:\${QP_ROOT}/install/Downloads:\${QP_ROOT}/install/eigen:\${QP_ROOT}/install/p_graphviz:\${QP_ROOT}/install/gmp:\${QP_ROOT}/install/resultsFile:\${QP_ROOT}/install/_build:\${QP_ROOT}/install/emsl:\${QP_ROOT}/install/scripts:\${QP_ROOT}/install/docopt:\${QP_ROOT}/install/irpf90:\${QP_ROOT}/install/zlib:\${QP_ROOT}/install/EZFIO
|
||||
|
||||
export IRPF90=\${QP_ROOT}/bin/irpf90
|
||||
export NINJA=\${QP_ROOT}/bin/ninja
|
||||
function qp_prepend_export () {
|
||||
eval "value_1="\\\${\$1}""
|
||||
if [[ -z \$value_1 ]] ; then
|
||||
echo "\${2}:"
|
||||
else
|
||||
echo "\${2}:\${value_1}"
|
||||
fi
|
||||
}
|
||||
export PYTHONPATH=\$(qp_prepend_export "PYTHONPATH" "\${QP_EZFIO}/Python":"\${QP_PYTHON}")
|
||||
export PATH=\$(qp_prepend_export "PATH" "\${QP_PYTHON}":"\${QP_ROOT}"/bin:"\${QP_ROOT}"/ocaml)
|
||||
export LD_LIBRARY_PATH=\$(qp_prepend_export "LD_LIBRARY_PATH" "\${QP_ROOT}"/lib:"\${QP_ROOT}"/extra_lib:"\${QP_ROOT}"/lib64)
|
||||
export LIBRARY_PATH=\$(qp_prepend_export "LIBRARY_PATH" "\${QP_ROOT}"/lib:"\${QP_ROOT}"/extra_lib:"\${QP_ROOT}"/lib64)
|
||||
export C_INCLUDE_PATH=\$(qp_prepend_export "C_INCLUDE_PATH" "\${QP_ROOT}"/include)
|
||||
|
||||
# export QP_NIC=ib0
|
||||
EOF
|
||||
|
||||
#exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user