diff --git a/toolchain/README.md b/toolchain/README.md index a08ab7a559..753ee83af6 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -1,6 +1,6 @@ # The ABACUS Toolchain -Version 2025.1 +Version 2025.2 ## Main Developer @@ -33,7 +33,6 @@ and give setup files that you can use to compile ABACUS. - [ ] Support a JSON or YAML configuration file for toolchain, which can be easily modified by users. - [ ] A better README and Detail markdown file. - [ ] Automatic installation of [DEEPMD](https://github.com/deepmodeling/deepmd-kit). -- [ ] Better compliation method for ABACUS-DEEPMD and ABACUS-DEEPKS. - [ ] Modulefile generation scripts. @@ -44,17 +43,17 @@ which will use scripts in *scripts* directory to compile install dependencies of ABACUS. It can be directly used, but not recommended. -There are also well-modified script to run *install_abacus_toolchain.sh* for `gnu-openblas` and `intel-mkl` toolchains dependencies. +There are also well-modified script to run *install_abacus_toolchain.sh* for `gnu` (gcc-openblas), `intel` (intel-mkl-mpi-compiler), `gcc-aocl` and `aocc-aocl` toolchains dependencies. ```shell # for gnu-openblas > ./toolchain_gnu.sh # for intel-mkl > ./toolchain_intel.sh -# for amd aocc-aocl -> ./toolchain_amd.sh -# for intel-mkl-mpich -> ./toolchain_intel-mpich.sh +# for AMD gcc-aocl +> ./toolchain_gcc-aocl.sh +# for AMD aocc-aocl +> ./toolchain_aocc-aocl.sh ``` It is recommended to run one of them first to get a fast installation of ABACUS under certain environments. @@ -66,13 +65,16 @@ If you are using Intel environments via Intel-OneAPI: please note: 4. Users can manually specify `--with-ifx=no` in `toolchain*.sh` to use `ifort` while keep other compiler to new version. 5. More information is in the later part of this README. -**Notice: You GCC version should be no lower than 5 !!!, larger than 7.3.0 is recommended** +If you are using AMD AOCL and AOCC, please note: -**Notice: You SHOULD `source` or `module load` related environments before use toolchain method for installation, espacially for `gcc` or `intel-oneAPI` !!!! for example, `module load mkl mpi icc compiler`** + +**Notice: You GCC version should be no lower than 5 !!!. The toolchain will check it, and gcc with version larger than 7.3.0 is recommended.** + +**Notice: You SHOULD `source` or `module load` related environments before use toolchain method for installation, especially for `intel`, `gcc-aocl` or `aocc-aocl` toolchain! For example, `module load mkl mpi icc compiler` for loading oneapi envs.** **Notice: You SHOULD keep your environments systematic, for example, you CANNOT load `intel-OneAPI` environments while use gcc toolchain !!!** -**Notice: If your server system already have libraries like `cmake`, `openmpi`, please change related setting in `toolchain*.sh` like `--with-cmake=system`** +**Notice: If your server system already have libraries like `cmake`, `openmpi`, please change related setting in `toolchain*.sh` like `--with-cmake=system`, note that the environments of these system package will not be added into install/setup file** All packages will be downloaded from [cp2k-static/download](https://www.cp2k.org/static/downloads). by `wget` , and will be detailedly compiled and installed in `install` directory by toolchain scripts, despite of: @@ -82,7 +84,7 @@ All packages will be downloaded from [cp2k-static/download](https://www.cp2k.org - `LibRI` which will be downloaded from [LibRI](https://github.com/abacusmodeling/LibRI) - `LibCOMM` which will be downloaded from [LibComm](https://github.com/abacusmodeling/LibComm) - `RapidJSON` which will be downloaded from [RapidJSON](https://github.com/Tencent/rapidjson) -Notice: These packages will be downloaded by `wget` from `github.com`, which is hard to be done in Chinese Internet. You may need to use offline installation method. +Notice: These packages will be downloaded by `wget` from `codeload.github.com`, which bypass the difficulty of Chinese Internet in some extent. If any downloading problem occurs, you may need to use offline installation method. Instead of github.com, we offer other package station, you can use it by: ```shell @@ -98,7 +100,7 @@ The above station will be updated handly but one should notice that the version If one want to install ABACUS by toolchain OFFLINE, one can manually download all the packages from [cp2k-static/download](https://www.cp2k.org/static/downloads) or official website and put them in *build* directory by formatted name -like *fftw-3.3.10.tar.gz*, or *openmpi-5.0.6.tar.bz2*, +like *fftw-3.3.10.tar.gz*, or *openmpi-5.0.7.tar.bz2*, then run this toolchain. All package will be detected and installed automatically. Also, one can install parts of packages OFFLINE and parts of packages ONLINE @@ -113,17 +115,17 @@ just by using this toolchain The needed dependencies version default: -- `cmake` 3.31.2 +- `cmake` 3.31.7 - `gcc` 13.2.0 (which will always NOT be installed, But use system) -- `OpenMPI` 5.0.6 (Version 5 OpenMPI is good but will have compability problem, user can manually downarade to Version 4 in toolchain scripts) +- `OpenMPI` 5.0.7 (Version 5 OpenMPI is good but will have compability problem, user can manually downarade to Version 4 in toolchain scripts by specify `--with-openmpi4`) - `MPICH` 4.3.0 -- `OpenBLAS` 0.3.28 (Intel toolchain need `get_vars.sh` tool from it) -- `ScaLAPACK` 2.2.1 (a developing version) +- `OpenBLAS` 0.3.29 (Intel toolchain need `get_vars.sh` tool from it) +- `ScaLAPACK` 2.2.2 - `FFTW` 3.3.10 - `LibXC` 7.0.0 -- `ELPA` 2025.01.001 -- `CEREAL` 1.3.2 -- `RapidJSON` 1.1.0 +- `ELPA` 2025.01.001 (may not be conpatiable for gpu-ver) +- `CEREAL` master (for oneapi compatibility) +- `RapidJSON` master (for oneapi compatibility) And: - Intel-oneAPI need user or server manager to manually install from Intel. - - [Intel-oneAPI](https://www.intel.cn/content/www/cn/zh/developer/tools/oneapi/toolkits.html) @@ -132,11 +134,10 @@ And: - - [AOCL](https://www.amd.com/zh-cn/developer/aocl.html) Dependencies below are optional, which is NOT installed by default: - - `LibTorch` 2.1.2 - `Libnpy` 1.0.1 -- `LibRI` 0.2.0 -- `LibComm` 0.1.1 +- `LibRI` 0.2.1.0 +- `LibComm` master (for openmpi compatibility) Users can install them by using `--with-*=install` in toolchain*.sh, which is `no` in default. Also, user can specify the absolute path of the package by `--with-*=path/to/package` in toolchain*.sh to allow toolchain to use the package. > Notice: LibTorch always suffer from GLIBC_VERSION problem, if you encounter this, please downgrade LibTorch version to 1.12.1 in scripts/stage4/install_torch.sh @@ -144,11 +145,10 @@ Users can install them by using `--with-*=install` in toolchain*.sh, which is `n > Notice: LibRI, LibComm, Rapidjson and Libnpy is on actively development, you should check-out the package version when using this toolchain. Users can easily compile and install dependencies of ABACUS -by running these scripts after loading `gcc` or `intel-mkl-mpi` -environment. +by running these scripts after loading related environment. The toolchain installation process can be interrupted at anytime. -just re-run *toolchain_\*.sh*, toolchain itself may fix it. If you encouter some problem, you can always remove some package in the interrupted points and re-run the toolchain. +just re-run *toolchain_\*.sh*, toolchain itself may fix it. If you encouter some problem like file corrupted, you can always remove some package in the interrupted points and re-run the toolchain. Some useful options: - `--dry-run`: just run the main install scripts for environment setting, without any package downloading or installation. @@ -157,22 +157,25 @@ Some useful options: If compliation is successful, a message will be shown like this: ```shell -> Done! -> To use the installed tools and libraries and ABACUS version -> compiled with it you will first need to execute at the prompt: -> source ./install/setup -> To build ABACUS by gnu-toolchain, just use: -> ./build_abacus_gnu.sh -> To build ABACUS by intel-toolchain, just use: -> ./build_abacus_intel.sh -> To build ABACUS by amd-toolchain in gcc-aocl, just use: -> ./build_abacus_amd.sh -> or you can modify the builder scripts to suit your needs. +========================== usage ========================= +Done! +To use the installed tools and libraries and ABACUS version +compiled with it you will first need to execute at the prompt: + source ${SETUPFILE} +To build ABACUS by gnu-toolchain, just use: + ./build_abacus_gnu.sh +To build ABACUS by intel-toolchain, just use: + ./build_abacus_intel.sh +To build ABACUS by amd-toolchain in gcc-aocl, just use: + ./build_abacus_gnu-aocl.sh +To build ABACUS by amd-toolchain in aocc-aocl, just use: + ./build_abacus_aocc-aocl.sh +or you can modify the builder scripts to suit your needs. ``` You can run *build_abacus_gnu.sh* or *build_abacus_intel.sh* to build ABACUS -by gnu-toolchain or intel-toolchain respectively, the builder scripts will -automatically locate the environment and compile ABACUS. +by gnu-toolchain or intel-toolchain respectively, same for the `gcc-aocl` and `aocc-aocl` toolchain. +Then, the builder scripts will automatically locate the environment and compile ABACUS. You can manually change the builder scripts to suit your needs. The builder scripts will generate `abacus_env.sh` for source @@ -240,6 +243,28 @@ then just build the abacus executable program by compiling it with `./build_abac The ELPA method need more parameter setting, but it doesn't seem to be affected by the CUDA toolkits version, and it is no need to manually install and package. +Note: ELPA-2025.01.001 may have problem in nvidia-GPU compilation on some V100-GPU with AMD-CPU machine, error message: +```bash + 1872 | static __forceinline void CONCAT_8ARGS(hh_trafo_complex_kernel_,ROW_LENGTH,_,SIMD_SET,_,BLOCK,hv_,WORD_LENGTH) (DATA_TYPE_PTR q, DATA_TYPE_PTR hh, int nb, int ldq + | ^~~~~~~~~~~~~~~~~~~~~~~~ +../src/elpa2/kernels/complex_128bit_256bit_512bit_BLOCK_template.c:51:47: note: in definition of macro 'CONCAT2_8ARGS' + 51 | #define CONCAT2_8ARGS(a, b, c, d, e, f, g, h) a ## b ## c ## d ## e ## f ## g ## h + | ^ +../src/elpa2/kernels/complex_128bit_256bit_512bit_BLOCK_template.c:1872:27: note: in expansion of macro 'CONCAT_8ARGS' + 1872 | static __forceinline void CONCAT_8ARGS(hh_trafo_complex_kernel_,ROW_LENGTH,_,SIMD_SET,_,BLOCK,hv_,WORD_LENGTH) (DATA_TYPE_PTR q, DATA_TYPE_PTR hh, int nb, int ldq + | ^~~~~~~~~~~~ + PPFC src/GPU/libelpa_openmp_private_la-mod_vendor_agnostic_general_layer.lo + PPFC test/shared/GPU/libelpatest_openmp_la-test_gpu_vendor_agnostic_layer.lo +../src/GPU/CUDA/./cudaFunctions_template.h(942): error: identifier "creal" is undefined + double alpha_real = creal(alpha); + ^ + +../src/GPU/CUDA/./cudaFunctions_template.h(960): error: identifier "creal" is undefined + float alpha_real = creal(alpha); +``` + +And you may need to change ELPA version to 2024.05.001, edit `toolchain/scripts/stage3/install_elpa.sh` to do it. + 2. For the cusolvermp method, toolchain_*.sh does not need to be changed, just follow it directly install dependencies using `./toolchain_*.sh`, and then add ```shell -DUSE_CUDA=ON \ @@ -268,11 +293,8 @@ After compiling, you can specify `device GPU` in INPUT file to use GPU version o #### OneAPI 2025.0 problem -Generally, OneAPI 2025.0 can be useful to compile basic function of ABACUS, but one will encounter compatible problem related to something. Here is the treatment -- related to rapidjson: -- - Not to use rapidjson in your toolchain -- - or use the master branch of [RapidJSON](https://github.com/Tencent/rapidjson) -- related to LibRI: not to use LibRI or downgrade your OneAPI. +Generally, OneAPI 2025.0 can be useful to compile basic function of ABACUS, but one will encounter compatible problem related to something. +- related to LibRI: refer to [#6190](https://github.com/deepmodeling/abacus-develop/issues/6190), it is recommended not to use LibRI or downgrade your OneAPI now. #### ELPA problem via Intel-oneAPI toolchain in AMD server @@ -301,19 +323,22 @@ And will not occur in Intel-MPI before 2021.10.0 (Intel-oneAPI before 2023.2.0) More problem and possible solution can be accessed via [#2928](https://github.com/deepmodeling/abacus-develop/issues/2928) +#### gcc-MKL problem + +You cannot use gcc as compiler while using MKL as math library for compile ABACUS, there will be lots of error in the lask linking step. See [#3198](https://github.com/deepmodeling/abacus-develop/issues/3198) + ### AMD AOCC-AOCL problem -You cannot use AOCC to complie abacus now, see [#5982](https://github.com/deepmodeling/abacus-develop/issues/5982) . +Use AOCC-AOCL to compile dependencies is permitted and usually get boosting in ABACUS efficiency. But you need to get rid of `flang` while compiling ELPA. Toolchain itself helps you make this `flang` shade in default of `aocc-aocl` toolchain, and you can manually use `flang` by setting `--with-flang=yes` in `toolchain_aocc-aocl.sh` to have a try, while toolchain helps you to bypass the possible errors in compiling ELPA with AOCC-AOCL, but the computing efficiency will be relatively lower compared to `gnu` or `gcc-aocl` toolchain. -However, use AOCC-AOCL to compile dependencies is permitted and usually get boosting in ABACUS effciency. But you need to get rid of `flang` while compling ELPA. Toolchain itself help you make this `flang` shade in default, and you can manully use `flang` by setting `--with-flang=yes` in `toolchain_amd.sh` to have a try. +The `gcc-aocl` toolchain will have no problem above for aocc-dependent aocl. However, the gcc-dependent aocl will have some package linking problem related to OpenMPI. Take it with caution. -Notice: ABACUS via GCC-AOCL in AOCC-AOCL toolchain have no application with DeePKS, DeePMD and LibRI. ### OpenMPI problem #### in EXX and LibRI -- GCC toolchain with OpenMPI cannot compile LibComm v0.1.1 due to the different MPI variable type from MPICH and IntelMPI, see discussion here [#5033](https://github.com/deepmodeling/abacus-develop/issues/5033), you can try use a newest branch of LibComm by +- [Fixed in Toolchain 2025-02] GCC toolchain with OpenMPI cannot compile LibComm v0.1.1 due to the different MPI variable type from MPICH and IntelMPI, see discussion here [#5033](https://github.com/deepmodeling/abacus-develop/issues/5033), you can try use a newest branch of LibComm by ``` git clone https://gitee.com/abacus_dft/LibComm -b MPI_Type_Contiguous_Pool ``` diff --git a/toolchain/build_abacus_gnu-aocl.sh b/toolchain/build_abacus_aocc-aocl.sh similarity index 75% rename from toolchain/build_abacus_gnu-aocl.sh rename to toolchain/build_abacus_aocc-aocl.sh index ab283efb3b..c06cdd1f4b 100755 --- a/toolchain/build_abacus_gnu-aocl.sh +++ b/toolchain/build_abacus_aocc-aocl.sh @@ -16,21 +16,22 @@ INSTALL_DIR=$TOOL/install source $INSTALL_DIR/setup cd $ABACUS_DIR ABACUS_DIR=$(pwd) -#AOCLhome=/opt/aocl # user can specify this parameter +#AOCLhome=/opt/aocl-linux-aocc-5.0.0/5.0.0/aocl/ # user should specify this parameter BUILD_DIR=build_abacus_aocl rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu -CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal +# ELPA=$INSTALL_DIR/elpa-2025.01.001/nvidia # for gpu-lcao +CEREAL=$INSTALL_DIR/cereal-master/include/cereal LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/ -# LAPACK=$AOCLhome/lib -# SCALAPACK=$AOCLhome/lib -# FFTW3=$AOCLhome +RAPIDJSON=$INSTALL_DIR/rapidjson-master/ +LAPACK=$AOCLhome/lib +SCALAPACK=$AOCLhome/lib +FFTW3=$AOCLhome # LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 -# LIBCOMM=$INSTALL_DIR/LibComm-0.1.1 +# LIBCOMM=$INSTALL_DIR/LibComm-master # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem @@ -40,6 +41,9 @@ RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_CXX_COMPILER=clang++ \ -DMPI_CXX_COMPILER=mpicxx \ + -DLAPACK_DIR=$LAPACK \ + -DSCALAPACK_DIR=$SCALAPACK \ + -DFFTW3_DIR=$FFTW3 \ -DELPA_DIR=$ELPA \ -DCEREAL_INCLUDE_DIR=$CEREAL \ -DLibxc_DIR=$LIBXC \ @@ -49,9 +53,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DUSE_ELPA=ON \ -DENABLE_RAPIDJSON=ON \ -DRapidJSON_DIR=$RAPIDJSON \ -# -DLAPACK_DIR=$LAPACK \ -# -DSCALAPACK_DIR=$SCALAPACK \ -# -DFFTW3_DIR=$FFTW3 \ # -DENABLE_DEEPKS=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ @@ -59,6 +60,9 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ # -DLIBRI_DIR=$LIBRI \ # -DLIBCOMM_DIR=$LIBCOMM \ # -DDeePMD_DIR=$DEEPMD \ +# -DUSE_CUDA=ON \ +# -DENABLE_CUSOLVERMP=ON \ +# -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib # if one want's to include deepmd, your system gcc version should be >= 11.3.0 for glibc requirements diff --git a/toolchain/build_abacus_intel-mpich.sh b/toolchain/build_abacus_gcc-aocl.sh similarity index 57% rename from toolchain/build_abacus_intel-mpich.sh rename to toolchain/build_abacus_gcc-aocl.sh index 59e93967ae..df31fcb7a6 100755 --- a/toolchain/build_abacus_intel-mpich.sh +++ b/toolchain/build_abacus_gcc-aocl.sh @@ -6,10 +6,9 @@ #SBATCH -e install.err # JamesMisaka in 2025.03.09 -# Build ABACUS by intel-toolchain with mpich +# Build ABACUS by amd-openmpi toolchain -# module load mkl compiler -# source path/to/setvars.sh +# module load openmpi aocc aocl ABACUS_DIR=.. TOOL=$(pwd) @@ -17,25 +16,34 @@ INSTALL_DIR=$TOOL/install source $INSTALL_DIR/setup cd $ABACUS_DIR ABACUS_DIR=$(pwd) +#AOCLhome=/opt/aocl-linux-aocc-5.0.0/5.0.0/aocl/ # user should specify this parameter -BUILD_DIR=build_abacus_intel-mpich +BUILD_DIR=build_abacus_aocl rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu -CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal -LIBXC=$INSTALL_DIR/libx-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/ +# ELPA=$INSTALL_DIR/elpa-2025.01.001/nvidia # for gpu-lcao +CEREAL=$INSTALL_DIR/cereal-master/include/cereal +LIBXC=$INSTALL_DIR/libxc-7.0.0 +RAPIDJSON=$INSTALL_DIR/rapidjson-master/ +LAPACK=$AOCLhome/lib +SCALAPACK=$AOCLhome/lib +FFTW3=$AOCLhome +# LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 +# LIBCOMM=$INSTALL_DIR/LibComm-master # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include -# LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 -# LIBCOMM=$INSTALL_DIR/LibComm-0.1.1 # DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem +# if clang++ have problem, switch back to g++ + cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ - -DCMAKE_CXX_COMPILER=icpx \ + -DCMAKE_CXX_COMPILER=g++ \ -DMPI_CXX_COMPILER=mpicxx \ - -DMKLROOT=$MKLROOT \ + -DLAPACK_DIR=$LAPACK \ + -DSCALAPACK_DIR=$SCALAPACK \ + -DFFTW3_DIR=$FFTW3 \ -DELPA_DIR=$ELPA \ -DCEREAL_INCLUDE_DIR=$CEREAL \ -DLibxc_DIR=$LIBXC \ @@ -45,14 +53,16 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DUSE_ELPA=ON \ -DENABLE_RAPIDJSON=ON \ -DRapidJSON_DIR=$RAPIDJSON \ -# -DENABLE_DEEPKS=1 \ -# -DTorch_DIR=$LIBTORCH \ -# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ -# -DENABLE_LIBRI=ON \ -# -DLIBRI_DIR=$LIBRI \ -# -DLIBCOMM_DIR=$LIBCOMM \ -# -DDeePMD_DIR=$DEEPMD \ - +# -DENABLE_DEEPKS=1 \ +# -DTorch_DIR=$LIBTORCH \ +# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ +# -DENABLE_LIBRI=ON \ +# -DLIBRI_DIR=$LIBRI \ +# -DLIBCOMM_DIR=$LIBCOMM \ +# -DDeePMD_DIR=$DEEPMD \ +# -DUSE_CUDA=ON \ +# -DENABLE_CUSOLVERMP=ON \ +# -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib # if one want's to include deepmd, your system gcc version should be >= 11.3.0 for glibc requirements diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index febe2fa5aa..1cb6dbf14c 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -21,16 +21,16 @@ BUILD_DIR=build_abacus_gnu rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -LAPACK=$INSTALL_DIR/openblas-0.3.28/lib -SCALAPACK=$INSTALL_DIR/scalapack-2.2.1/lib +LAPACK=$INSTALL_DIR/openblas-0.3.29/lib +SCALAPACK=$INSTALL_DIR/scalapack-2.2.2/lib ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu # ELPA=$INSTALL_DIR/elpa-2025.01.001/nvidia # for gpu-lcao FFTW3=$INSTALL_DIR/fftw-3.3.10 -CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal +CEREAL=$INSTALL_DIR/cereal-master/include/cereal LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/ +RAPIDJSON=$INSTALL_DIR/rapidjson-master/ # LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 -# LIBCOMM=$INSTALL_DIR/LibComm-0.1.1 +# LIBCOMM=$INSTALL_DIR/LibComm-master # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem @@ -50,7 +50,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DUSE_ELPA=ON \ -DENABLE_RAPIDJSON=ON \ -DRapidJSON_DIR=$RAPIDJSON \ -# -DUSE_CUDA=ON \ # -DENABLE_DEEPKS=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ @@ -58,8 +57,9 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ # -DLIBRI_DIR=$LIBRI \ # -DLIBCOMM_DIR=$LIBCOMM \ # -DDeePMD_DIR=$DEEPMD \ - #-DENABLE_CUSOLVERMP=ON \ - #-D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib +# -DUSE_CUDA=ON \ +# -DENABLE_CUSOLVERMP=ON \ +# -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib # # add mkl env for libtorch to link # if one want to install libtorch, mkl should be load in build process diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index 5fc96a26b8..b54bf6f6ad 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -24,13 +24,13 @@ rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu # ELPA=$INSTALL_DIR/elpa-2025.01.001/nvidia # for gpu-lcao -CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal +CEREAL=$INSTALL_DIR/cereal-master/include/cereal LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/ +RAPIDJSON=$INSTALL_DIR/rapidjson-master/ # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 -# LIBCOMM=$INSTALL_DIR/LibComm-0.1.1 +# LIBCOMM=$INSTALL_DIR/LibComm-master # DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem # Notice: if you are compiling with AMD-CPU or GPU-version ABACUS, then `icpc` and `mpiicpc` compilers are recommended @@ -47,7 +47,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DUSE_ELPA=ON \ -DENABLE_RAPIDJSON=ON \ -DRapidJSON_DIR=$RAPIDJSON \ -# -DUSE_CUDA=ON \ # -DENABLE_DEEPKS=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ @@ -55,7 +54,9 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ # -DLIBRI_DIR=$LIBRI \ # -DLIBCOMM_DIR=$LIBCOMM \ # -DDeePMD_DIR=$DEEPMD \ - +# -DUSE_CUDA=ON \ +# -DENABLE_CUSOLVERMP=ON \ +# -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib cmake --build $BUILD_DIR -j `nproc` cmake --install $BUILD_DIR 2>/dev/null diff --git a/toolchain/install_abacus_toolchain.sh b/toolchain/install_abacus_toolchain.sh index dce50684ec..92dad2a761 100755 --- a/toolchain/install_abacus_toolchain.sh +++ b/toolchain/install_abacus_toolchain.sh @@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)" #> can be used to compile and use ABACUS #> \history Created on Friday, 2023/08/18 # Update for Intel (18.08.2023, MK) -#> \author Zhaoqing Liu quanmisaka@stu.pku.edu.cn +#> \author Zhaoqing Liu (Quantum Misaka) quanmisaka@stu.pku.edu.cn # ***************************************************************************** # ------------------------------------------------------------------------ @@ -158,7 +158,7 @@ The --with-PKG options follow the rules: Default = no --with-ifx Use the new Intel Fortran compiler ifx instead of ifort to compile dependence of ABACUS, along with mpiifx (if --with-intel-classic=no) Default = yes - --with-amd Use the AMD compiler to build CP2K. + --with-amd Use the AMD compiler to build ABACUS. Default = system --with-flang Use flang in AMD compiler, which may lead to problem and efficiency loss in ELPA Default = no @@ -622,6 +622,39 @@ export ENABLE_CRAY="${enable_cray}" # ------------------------------------------------------------------------ # Check and solve known conflicts before installations proceed # ------------------------------------------------------------------------ +# Check GCC version: +# Quantum Misaka in 2025-05-05 +if [ "${with_gcc}" != "__INSTALL__" ] +then + export GCC_MIN_VERSION=5 + echo "Checking system GCC version for gcc, intel and amd toolchain" + echo "Your System gcc/g++/gfortran version should be consistent" + echo "Minimum required version: ${GCC_MIN_VERSION}" + gcc_version=$(gcc --version | head -n 1 | awk '{print $NF}') + gxx_version=$(g++ --version | head -n 1 | awk '{print $NF}') + gfc_version=$(gfortran --version | head -n 1 | awk '{print $NF}') + echo "Your gcc version: ${gcc_version}" + echo "Your g++ version: ${gxx_version}" + echo "Your gfortran version: ${gfc_version}" + + if [ "${gcc_version}" != "${gxx_version}" ] || [ "${gcc_version}" != "${gfc_version}" ]; then + echo "Your gcc/g++/gfortran version are not consistent !!!" + exit 1 + fi + + extract_major() { + echo $1 | awk -F. '{print $1}' + } + + gcc_major=$(extract_major "${gcc_version}") + if [ "${gcc_major}" -lt "${GCC_MIN_VERSION}" ] + then + echo "Your GCC version do not be larger than ${GCC_MIN_VERSION} !!!" + exit 1 + fi + echo "Your GCC version seems to be enough for ABACUS installation." +fi + # Compiler conflicts if [ "${with_intel}" != "__DONTUSE__" ] && [ "${with_gcc}" = "__INSTALL__" ]; then echo "You have chosen to use the Intel compiler, therefore the installation of the GNU compiler will be skipped." @@ -632,9 +665,10 @@ if [ "${with_amd}" != "__DONTUSE__" ] && [ "${with_gcc}" = "__INSTALL__" ]; then with_gcc="__SYSTEM__" fi if [ "${with_amd}" != "__DONTUSE__" ] && [ "${with_intel}" != "__DONTUSE__" ]; then - report_error "You have chosen to use the AMD and the Intel compiler. Select only one compiler." + report_error "You have chosen to use the AMD and the Intel compiler to compile dependent packages. Select only one compiler." exit 1 fi + # MPI library conflicts if [ "${MPI_MODE}" = "no" ]; then if [ "${with_scalapack}" != "__DONTUSE__" ]; then @@ -699,13 +733,6 @@ fi # Select the correct compute number based on the GPU architecture # QuantumMisaka in 2025-03-19 export ARCH_NUM="${GPUVER//.}" -if [[ "$ARCH_NUM" =~ ^[1-9][0-9]*$ ]] || [ $ARCH_NUM = "no" ]; then - echo "Notice: GPU compilation is enabled, and GPU compatibility is set via --gpu-ver to sm_${ARCH_NUM}." -else - report_error ${LINENO} \ - "When GPU compilation is enabled, the --gpu-ver variable should be properly set regarding to GPU compatibility. For check your GPU compatibility, visit https://developer.nvidia.com/cuda-gpus. For example: A100 -> 8.0 (or 80), V100 -> 7.0 (or 70), 4090 -> 8.9 (or 89)" - exit 1 -fi # If CUDA or HIP are enabled, make sure the GPU version has been defined. if [ "${ENABLE_CUDA}" = "__TRUE__" ] || [ "${ENABLE_HIP}" = "__TRUE__" ]; then @@ -713,6 +740,13 @@ if [ "${ENABLE_CUDA}" = "__TRUE__" ] || [ "${ENABLE_HIP}" = "__TRUE__" ]; then report_error "Please choose GPU architecture to compile for with --gpu-ver" exit 1 fi + if [[ "$ARCH_NUM" =~ ^[1-9][0-9]*$ ]] || [ $ARCH_NUM = "no" ]; then + echo "Notice: GPU compilation is enabled, and GPU compatibility is set via --gpu-ver to sm_${ARCH_NUM}." + else + report_error ${LINENO} \ + "When GPU compilation is enabled, the --gpu-ver variable should be properly set regarding to GPU compatibility. For check your GPU compatibility, visit https://developer.nvidia.com/cuda-gpus. For example: A100 -> 8.0 (or 80), V100 -> 7.0 (or 70), 4090 -> 8.9 (or 89)" + exit 1 + fi fi # ABACUS itself and some dependencies require cmake. @@ -857,9 +891,10 @@ To build ABACUS by gnu-toolchain, just use: To build ABACUS by intel-toolchain, just use: ./build_abacus_intel.sh To build ABACUS by amd-toolchain in gcc-aocl, just use: - ./build_abacus_gnu-aocl.sh + ./build_abacus_gcc-aocl.sh +To build ABACUS by amd-toolchain in aocc-aocl, just use: + ./build_abacus_aocc-aocl.sh or you can modify the builder scripts to suit your needs. -""" EOF fi diff --git a/toolchain/root_requirements/README b/toolchain/root_requirements/README new file mode 100644 index 0000000000..e513139b41 --- /dev/null +++ b/toolchain/root_requirements/README @@ -0,0 +1,7 @@ +## Scripts in root_requirements directory + +These scripts are for basic requirements for using toolchain +which should be implemented in your server global environments. +if not, please contact your server manager. + +You should use these scripts under root permission. \ No newline at end of file diff --git a/toolchain/install_requirements.sh b/toolchain/root_requirements/install_requirements.sh similarity index 100% rename from toolchain/install_requirements.sh rename to toolchain/root_requirements/install_requirements.sh diff --git a/toolchain/install_requirements_fedora.sh b/toolchain/root_requirements/install_requirements_fedora.sh similarity index 93% rename from toolchain/install_requirements_fedora.sh rename to toolchain/root_requirements/install_requirements_fedora.sh index c31d504b0a..71b531ed73 100755 --- a/toolchain/install_requirements_fedora.sh +++ b/toolchain/root_requirements/install_requirements_fedora.sh @@ -28,7 +28,8 @@ dnf -qy install \ vim-common \ wget \ which \ - zlib-devel + zlib-devel \ + zlib-static dnf clean -q all diff --git a/toolchain/install_requirements_ubuntu.sh b/toolchain/root_requirements/install_requirements_ubuntu.sh similarity index 97% rename from toolchain/install_requirements_ubuntu.sh rename to toolchain/root_requirements/install_requirements_ubuntu.sh index aa60f4bfc4..8f97db1ec5 100755 --- a/toolchain/install_requirements_ubuntu.sh +++ b/toolchain/root_requirements/install_requirements_ubuntu.sh @@ -28,6 +28,7 @@ apt-get install -qq --no-install-recommends \ patch \ pkg-config \ python3 \ + python3-pip \ unzip \ wget \ xxd \ diff --git a/toolchain/scripts/VERSION b/toolchain/scripts/VERSION index d50de5efde..e94549a66e 100644 --- a/toolchain/scripts/VERSION +++ b/toolchain/scripts/VERSION @@ -1,2 +1,2 @@ # version file to force a rebuild of the entire toolchain -VERSION="2025.1" \ No newline at end of file +VERSION="2025.2" \ No newline at end of file diff --git a/toolchain/scripts/get_openblas_arch.sh b/toolchain/scripts/get_openblas_arch.sh index 4104ff821c..f0fb8b1aa8 100755 --- a/toolchain/scripts/get_openblas_arch.sh +++ b/toolchain/scripts/get_openblas_arch.sh @@ -8,8 +8,8 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)" -openblas_ver="0.3.28" # Keep in sync with install_openblas.sh -openblas_sha256="f1003466ad074e9b0c8d421a204121100b0751c96fc6fcf3d1456bd12f8a00a1" +openblas_ver="0.3.29" # Keep in sync with install_openblas.sh +openblas_sha256="38240eee1b29e2bde47ebb5d61160207dc68668a54cac62c076bb5032013b1eb" openblas_pkg="OpenBLAS-${openblas_ver}.tar.gz" source "${SCRIPT_DIR}"/common_vars.sh @@ -40,7 +40,10 @@ if ! [ "$openblas_dir" ]; then if [ -f ${openblas_pkg} ]; then echo "${openblas_pkg} is found" else - download_pkg_from_ABACUS_org "${openblas_sha256}" "${openblas_pkg}" + #download_pkg_from_ABACUS_org "${openblas_sha256}" "${openblas_pkg}" + # using codeload.github + url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}" + download_pkg_from_url "${openblas_sha256}" "${openblas_pkg}" "${url}" fi tar -xzf ${openblas_pkg} openblas_dir="$(find_openblas_dir)" diff --git a/toolchain/scripts/stage0/install_cmake.sh b/toolchain/scripts/stage0/install_cmake.sh index 894a1e58f2..0ef5158c97 100755 --- a/toolchain/scripts/stage0/install_cmake.sh +++ b/toolchain/scripts/stage0/install_cmake.sh @@ -3,7 +3,7 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2025-0308 +# Last Update in 2025-0504 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" @@ -21,13 +21,23 @@ cd "${BUILDDIR}" case "${with_cmake}" in __INSTALL__) echo "==================== Installing CMake ====================" - cmake_ver="3.31.2" + cmake_ver="3.31.7" + cmake_ext="sh" if [ "${OPENBLAS_ARCH}" = "arm64" ]; then - cmake_arch="linux-aarch64" - cmake_sha256="85cc81f782cd8b5ac346e570ad5cfba3bdbe5aa01f27f7ce6266c4cef93342550" + if [ "$(uname -s)" = "Darwin" ]; then + cmake_arch="macos-universal" + cmake_sha256="1cb11aa2edae8551bb0f22807c6f5246bd0eb60ae9fa1474781eb4095d299aca" + cmake_ext="tar.gz" + elif [ "$(uname -s)" = "Linux" ]; then + cmake_arch="linux-aarch64" + cmake_sha256="ce8e32b2c1c497dd7f619124c043ac5c28a88677e390c58748dd62fe460c62a2" + else + report_error ${LINENO} \ + "cmake installation for ARCH=${OPENBLAS_ARCH} under $(uname -s) is not supported. You can try to use the system installation using the flag --with-cmake=system instead." + fi elif [ "${OPENBLAS_ARCH}" = "x86_64" ]; then cmake_arch="linux-x86_64" - cmake_sha256="b81cf3f4892683133f330cd7c016c28049b5725617db24ca8763360883545d34" + cmake_sha256="b7a5c909cdafc36042c8c9bd5765e92ff1f2528cf01720aa6dc4df294ec7e1a0" else report_error ${LINENO} \ "cmake installation for ARCH=${ARCH} is not supported. You can try to use the system installation using the flag --with-cmake=system instead." @@ -36,7 +46,7 @@ case "${with_cmake}" in pkg_install_dir="${INSTALLDIR}/cmake-${cmake_ver}" #pkg_install_dir="${HOME}/apps/cmake/${cmake_ver}" install_lock_file="$pkg_install_dir/install_successful" - cmake_pkg="cmake-${cmake_ver}-${cmake_arch}.sh" + cmake_pkg="cmake-${cmake_ver}-${cmake_arch}.${cmake_ext}" if verify_checksums "${install_lock_file}"; then echo "cmake-${cmake_ver} is already installed, skipping it." else @@ -52,7 +62,11 @@ case "${with_cmake}" in else echo "Installing from scratch into ${pkg_install_dir}" mkdir -p ${pkg_install_dir} - /bin/sh $cmake_pkg --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log + if [ "${cmake_arch}" = "macos-universal" ]; then + tar --strip-components=3 -xvf $cmake_pkg -C ${pkg_install_dir} > install.log 2>&1 || tail -n ${LOG_LINES} install.log + else + /bin/sh $cmake_pkg --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log + fi write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})" fi fi diff --git a/toolchain/scripts/stage1/install_openmpi.sh b/toolchain/scripts/stage1/install_openmpi.sh index e9ececd7a7..faad08eb48 100755 --- a/toolchain/scripts/stage1/install_openmpi.sh +++ b/toolchain/scripts/stage1/install_openmpi.sh @@ -3,7 +3,7 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2025-0308 +# Last Update in 2025-0504 # Change default version to openmpi 5 # allow user to choose openmpi 4 in used scripts @@ -14,8 +14,8 @@ if [ "${OPENMPI_4TH}" = "yes" ]; then openmpi_ver="4.1.6" openmpi_sha256="f740994485516deb63b5311af122c265179f5328a0d857a567b85db00b11e415" else - openmpi_ver="5.0.6" - openmpi_sha256="bd4183fcbc43477c254799b429df1a6e576c042e74a2d2f8b37d537b2ff98157" + openmpi_ver="5.0.7" + openmpi_sha256="119f2009936a403334d0df3c0d74d5595a32d99497f9b1d41e90019fee2fc2dd" fi openmpi_pkg="openmpi-${openmpi_ver}.tar.bz2" @@ -69,6 +69,9 @@ case "${with_openmpi}" in CFLAGS="${CFLAGS} -fgnu89-inline" fi fi + + # Notice for RHEL8 refer https://github.com/open-mpi/ompi/issues/13103 + # OpenMPI 5.0 only supports PMIx # PMI support is required for Slurm, but not for other schedulers # default not use diff --git a/toolchain/scripts/stage2/install_aocl.sh b/toolchain/scripts/stage2/install_aocl.sh index 83d6d125b3..d3f0d70dd5 100755 --- a/toolchain/scripts/stage2/install_aocl.sh +++ b/toolchain/scripts/stage2/install_aocl.sh @@ -49,7 +49,7 @@ case "${with_aocl}" in *) echo "==================== Linking AOCL to user paths ====================" - pkg_install_dir="$with_openblas" + pkg_install_dir="$with_aocl" check_dir "${pkg_install_dir}/include" check_dir "${pkg_install_dir}/lib" AOCL_CFLAGS="-I'${pkg_install_dir}/include'" @@ -57,8 +57,8 @@ case "${with_aocl}" in AOCL_LIBS="-lblis -lflame" ;; esac -if [ "$with_openblas" != "__DONTUSE__" ]; then - if [ "$with_openblas" != "__SYSTEM__" ]; then +if [ "$with_aocl" != "__DONTUSE__" ]; then + if [ "$with_aocl" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_aocl" prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib" prepend_path LD_RUN_PATH "$pkg_install_dir/lib" @@ -76,7 +76,7 @@ export AOCL_ROOT=${pkg_install_dir} EOF cat "${BUILDDIR}/setup_aocl" >> $SETUPFILE fi - cat << EOF >> "${BUILDDIR}/setup_aocl" +cat << EOF >> "${BUILDDIR}/setup_aocl" export AOCL_ROOT="${pkg_install_dir}" export AOCL_CFLAGS="${AOCL_CFLAGS}" export AOCL_LDFLAGS="${AOCL_LDFLAGS}" diff --git a/toolchain/scripts/stage2/install_openblas.sh b/toolchain/scripts/stage2/install_openblas.sh index 2833501a48..fb4e0c563e 100755 --- a/toolchain/scripts/stage2/install_openblas.sh +++ b/toolchain/scripts/stage2/install_openblas.sh @@ -8,8 +8,8 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -openblas_ver="0.3.28" # Keep in sync with get_openblas_arch.sh -openblas_sha256="f1003466ad074e9b0c8d421a204121100b0751c96fc6fcf3d1456bd12f8a00a1" +openblas_ver="0.3.29" # Keep in sync with get_openblas_arch.sh +openblas_sha256="38240eee1b29e2bde47ebb5d61160207dc68668a54cac62c076bb5032013b1eb" openblas_pkg="OpenBLAS-${openblas_ver}.tar.gz" source "${SCRIPT_DIR}"/common_vars.sh @@ -39,7 +39,10 @@ case "${with_openblas}" in if [ -f ${openblas_pkg} ]; then echo "${openblas_pkg} is found" else - download_pkg_from_ABACUS_org "${openblas_sha256}" "${openblas_pkg}" + #download_pkg_from_ABACUS_org "${openblas_sha256}" "${openblas_pkg}" + # using codeload.github + url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}" + download_pkg_from_url "${openblas_sha256}" "${openblas_pkg}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" @@ -80,7 +83,7 @@ case "${with_openblas}" in make -j $(get_nprocs) \ MAKE_NB_JOBS=0 \ TARGET=${TARGET} \ - NUM_THREADS=128 \ + NUM_THREADS=64 \ USE_THREAD=1 \ USE_OPENMP=1 \ NO_AFFINITY=1 \ @@ -92,7 +95,7 @@ case "${with_openblas}" in make -j $(get_nprocs) \ MAKE_NB_JOBS=0 \ TARGET=NEHALEM \ - NUM_THREADS=128 \ + NUM_THREADS=64 \ USE_THREAD=1 \ USE_OPENMP=1 \ NO_AFFINITY=1 \ @@ -104,7 +107,7 @@ case "${with_openblas}" in make -j $(get_nprocs) \ MAKE_NB_JOBS=0 \ TARGET=${TARGET} \ - NUM_THREADS=128 \ + NUM_THREADS=64 \ USE_THREAD=1 \ USE_OPENMP=1 \ NO_AFFINITY=1 \ diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index 780e5c6776..56bd30c966 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -3,7 +3,8 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2025-0308 +# Last Update in 2025-0504 +# other contributor: Benrui Tang [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" @@ -11,10 +12,10 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" # From https://elpa.mpcdf.mpg.de/software/tarball-archive/ELPA_TARBALL_ARCHIVE.html # elpa_ver="2024.05.001" # elpa_sha256="9caf41a3e600e2f6f4ce1931bd54185179dade9c171556d0c9b41bbc6940f2f6" +# newer version of elpa may have problem in GPU-ELPA compliation elpa_ver="2025.01.001" elpa_sha256="3ef0c6aed9a3e05db6efafe6e14d66eb88b2a1354d61e765b7cde0d3d5f3951e" - source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -34,9 +35,6 @@ cd "${BUILDDIR}" # elpa only works with MPI switched on if [ $MPI_MODE = no ]; then report_warning $LINENO "MPI is disabled, skipping elpa installation" - cat << EOF > "${BUILDDIR}/setup_elpa" -with_elpa="__FALSE__" -EOF exit 0 fi @@ -101,26 +99,30 @@ case "$with_elpa" in config_flags="--enable-avx-kernels=${has_AVX} --enable-avx2-kernels=${has_AVX2} --enable-avx512-kernels=${has_AVX512}" fi fi - # CUDA_CFLAGS="-std=c++14 -allow-unsupported-compiler" \ for TARGET in "cpu" "nvidia"; do [ "$TARGET" = "nvidia" ] && [ "$ENABLE_CUDA" != "__TRUE__" ] && continue - # disable cpu if cuda is enabled + # disable cpu if cuda is enabled, only install one [ "$TARGET" != "nvidia" ] && [ "$ENABLE_CUDA" = "__TRUE__" ] && continue - echo "Installing from scratch into ${pkg_install_dir}/${TARGET}" + # extend the pkg_install_dir by TARGET + # this linking method is totally different from cp2k toolchain + # for cp2k, ref https://github.com/cp2k/cp2k/commit/6fe2fc105b8cded84256248f68c74139dd8fc2e9 + pkg_install_dir="${pkg_install_dir}/${TARGET}" + + echo "Installing from scratch into ${pkg_install_dir}" mkdir -p "build_${TARGET}" cd "build_${TARGET}" if [ "${with_amd}" != "__DONTUSE__" ] && [ "${WITH_FLANG}" = "yes" ] ; then echo "AMD fortran compiler detected, enable special option operation" - ../configure --prefix="${pkg_install_dir}/${TARGET}/" \ - --libdir="${pkg_install_dir}/${TARGET}/lib" \ + ../configure --prefix="${pkg_install_dir}" \ + --libdir="${pkg_install_dir}/lib" \ --enable-openmp=${enable_openmp} \ - --enable-static=yes \ + --enable-static=no \ --enable-shared=yes \ --disable-c-tests \ --disable-cpp-tests \ ${config_flags} \ - --enable-nvidia-gpu-kernels=$([ "$TARGET" = "nvidia" ] && echo "yes" || echo "no") \ --with-cuda-path=${CUDA_PATH:-${CUDA_HOME:-/CUDA_HOME-notset}} \ + --enable-nvidia-gpu-kernels=$([ "$TARGET" = "nvidia" ] && echo "yes" || echo "no") \ --with-NVIDIA-GPU-compute-capability=$([ "$TARGET" = "nvidia" ] && echo "sm_$ARCH_NUM" || echo "sm_70") \ OMPI_MCA_plm_rsh_agent=/bin/false \ FC=${MPIFC} \ @@ -139,10 +141,11 @@ case "$with_elpa" in -e 's/\\$wl--whole-archive\\$convenience \\$wl--no-whole-archive//g' \ -e 's/\\$wl\\$soname //g' else - ../configure --prefix="${pkg_install_dir}/${TARGET}/" \ - --libdir="${pkg_install_dir}/${TARGET}/lib" \ + # normal installation + ../configure --prefix="${pkg_install_dir}/" \ + --libdir="${pkg_install_dir}/lib" \ --enable-openmp=${enable_openmp} \ - --enable-static=yes \ + --enable-static=no \ --enable-shared=yes \ --disable-c-tests \ --disable-cpp-tests \ @@ -165,9 +168,9 @@ case "$with_elpa" in make install > install.log 2>&1 || tail -n ${LOG_LINES} install.log cd .. # link elpa - link=${pkg_install_dir}/${TARGET}/include/elpa + link=${pkg_install_dir}/include/elpa if [[ ! -d $link ]]; then - ln -s ${pkg_install_dir}/${TARGET}/include/elpa_openmp-${elpa_ver}/elpa $link + ln -s ${pkg_install_dir}/include/elpa_openmp-${elpa_ver}/elpa $link fi done cd .. @@ -176,8 +179,8 @@ case "$with_elpa" in fi fi [ "$enable_openmp" != "yes" ] && elpa_dir_openmp="" - ELPA_CFLAGS="-I'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/include/elpa${elpa_dir_openmp}-${elpa_ver}/modules' -I'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/include/elpa${elpa_dir_openmp}-${elpa_ver}/elpa'" - ELPA_LDFLAGS="-L'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/lib' -Wl,-rpath,'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/lib'" + ELPA_CFLAGS="-I'${pkg_install_dir}/include/elpa${elpa_dir_openmp}-${elpa_ver}/modules' -I'${pkg_install_dir}/include/elpa${elpa_dir_openmp}-${elpa_ver}/elpa'" + ELPA_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath,'${pkg_install_dir}/lib'" ;; __SYSTEM__) echo "==================== Finding ELPA from system paths ====================" @@ -201,7 +204,7 @@ case "$with_elpa" in pkg_install_dir="$with_elpa" check_dir "${pkg_install_dir}/include" check_dir "${pkg_install_dir}/lib" - user_include_path="$pkg_install_dir/include" + user_include_path="${pkg_install_dir}/include" elpa_include="$(find_in_paths "elpa_openmp-*" user_include_path)" if [ "$elpa_include" != "__FALSE__" ]; then echo "ELPA include directory threaded version is found to be $elpa_include/modules" diff --git a/toolchain/scripts/stage3/install_fftw.sh b/toolchain/scripts/stage3/install_fftw.sh index a04d47d322..fac3c2040d 100755 --- a/toolchain/scripts/stage3/install_fftw.sh +++ b/toolchain/scripts/stage3/install_fftw.sh @@ -40,7 +40,9 @@ case "$with_fftw" in if [ -f ${fftw_pkg} ]; then echo "${fftw_pkg} is found" else - download_pkg_from_ABACUS_org "${fftw_sha256}" "${fftw_pkg}" + #download_pkg_from_ABACUS_org "${fftw_sha256}" "${fftw_pkg}" + url="http://www.fftw.org/${fftw_pkg}" + download_pkg_from_url "${fftw_sha256}" "${fftw_pkg}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" @@ -49,7 +51,7 @@ case "$with_fftw" in [ -d fftw-${fftw_ver} ] && rm -rf fftw-${fftw_ver} tar -xzf ${fftw_pkg} cd fftw-${fftw_ver} - FFTW_FLAGS="--enable-openmp --enable-shared --enable-static" + FFTW_FLAGS="--enable-openmp --enable-shared" # fftw has mpi support but not compiled by default. so compile it if we build with mpi. # it will create a second library to link with if needed [ "${MPI_MODE}" != "no" ] && FFTW_FLAGS="--enable-mpi ${FFTW_FLAGS}" diff --git a/toolchain/scripts/stage3/install_scalapack.sh b/toolchain/scripts/stage3/install_scalapack.sh index eb45dbd8e1..c2d6690bd1 100755 --- a/toolchain/scripts/stage3/install_scalapack.sh +++ b/toolchain/scripts/stage3/install_scalapack.sh @@ -3,14 +3,14 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2023-0901 +# Last Update in 2024-0504 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -scalapack_ver="2.2.1" -scalapack_sha256="4aede775fdb28fa44b331875730bcd5bab130caaec225fadeccf424c8fcb55aa" -scalapack_pkg="scalapack-${scalapack_ver}.tgz" +scalapack_ver="2.2.2" +scalapack_sha256="a2f0c9180a210bf7ffe126c9cb81099cf337da1a7120ddb4cbe4894eb7b7d022" +scalapack_pkg="scalapack-${scalapack_ver}.tar.gz" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh @@ -39,7 +39,9 @@ case "$with_scalapack" in if [ -f ${scalapack_pkg} ]; then echo "${scalapack_pkg} is found" else - download_pkg_from_ABACUS_org "${scalapack_sha256}" "${scalapack_pkg}" + url="https://codeload.github.com/Reference-ScaLAPACK/scalapack/tar.gz/v${scalapack_ver}" + download_pkg_from_url "${scalapack_sha256}" "${scalapack_pkg}" "${url}" + #download_pkg_from_ABACUS_org "${scalapack_sha256}" "${scalapack_pkg}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" @@ -51,18 +53,21 @@ case "$with_scalapack" in mkdir -p "scalapack-${scalapack_ver}/build" pushd "scalapack-${scalapack_ver}/build" > /dev/null - flags="" + cflags="" + fflags="" if ("${FC}" --version | grep -q 'GNU'); then - flags=$(allowed_gfortran_flags "-fallow-argument-mismatch") + cflags="-fpermissive" + fflags=$(allowed_gfortran_flags "-fallow-argument-mismatch") fi - # modified by @YuugataShinonome for GCC 14 - FFLAGS=$flags cmake -DCMAKE_FIND_ROOT_PATH="$ROOTDIR" \ + CFLAGS=${cflags} FFLAGS=${fflags} \ + cmake -DCMAKE_FIND_ROOT_PATH="$ROOTDIR" \ -DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \ -DCMAKE_INSTALL_LIBDIR="lib" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBUILD_SHARED_LIBS=YES \ -DCMAKE_BUILD_TYPE=Release .. \ - -DCMAKE_C_FLAGS:STRING="$CFLAGS -Wno-implicit-function-declaration" \ + -DBUILD_TESTING=NO \ -DSCALAPACK_BUILD_TESTS=NO \ > configure.log 2>&1 || tail -n ${LOG_LINES} configure.log make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log @@ -95,13 +100,13 @@ if [ "$with_scalapack" != "__DONTUSE__" ]; then prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" -prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig" -prepend_path CMAKE_PREFIX_PATH "$pkg_install_dir" -export LD_LIBRARY_PATH="$pkg_install_dir/lib":\${LD_LIBRARY_PATH} -export LD_RUN_PATH="$pkg_install_dir/lib":\${LD_RUN_PATH} -export LIBRARY_PATH="$pkg_install_dir/lib":\${LIBRARY_PATH} -export PKG_CONFIG_PATH="$pkg_install_dir/lib/pkgconfig":\${PKG_CONFIG_PATH} -export CMAKE_PREFIX_PATH="$pkg_install_dir":\${CMAKE_PREFIX_PATH} +prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" +export LD_LIBRARY_PATH="${pkg_install_dir}/lib":\${LD_LIBRARY_PATH} +export LD_RUN_PATH="${pkg_install_dir}/lib":\${LD_RUN_PATH} +export LIBRARY_PATH="${pkg_install_dir}/lib":\${LIBRARY_PATH} +export PKG_CONFIG_PATH="${pkg_install_dir}/lib/pkgconfig":\${PKG_CONFIG_PATH} +export CMAKE_PREFIX_PATH="${pkg_install_dir}":\${CMAKE_PREFIX_PATH} export SCALAPACK_ROOT="${pkg_install_dir}" EOF cat "${BUILDDIR}/setup_scalapack" >> $SETUPFILE diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index 81ab61eccf..a6c597d69f 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -5,13 +5,13 @@ # CEREAL is not need any complex setting # Only problem is the installation from github.com -# Last Update in 2023-0918 +# Last Update in 2025-0504 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -cereal_ver="1.3.2" -cereal_sha256="16a7ad9b31ba5880dac55d62b5d6f243c3ebc8d46a3514149e56b5e7ea81f85f" +cereal_ver="master" # latest version, instead of "1.3.2" +cereal_sha256="--no-checksum" # latest version cannot maintain checksum source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -31,7 +31,7 @@ case "$with_cereal" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/cereal/${cereal_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://github.com/USCiLab/cereal/archive/refs/tags/v${cereal_ver}.tar.gz" + url="https://codeload.github.com/USCiLab/cereal/tar.gz/${cereal_ver}" filename="cereal-${cereal_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." @@ -40,7 +40,7 @@ case "$with_cereal" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of CEREAL is downloaded in GitHub Release, which will always be out-of-date version <===" + echo "===> Notice: This version of CEREAL is downloaded in GitHub master repository <===" download_pkg_from_url "${cereal_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then @@ -49,6 +49,7 @@ case "$with_cereal" in echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname tar -xzf $filename + #unzip -q $filename mkdir -p "${pkg_install_dir}" cp -r $dirname/* "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index 1f3aa5d814..ccb39061ea 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -6,13 +6,14 @@ # Only problem is the installation from github.com # LibComm is under highly-active development, the git submodule installation is more recommended -# Last Update in 2024-0815 +# Last Update in 2025-0504 +# other contributor: Peize Lin [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -libcomm_ver="0.1.1" -libcomm_sha256="9c47b6ea9573bffa4232c0bef63714d4c3af820c6b7539cfa6e294ca2b8ba4af" +libcomm_ver="master" +libcomm_sha256="--no-checksum" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -32,8 +33,9 @@ case "$with_libcomm" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libcomm/${libcomm_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://github.com/abacusmodeling/LibComm/archive/refs/tags/v${libcomm_ver}.tar.gz" + # url="https://github.com/abacusmodeling/LibComm/archive/refs/tags/v${libcomm_ver}.tar.gz" filename="LibComm-${libcomm_ver}.tar.gz" + url="https://codeload.github.com/abacusmodeling/LibComm/tar.gz/${libcomm_ver}" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -41,7 +43,7 @@ case "$with_libcomm" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of LibComm is downloaded in GitHub Release, which will always be out-of-date version <===" + echo "===> Notice: This version of LibComm is downloaded in GitHub master repository <===" download_pkg_from_url "${libcomm_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then @@ -50,6 +52,7 @@ case "$with_libcomm" in echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname tar -xzf $filename + # unzip -q $filename cp -r $dirname "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index f787a8bbc0..ebca6214e7 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -6,7 +6,7 @@ # Only problem is the installation from github.com # Libnpy is under active development, you can check the latest version in github yourself -# Last Update in 2023-1124 +# Last Update in 2025-0504 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" @@ -32,7 +32,7 @@ case "$with_libnpy" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libnpy/${libnpy_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://github.com/llohse/libnpy/archive/refs/tags/v${libnpy_ver}.tar.gz" + url="https://codeload.github.com/llohse/libnpy/tar.gz/v${libnpy_ver}" filename="libnpy-${libnpy_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." @@ -41,7 +41,7 @@ case "$with_libnpy" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of Libnpy is downloaded in GitHub Release, which will always be out-of-date version <===" + echo "===> Notice: This version of Libnpy is downloaded in GitHub Release <===" download_pkg_from_url "${libnpy_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index 2e3e657431..4de041f660 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -6,12 +6,15 @@ # Only problem is the installation from github.com # LibRI is under highly-active development, the git submodule installation is more recommended -# Last Update in 2024-0815 +# Last Update in 2025-0504 +# other contributor: Peize Lin [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -# libri 0.2.0 need to be used in newer ABACUS -libri_ver="0.2.1.0" +# libri 0.2.0 and above need to be used in newer ABACUS +# libri_ver="master" +# libri_sha256="--no-checksum" +libri_ver=0.2.1.0 libri_sha256="66a5540daba36effdad6ce2fe5e8368b96ddd4a7e148af90894ef21dc20ff29f" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh @@ -32,7 +35,7 @@ case "$with_libri" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libri/${libri_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://github.com/abacusmodeling/LibRI/archive/refs/tags/v${libri_ver}.tar.gz" + url="https://codeload.github.com/abacusmodeling/LibRI/tar.gz/v${libri_ver}" filename="LibRI-${libri_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." @@ -41,7 +44,7 @@ case "$with_libri" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of LibRI is downloaded in GitHub Release, which will always be out-of-date version <===" + echo "===> Notice: This version of LibRI is downloaded in GitHub Release <===" download_pkg_from_url "${libri_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then @@ -49,6 +52,7 @@ case "$with_libri" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname + #unzip -q $filename tar -xzf $filename cp -r $dirname "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index 3c420ca1de..27fb94edd3 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -5,13 +5,14 @@ # RAPIDJSON is not need any complex setting # Only problem is the installation from github.com -# Last Update in 2024-0119 +# Last Update in 2025-0504 +# other contributor: Kai Luo, XingLiang Peng [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -rapidjson_ver="1.1.0" -rapidjson_sha256="bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e" +rapidjson_ver="master" # latest version, instead of "1.1.0" fixing issue of #5518 +rapidjson_sha256="--no-checksum" # latest version cannot maintain checksum source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -31,7 +32,9 @@ case "$with_rapidjson" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/rapidjson/${rapidjson_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://github.com/Tencent/rapidjson/archive/refs/tags/v${rapidjson_ver}.tar.gz" + #url="https://github.com/Tencent/rapidjson/archive/refs/tags/v${rapidjson_ver}.tar.gz" # commented by Kai Luo in 2025/04/28 + url="https://codeload.github.com/Tencent/rapidjson/tar.gz/${rapidjson_ver}" + # changed by Kai Luo in 2025/04/28, modified by Zhaoqing Liu in 2025/05/01 filename="rapidjson-${rapidjson_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." @@ -40,19 +43,26 @@ case "$with_rapidjson" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of rapidjson is downloaded in GitHub Release, which will always be out-of-date version <===" + echo "===> Notice: This version of rapidjson is downloaded in GitHub master repository <===" download_pkg_from_url "${rapidjson_sha256}" "${filename}" "${url}" + # wget "${url}" -O "${filename}" --no-check-certificate # use wget directly instead of download_pkg_from_url fi if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname + #unzip -q $filename # use -q to suppress output tar -xzf $filename mkdir -p "${pkg_install_dir}" cp -r $dirname/* "${pkg_install_dir}/" # for CMake to find rapidjson - cp ${pkg_install_dir}/RapidJSONConfig.cmake.in ${pkg_install_dir}/RapidJSONConfig.cmake + #cp ${pkg_install_dir}/RapidJSONConfig.cmake.in ${pkg_install_dir}/RapidJSONConfig.cmake + cat << EOF > "${pkg_install_dir}/RapidJSONConfig.cmake" +get_filename_component(RAPIDJSON_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(RAPIDJSON_INCLUDE_DIRS "@INCLUDE_INSTALL_DIR@") +message(STATUS "RapidJSON found. Headers: ${RAPIDJSON_INCLUDE_DIRS}") +EOF write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi fi diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index 909fe836a2..c7fa483ffa 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -57,9 +57,8 @@ And re-run toolchain installation script. You can manually install requirements packages via: 1. Download from www.cp2k.org/static/downloads (for OpenBLAS, OpenMPI and Others) 2. Download from github.com (for CEREAL, RapidJSON, libnpy, LibRI and others stage4 packages) -3. Use git submodule update --init --recursive (for LibRI) -4. wget https://bohrium-api.dp.tech/ds-dl/abacus-deps-93wi-v2 -O abacus-deps.zip -5. for Intel-oneAPI, please contact your server manager our visit Intel official website +3. wget https://bohrium-api.dp.tech/ds-dl/abacus-deps-93wi-v2 -O abacus-deps.zip (a mirror in Bohrium) +4. for Intel-oneAPI and AMD AOCC/AOCL, please contact your server manager our visit Intel official website EOF } @@ -665,14 +664,14 @@ download_pkg_from_ABACUS_org() { download_pkg_from_url() { # usage: download_pkg_from_url sha256 filename url - local __sha256="$1" + local __sha256="$1" # if set to "--no-checksum", do not check checksum local __filename="$2" local __url="$3" # download #echo "wget ${DOWNLOADER_FLAGS} --quiet $__url -O $__filename" #if ! wget ${DOWNLOADER_FLAGS} --quiet $__url -O $__filename; then - echo "wget ${DOWNLOADER_FLAGS} $__url -O $__filename" - if ! wget ${DOWNLOADER_FLAGS} $__url -O $__filename; then + echo "wget ${DOWNLOADER_FLAGS} $__url -O $__filename --no-check-certificate" + if ! wget ${DOWNLOADER_FLAGS} $__url -O $__filename --no-check-certificate; then report_error "failed to download $__url" recommend_offline_installation $__filename $__url if [ "${PACK_RUN}" != "__TRUE__" ]; then @@ -680,7 +679,9 @@ download_pkg_from_url() { fi fi # checksum - checksum "$__filename" "$__sha256" + if [ "$__sha256" != "--no-checksum" ]; then + checksum "$__filename" "$__sha256" + fi } # verify the checksums inside the given checksum file diff --git a/toolchain/toolchain_amd.sh b/toolchain/toolchain_aocc-aocl.sh similarity index 77% rename from toolchain/toolchain_amd.sh rename to toolchain/toolchain_aocc-aocl.sh index 797f7c67ea..ca3e2e4759 100755 --- a/toolchain/toolchain_amd.sh +++ b/toolchain/toolchain_aocc-aocl.sh @@ -5,13 +5,13 @@ #SBATCH -o compile.log #SBATCH -e compile.err -# JamesMisaka in 2023-09-16 -# install abacus dependency by gnu-toolchain -# one can use mpich or openmpi. -# openmpi will be faster, but not compatible in some cases. +# JamesMisaka in 2025-05-05 +# install abacus dependency by aocc-aocl toolchain +# openmpi is recommended to use # libtorch and libnpy are for deepks support, which can be =no # if you want to run EXX calculation, you should set --with-libri=install -# mpich (and intel toolchain) is recommended for EXX support +# gpu-lcao supporting modify: CUDA_PATH and --enable-cuda +# export CUDA_PATH=/usr/local/cuda ./install_abacus_toolchain.sh \ --with-amd=system \ diff --git a/toolchain/toolchain_gcc-aocl.sh b/toolchain/toolchain_gcc-aocl.sh new file mode 100755 index 0000000000..f7b717b257 --- /dev/null +++ b/toolchain/toolchain_gcc-aocl.sh @@ -0,0 +1,36 @@ +#!/bin/bash +#SBATCH -J install +#SBATCH -N 1 +#SBATCH -n 16 +#SBATCH -o compile.log +#SBATCH -e compile.err + +# JamesMisaka in 2025-05-05 +# install abacus dependency by gcc-aocl toolchain +# openmpi is recommended to use +# libtorch and libnpy are for deepks support, which can be =no +# if you want to run EXX calculation, you should set --with-libri=install + +# gpu-lcao supporting modify: CUDA_PATH and --enable-cuda +# export CUDA_PATH=/usr/local/cuda + +./install_abacus_toolchain.sh \ +--with-gcc=system \ +--math-mode=aocl \ +--with-amd=no \ +--with-intel=no \ +--with-openmpi=install \ +--with-cmake=install \ +--with-scalapack=system \ +--with-libxc=install \ +--with-fftw=system \ +--with-elpa=install \ +--with-cereal=install \ +--with-rapidjson=install \ +--with-libtorch=no \ +--with-libnpy=no \ +--with-libri=no \ +--with-libcomm=no \ +--with-4th-openmpi=no \ +| tee compile.log +# to use openmpi-version4: set --with-4th-openmpi=yes \ No newline at end of file diff --git a/toolchain/toolchain_gnu.sh b/toolchain/toolchain_gnu.sh index bea1ee0793..03e1c55440 100755 --- a/toolchain/toolchain_gnu.sh +++ b/toolchain/toolchain_gnu.sh @@ -5,13 +5,12 @@ #SBATCH -o compile.log #SBATCH -e compile.err -# JamesMisaka in 2023-09-16 +# JamesMisaka in 2025-05-05 # install abacus dependency by gnu-toolchain -# one can use mpich or openmpi. -# openmpi will be faster, but not compatible in some cases. +# one can use mpich or openmpi. openmpi will be faster and less compatiable # libtorch and libnpy are for deepks support, which can be =no # if you want to run EXX calculation, you should set --with-libri=install -# mpich (and intel toolchain) is recommended for EXX support + # gpu-lcao supporting modify: CUDA_PATH and --enable-cuda # export CUDA_PATH=/usr/local/cuda diff --git a/toolchain/toolchain_intel-mpich.sh b/toolchain/toolchain_intel-mpich.sh deleted file mode 100755 index afa9871762..0000000000 --- a/toolchain/toolchain_intel-mpich.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -#SBATCH -J install -#SBATCH -N 1 -#SBATCH -n 16 -#SBATCH -o compile.log -#SBATCH -e compile.err - -# JamesMisaka in 2023-09-16 -# install abacus dependency by intel-toolchain -# use mkl ,and mpich instead of intelmpi -# libtorch and libnpy are for deepks support, which can be =no - -# module load mkl compiler - -./install_abacus_toolchain.sh \ ---with-intel=system \ ---math-mode=mkl \ ---with-gcc=no \ ---with-mpich=install \ ---with-cmake=install \ ---with-scalapack=no \ ---with-libxc=install \ ---with-fftw=no \ ---with-elpa=install \ ---with-cereal=install \ ---with-rapidjson=install \ ---with-libtorch=no \ ---with-libnpy=no \ ---with-libri=no \ ---with-libcomm=no \ ---with-intel-classic=no \ -| tee compile.log -# for using AMD-CPU or GPU-version: set --with-intel-classic=yes \ No newline at end of file diff --git a/toolchain/toolchain_intel.sh b/toolchain/toolchain_intel.sh index 4af7236896..54a73ae28c 100755 --- a/toolchain/toolchain_intel.sh +++ b/toolchain/toolchain_intel.sh @@ -5,14 +5,16 @@ #SBATCH -o compile.log #SBATCH -e compile.err -# JamesMisaka in 2023-08-31 +# JamesMisaka in 2025-05-05 # install abacus dependency by intel-toolchain # use mkl and intelmpi # but mpich and openmpi can also be tried # libtorch and libnpy are for deepks support, which can be =no +# gpu-lcao supporting modify: CUDA_PATH and --enable-cuda +# export CUDA_PATH=/usr/local/cuda # module load mkl mpi compiler -export CUDA_PATH=/usr/local/cuda + ./install_abacus_toolchain.sh \ --with-intel=system \ --math-mode=mkl \