Skip to content

Commit

Permalink
Merge branch 'sissaschool:devel' into devel-sissaschool#12
Browse files Browse the repository at this point in the history
  • Loading branch information
kousuke-nakano authored Sep 12, 2023
2 parents 49b72c8 + d8d9e6e commit e284558
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 26 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
26 changes: 13 additions & 13 deletions bin/forcefn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -160,12 +160,12 @@ 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

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
Expand All @@ -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

Expand All @@ -194,12 +194,12 @@ 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

echo "Parameter number $i" >> forces_fn.dat
corrforzap.x >> forces_fn.dat
$BASEDIR/corrforzap.x >> forces_fn.dat

done
fi
Expand All @@ -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 "$1" | $BASEDIR/corrvar.x > pip0_fn.d
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
Expand Down
10 changes: 6 additions & 4 deletions bin/forcefn_kpoints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bin/forcefn_kpoints_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions bin/forcevmc_kpoints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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`
Expand Down
6 changes: 3 additions & 3 deletions bin/forcevmc_kpoints_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e284558

Please sign in to comment.