From 6f75d423b2b5bc4b3053771a4b6eec1800dce13e Mon Sep 17 00:00:00 2001 From: addman2 Date: Sun, 16 Jul 2023 17:30:41 +0200 Subject: [PATCH 1/3] Update README.md Add descriptions for some preprocessor macros --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 4a9b153..646cb6b 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,20 @@ It is important to note, the parallel make does not work. Successfull compilatio By addition one can run `make speed_tests` evaluating speed of TurboRVB package on her/his machine. +## Preprocessor Macros + +This project uses preprocessor macros for configuration. Here are descriptions of each macro and when they should be defined: + +- `_CUBLAS`: Define this macro if you plan to use the cuBLAS library for linear algebra operations. Macro `_OFFLOAD` has to be set on as well. +- `_OFFLOAD`: Define this macro if you want to use OpenMP for offloading computations to another processing unit such as a GPU. +- `_SIMD`: This macro forces the compiler to use more SIMD (Single Instruction, Multiple Data) instructions for parallel computing. Be cautious with this option as it may not always lead to increased performance and can make the code more complex. +- `__FFTW`: Define this macro to enable the use of the FFTW library for Fast Fourier Transform computations. +- `__PORT`: This macro should be defined when compiling with the Nvidia (Portland Group) Fortran compiler. +- `__SCALAPACK`: Define this macro to enable the use of the ScaLAPACK library for linear algebra operations on distributed memory systems. Macro `PARALLEL` has to be set to on as well. +- `__USE_INTERNAL_FFTW`: This macro is used to switch to the internal FFTW library included with the project. If this macro is defined, the project will ignore system-installed FFTW libraries and use the included one instead. +- `PARALLEL`: Define this macro to enable compilation of the project's MPI parallelized code. MPI (Message Passing Interface) is a standardized and portable message-passing system designed to function efficiently on a wide variety of parallel computing architectures. +- `RISC`: This macro should be defined when compiling with the IBM XL compiler. + ## Notes & known compilation issues 1) If present, intel `ifort` compiler with `MKL` should be preferred to gnu `gfortran` compiler with `BLAS` and `LAPACK`, because it has been tested more and yields consistently more reliable and faster binaries. From 75793c1f5b30bbf4a671d0823f79161a2ac77c98 Mon Sep 17 00:00:00 2001 From: kousuke-nakano <37653569+kousuke-nakano@users.noreply.github.com> Date: Thu, 7 Sep 2023 00:06:59 +0900 Subject: [PATCH 2/3] bin/force**.sh assume that xxx/turborvb/bin directory is added to PATH. This problem has been solved. --- bin/forcefn.sh | 20 ++++++++++---------- bin/forcefn_kpoints.sh | 10 ++++++---- bin/forcefn_kpoints_parallel.sh | 6 +++--- bin/forcevmc_kpoints.sh | 8 +++++--- bin/forcevmc_kpoints_parallel.sh | 6 +++--- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/bin/forcefn.sh b/bin/forcefn.sh index 9e478d5..d1be3f0 100755 --- a/bin/forcefn.sh +++ b/bin/forcefn.sh @@ -94,7 +94,7 @@ else # read all values here echo " reading all values in fort.12...." - echo " $2 $1 $3 ${num_all_columns} " | readffn.x $5 + echo " $2 $1 $3 ${num_all_columns} " | $BASEDIR/readffn.x $5 mv fort.21 fort.21_master # make each fort.21_col @@ -112,7 +112,7 @@ if [ ${flag_read_once} = True ]; then cp ./fort.21_tmp/fort.21_col_1 ./fort.21 mv ./fort.21 fort.21.1 else - echo " $2 $1 $3 1 " | readffn.x $5 + echo " $2 $1 $3 1 " | $BASEDIR/readffn.x $5 mv fort.21 fort.21.1 fi @@ -122,7 +122,7 @@ if [ "$ipc" -gt 1 ]; then cp ./fort.21_tmp/fort.21_col_2 ./fort.21 mv ./fort.21 fort.21.1i else - echo " $2 $1 $3 2 " | readffn.x $5 + echo " $2 $1 $3 2 " | $BASEDIR/readffn.x $5 mv fort.21 fort.21.1i fi fi @@ -138,7 +138,7 @@ do cp ./fort.21_tmp/fort.21_col_$n ./fort.21 mv fort.21 fort.21.2 else - echo " $2 $1 $3 $n " | readffn.x $5 + echo " $2 $1 $3 $n " | $BASEDIR/readffn.x $5 mv fort.21 fort.21.2 fi @@ -149,7 +149,7 @@ do cp ./fort.21_tmp/fort.21_col_$n ./fort.21 mv fort.21 fort.21.3 else - echo " $2 $1 $3 $n " | readffn.x $5 + echo " $2 $1 $3 $n " | $BASEDIR/readffn.x $5 mv fort.21 fort.21.3 fi @@ -160,7 +160,7 @@ do cp ./fort.21_tmp/fort.21_col_$n ./fort.21 mv fort.21 fort.21.4 else - echo " $2 $1 $3 $n " | readffn.x $5 + echo " $2 $1 $3 $n " | $BASEDIR/readffn.x $5 mv fort.21 fort.21.4 fi @@ -183,7 +183,7 @@ do cp ./fort.21_tmp/fort.21_col_$n ./fort.21 mv fort.21 fort.21.2 else - echo " $2 $1 $3 $n " | readffn.x $5 + echo " $2 $1 $3 $n " | $BASEDIR/readffn.x $5 mv fort.21 fort.21.2 fi @@ -194,7 +194,7 @@ do cp ./fort.21_tmp/fort.21_col_$n ./fort.21 mv fort.21 fort.21.3 else - echo " $2 $1 $3 $n " | readffn.x $5 + echo " $2 $1 $3 $n " | $BASEDIR/readffn.x $5 mv fort.21 fort.21.3 fi @@ -212,13 +212,13 @@ if [ ${flag_read_once} = True ]; then cp fort.21 fort.22 cp fort.21.1 fort.21 else - echo " $2 $1 $3 $n " | readffn.x $5 + echo " $2 $1 $3 $n " | $BASEDIR/readffn.x $5 cp fort.21 fort.22 cp fort.21.1 fort.21 fi echo "$1" | corrvar.x > pip0_fn.d - echo " $2 $1 $3 1 " | readf.x $5 + echo " $2 $1 $3 1 " | $BASEDIR/readf.x $5 tail -1 fort.20 > c1val awk ' NR == 1 {print " Energy (ave) =",$1,$2}' c1val >> pip0_fn.d diff --git a/bin/forcefn_kpoints.sh b/bin/forcefn_kpoints.sh index ab735d3..9d6e88c 100755 --- a/bin/forcefn_kpoints.sh +++ b/bin/forcefn_kpoints.sh @@ -21,6 +21,8 @@ start_time=`date +%s` +BASEDIR=$(dirname "$0") + awk ' NR == 1 {print $7}' parminimized.d > c1val read nvar < c1val awk ' NR == 1 {print $8}' parminimized.d > c1val @@ -81,11 +83,11 @@ do if [ ! -z $4 ] then -forcefn.sh $1 $2 $3 $4 $i +$BASEDIR/forcefn.sh $1 $2 $3 $4 $i else -forcefn.sh $1 $2 $3 1 $i +$BASEDIR/forcefn.sh $1 $2 $3 1 $i fi @@ -102,12 +104,12 @@ done -python $(which energyfn.py) > pip0_fn.d +python $BASEDIR/energyfn.py > pip0_fn.d if [ $ntot -gt 0 ] then -python $(which force.py) > forces_fn.dat +python $BASEDIR/force.py > forces_fn.dat fi exit diff --git a/bin/forcefn_kpoints_parallel.sh b/bin/forcefn_kpoints_parallel.sh index a8cf427..bf73125 100755 --- a/bin/forcefn_kpoints_parallel.sh +++ b/bin/forcefn_kpoints_parallel.sh @@ -152,7 +152,7 @@ do touch forces_fn.dat # calc forces - forcefn.sh $1 $2 $3 ${scale_pulay} 1 1>out_K${i}.o 2>err_K${i}.o & # run background + $BASEDIR/forcefn.sh $1 $2 $3 ${scale_pulay} 1 1>out_K${i}.o 2>err_K${i}.o & # run background echo " calculating for K${i}..., pid = $!, counter = ${counter_for_parallel_calc}" counter_for_parallel_calc=`expr ${counter_for_parallel_calc} + 1` @@ -193,10 +193,10 @@ done echo "done." -python $(which energyfn.py) > pip0_fn.d +python $BASEDIR/energyfn.py > pip0_fn.d if [ $ntot -gt 0 ]; then - python $(which force.py) > forces_fn.dat + python $BASEDIR/force.py > forces_fn.dat fi cd $root_dir diff --git a/bin/forcevmc_kpoints.sh b/bin/forcevmc_kpoints.sh index 47a0f6a..a54ce62 100755 --- a/bin/forcevmc_kpoints.sh +++ b/bin/forcevmc_kpoints.sh @@ -24,6 +24,8 @@ start_time=`date +%s` +BASEDIR=$(dirname "$0") + awk ' NR == 1 {print $7}' parminimized.d > c1val read nvar < c1val awk ' NR == 1 {print $8}' parminimized.d > c1val @@ -90,7 +92,7 @@ touch forces_vmc.dat for i in `seq 1 $nkps` do - forcevmc.sh $1 $2 ${scale_pulay} $i + $BASEDIR/forcevmc.sh $1 $2 ${scale_pulay} $i wkp=$(awk -v ind="${i}" ' NR == ind+2 {print $5} ' kp_info.dat) #echo " $i $wkp " >> prova @@ -102,10 +104,10 @@ do fi done -python $(which energy.py) > pip0.d +python $BASEDIR/energy.py > pip0.d if [ $ntot -gt 0 ]; then - python $(which force.py) > forces_vmc.dat + python $BASEDIR/force.py > forces_vmc.dat fi end_time=`date +%s` diff --git a/bin/forcevmc_kpoints_parallel.sh b/bin/forcevmc_kpoints_parallel.sh index 64fe7e3..15dafdd 100755 --- a/bin/forcevmc_kpoints_parallel.sh +++ b/bin/forcevmc_kpoints_parallel.sh @@ -142,7 +142,7 @@ do touch forces_vmc.dat # calc forces - forcevmc.sh $1 $2 ${scale_pulay} 1 1>out_K${i}.o 2>err_K${i}.o & # run background + ${BASEDIR}/forcevmc.sh $1 $2 ${scale_pulay} 1 1>out_K${i}.o 2>err_K${i}.o & # run background echo " calculating for K${i}..., pid = $!, counter = ${counter_for_parallel_calc}" counter_for_parallel_calc=`expr ${counter_for_parallel_calc} + 1` @@ -184,10 +184,10 @@ done echo "done." -python $(which energy.py) > pip0.d +python ${BASEDIR}/energy.py > pip0.d if [ $ntot -gt 0 ]; then - python $(which force.py) > forces_vmc.dat + python ${BASEDIR}/force.py > forces_vmc.dat fi cd $root_dir From ee9b8b4ebc727771b60c403ac460879233f5cf6e Mon Sep 17 00:00:00 2001 From: kousuke-nakano <37653569+kousuke-nakano@users.noreply.github.com> Date: Thu, 7 Sep 2023 23:44:14 +0900 Subject: [PATCH 3/3] found three missing / parts in bin/forcefn.sh --- bin/forcefn.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/forcefn.sh b/bin/forcefn.sh index d1be3f0..0a1b900 100755 --- a/bin/forcefn.sh +++ b/bin/forcefn.sh @@ -165,7 +165,7 @@ do fi echo " Force component $i " >> forces_fn.dat - echo "${scale_pulay}" | corrforza.x >> forces_fn.dat + echo "${scale_pulay}" | $BASEDIR/corrforza.x >> forces_fn.dat done fi @@ -199,7 +199,7 @@ do fi echo "Parameter number $i" >> forces_fn.dat - corrforzap.x >> forces_fn.dat + $BASEDIR/corrforzap.x >> forces_fn.dat done fi @@ -217,7 +217,7 @@ else cp fort.21.1 fort.21 fi -echo "$1" | corrvar.x > pip0_fn.d +echo "$1" | $BASEDIR/corrvar.x > pip0_fn.d echo " $2 $1 $3 1 " | $BASEDIR/readf.x $5 tail -1 fort.20 > c1val