From c9c3a94c815f0abbf3849ec3e9a8d68de9a2caf2 Mon Sep 17 00:00:00 2001 From: Debolskiy Andrey <and.debol@gmail.com> Date: Sun, 12 Nov 2023 15:12:28 +0300 Subject: [PATCH] fixed compiler flags --- cluster_configs/ifa-cluster.cmake | 2 +- cluster_configs/inm-cluster-avx.cmake | 20 +++--- cluster_configs/inm-cluster-avx2.cmake | 92 +++++++++++++------------- cluster_configs/local_osx.cmake | 51 +++++++------- 4 files changed, 84 insertions(+), 81 deletions(-) diff --git a/cluster_configs/ifa-cluster.cmake b/cluster_configs/ifa-cluster.cmake index 5b6525f..a2e3ed7 100644 --- a/cluster_configs/ifa-cluster.cmake +++ b/cluster_configs/ifa-cluster.cmake @@ -53,4 +53,4 @@ if ( COMPILER STREQUAL "gnu") endif () message("prerun exprots:" ${prerun_env_export}) message("run executable is:" ${run_exec}) -message("compiler choice: ${compiler_lc}") \ No newline at end of file +message("compiler choice:" ${COMPILER}) \ No newline at end of file diff --git a/cluster_configs/inm-cluster-avx.cmake b/cluster_configs/inm-cluster-avx.cmake index 12cccff..45dc08f 100644 --- a/cluster_configs/inm-cluster-avx.cmake +++ b/cluster_configs/inm-cluster-avx.cmake @@ -4,7 +4,7 @@ #NETCDF support if (USE_NETCDF) set(CUSTOM_NETCDF true) - if ( compiler_lc STREQUAL "intel" OR compiler_lc STREQUAL "intel_oneapi") + if ( COMPILER STREQUAL "intel" OR COMPILER STREQUAL "intel_oneapi") set(NETCDF_PATH "/opt/ohpc/pub/libs/intel/impi/netcdf/4.9.0/") set(NETCDF_INC "${NETCDF_PATH}include") set(NETCDF_LIB "${NETCDF_PATH}lib") @@ -16,7 +16,7 @@ if (USE_NETCDF) endif() -if ( compiler_lc STREQUAL "intel") +if ( COMPILER STREQUAL "intel") if (NO_MPI) set(CMAKE_C_COMPILER icc CACHE STRING "C compiler" FORCE) # C compiler for serial build set(CMAKE_CXX_COMPILER c++ CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build @@ -26,10 +26,10 @@ if ( compiler_lc STREQUAL "intel") set(CMAKE_CXX_COMPILER mpiicpc CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build set(CMAKE_Fortran_COMPILER mpiifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build endif() - set(comp_flags " -O3 -restrict -alias-const -parallel -funroll-loops -no-ansi-alias -mavx -xavx ") + set(comp_flags -O3 -restrict -alias-const -parallel -funroll-loops -no-ansi-alias -mavx -xavx CACHE STRING "comp_flags to add" FORCE) endif() -if ( compiler_lc STREQUAL "intel_oneapi") +if ( COMPILER STREQUAL "intel_oneapi") if (NO_MPI) set(CMAKE_C_COMPILER icx CACHE STRING "C compiler" FORCE) # C compiler for serial build set(CMAKE_CXX_COMPILER icpx CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build @@ -39,10 +39,10 @@ if ( compiler_lc STREQUAL "intel_oneapi") set(CMAKE_CXX_COMPILER mpiicpc -cc=icpx CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build set(CMAKE_Fortran_COMPILER mpiifort -fc=ifx CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build endif() - set(comp_flags " -O3 -no-ansi-alias -funroll-loops -mavx -xavx -Wno-tautological-constant-compare ") + set(comp_flags -O3 -no-ansi-alias -funroll-loops -mavx -xavx -Wno-tautological-constant-compare CACHE STRING "comp_flags to add" FORCE) endif() -if ( compiler_lc STREQUAL "gnu") +if ( COMPILER STREQUAL "gnu") if (NO_MPI) set(CMAKE_C_COMPILER gcc CACHE STRING "C compiler" FORCE) # C compiler for serial build set(CMAKE_CXX_COMPILER g++ CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build @@ -52,13 +52,13 @@ if ( compiler_lc STREQUAL "gnu") set(CMAKE_CXX_COMPILER mpicxx CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build set(CMAKE_Fortran_COMPILER mpifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build endif() - set(comp_flags " -O3 -fno-strict-aliasing -funroll-loops -mavx -std=c++0x ") + set(comp_flags -O3 -fno-strict-aliasing -funroll-loops -mavx -std=c++0x CACHE STRING "comp_flags to add" FORCE) endif() #specify stuff for run-script -set(cluster_queue "normal") +set(cluster_queue "normal" CACHE STRING "queue" FORCE) if (NO_MPI) - set(run_exec "mpirun") + set(run_exec "mpirun" CACHE STRING "exec run" FORCE) else () - set(run_exec "srun") + set(run_exec "srun" CACHE STRING "exec run" FORCE) endif () \ No newline at end of file diff --git a/cluster_configs/inm-cluster-avx2.cmake b/cluster_configs/inm-cluster-avx2.cmake index e101573..d843bdb 100644 --- a/cluster_configs/inm-cluster-avx2.cmake +++ b/cluster_configs/inm-cluster-avx2.cmake @@ -3,62 +3,62 @@ #NETCDF support if (USE_NETCDF) -set(CUSTOM_NETCDF true) -if ( compiler_lc STREQUAL "intel" OR compiler_lc STREQUAL "intel_oneapi") - set(NETCDF_PATH "/opt/ohpc/pub/libs/intel/impi/netcdf/4.9.0/") - set(NETCDF_INC "${NETCDF_PATH}include") - set(NETCDF_LIB "${NETCDF_PATH}lib") - set(HDF5_LIB "/opt/ohpc/pub/libs/intel/impi/hdf5/1.10.8/lib") - set(NetCDF_LINK_FLAGS "-L${NETCDF_LIB} -lnetcdf -L${HDF5_LIB} -lhdf5") -else () - messege(ERROR "NetCDF is not supported with GNU on INM cluster") -endif() + set(CUSTOM_NETCDF true) + if ( COMPILER STREQUAL "intel" OR COMPILER STREQUAL "intel_oneapi") + set(NETCDF_PATH "/opt/ohpc/pub/libs/intel/impi/netcdf/4.9.0/") + set(NETCDF_INC "${NETCDF_PATH}include") + set(NETCDF_LIB "${NETCDF_PATH}lib") + set(HDF5_LIB "/opt/ohpc/pub/libs/intel/impi/hdf5/1.10.8/lib") + set(NetCDF_LINK_FLAGS "-L${NETCDF_LIB} -lnetcdf -L${HDF5_LIB} -lhdf5") + else () + messege(ERROR "NetCDF is not supported with GNU on INM cluster") + endif() endif() -if ( compiler_lc STREQUAL "intel") -if (NO_MPI) - set(CMAKE_C_COMPILER icc CACHE STRING "C compiler" FORCE) # C compiler for serial build - set(CMAKE_CXX_COMPILER c++ CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build - set(CMAKE_Fortran_COMPILER ifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for serial build -else() - set(CMAKE_C_COMPILER mpiicpc CACHE STRING "C compiler" FORCE) # C compiler for parallel build - set(CMAKE_CXX_COMPILER mpiicpc CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build - set(CMAKE_Fortran_COMPILER mpiifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build -endif() - set(comp_flags " -O3 -restrict -alias-const -parallel -funroll-loops -no-ansi-alias -march=core-avx2 -xcore-avx2 ") +if ( COMPILER STREQUAL "intel") + if (NO_MPI) + set(CMAKE_C_COMPILER icc CACHE STRING "C compiler" FORCE) # C compiler for serial build + set(CMAKE_CXX_COMPILER c++ CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build + set(CMAKE_Fortran_COMPILER ifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for serial build + else() + set(CMAKE_C_COMPILER mpiicpc CACHE STRING "C compiler" FORCE) # C compiler for parallel build + set(CMAKE_CXX_COMPILER mpiicpc CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build + set(CMAKE_Fortran_COMPILER mpiifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build + endif() + set(comp_flags -O3 -restrict -alias-const -parallel -funroll-loops -no-ansi-alias -march=core-avx2 -xcore-avx2 CACHE STRING "comp_flags to add" FORCE) endif() -if ( compiler_lc STREQUAL "intel_oneapi") -if (NO_MPI) - set(CMAKE_C_COMPILER icx CACHE STRING "C compiler" FORCE) # C compiler for serial build - set(CMAKE_CXX_COMPILER icpx CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build - set(CMAKE_Fortran_COMPILER ifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for serial build -else() - set(CMAKE_C_COMPILER mpiicc -cc=icx CACHE STRING "C compiler" FORCE) # C compiler for parallel build - set(CMAKE_CXX_COMPILER mpiicpc -cc=icpx CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build - set(CMAKE_Fortran_COMPILER mpiifort -fc=ifx CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build -endif() - set(comp_flags " -O3 -no-ansi-alias -funroll-loops -xcore-avx2 -Wno-tautological-constant-compare ") +if ( COMPILER STREQUAL "intel_oneapi") + if (NO_MPI) + set(CMAKE_C_COMPILER icx CACHE STRING "C compiler" FORCE) # C compiler for serial build + set(CMAKE_CXX_COMPILER icpx CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build + set(CMAKE_Fortran_COMPILER ifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for serial build + else() + set(CMAKE_C_COMPILER mpiicc -cc=icx CACHE STRING "C compiler" FORCE) # C compiler for parallel build + set(CMAKE_CXX_COMPILER mpiicpc -cc=icpx CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build + set(CMAKE_Fortran_COMPILER mpiifort -fc=ifx CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build + endif() + set(comp_flags -O3 -no-ansi-alias -funroll-loops -xcore-avx2 -Wno-tautological-constant-compare CACHE STRING "comp_flags to add" FORCE) endif() -if ( compiler_lc STREQUAL "gnu") -if (NO_MPI) - set(CMAKE_C_COMPILER gcc CACHE STRING "C compiler" FORCE) # C compiler for serial build - set(CMAKE_CXX_COMPILER g++ CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build - set(CMAKE_Fortran_COMPILER gfortran CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for serial build -else() - set(CMAKE_C_COMPILER mpicc CACHE STRING "C compiler" FORCE) # C compiler for parallel build - set(CMAKE_CXX_COMPILER mpicxx CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build - set(CMAKE_Fortran_COMPILER mpifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build -endif() -set(comp_flags " -O3 -fno-strict-aliasing -funroll-loops -mavx2 -std=c++0x ") +if ( COMPILER STREQUAL "gnu") + if (NO_MPI) + set(CMAKE_C_COMPILER gcc CACHE STRING "C compiler" FORCE) # C compiler for serial build + set(CMAKE_CXX_COMPILER g++ CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build + set(CMAKE_Fortran_COMPILER gfortran CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for serial build + else() + set(CMAKE_C_COMPILER mpicc CACHE STRING "C compiler" FORCE) # C compiler for parallel build + set(CMAKE_CXX_COMPILER mpicxx CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build + set(CMAKE_Fortran_COMPILER mpifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build + endif() + set(comp_flags -O3 -fno-strict-aliasing -funroll-loops -mavx -std=c++0x CACHE STRING "comp_flags to add" FORCE) endif() #specify stuff for run-script -set(cluster_queue "normal") +set(cluster_queue "normal" CACHE STRING "queue" FORCE) if (NO_MPI) - set(run_exec "mpirun") + set(run_exec "mpirun" CACHE STRING "exec run" FORCE) else () - set(run_exec "srun") + set(run_exec "srun" CACHE STRING "exec run" FORCE) endif () \ No newline at end of file diff --git a/cluster_configs/local_osx.cmake b/cluster_configs/local_osx.cmake index 803997c..2942561 100644 --- a/cluster_configs/local_osx.cmake +++ b/cluster_configs/local_osx.cmake @@ -1,11 +1,14 @@ -#config for macosx with manually specified compiler for development +#get from loaded modules versions of compilers + +#NETCDF support if (USE_NETCDF) -set(CUSTOM_NETCDF false) + set(CUSTOM_NETCDF false FORCE) + find_package(Net_CDFCxx) endif() -# adding compiler options for Intel -if ( compiler_lc STREQUAL "intel") + +if ( COMPILER STREQUAL "intel") if (NO_MPI) set(CMAKE_C_COMPILER icc CACHE STRING "C compiler" FORCE) # C compiler for serial build set(CMAKE_CXX_COMPILER c++ CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build @@ -15,23 +18,14 @@ if ( compiler_lc STREQUAL "intel") set(CMAKE_CXX_COMPILER mpiicpc CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build set(CMAKE_Fortran_COMPILER mpiifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build endif() - set(comp_flags " -O3 -restrict -alias-const -parallel -funroll-loops -no-ansi-alias -march=core-avx2 -xcore-avx2 ") + set(comp_flags -O3-restrict -alias-const -parallel -funroll-loops -no-ansi-alias -mavx -fma CACHE STRING FORCE) endif() -if ( compiler_lc STREQUAL "intel_oneapi") - if (NO_MPI) - set(CMAKE_C_COMPILER icx CACHE STRING "C compiler" FORCE) # C compiler for serial build - set(CMAKE_CXX_COMPILER icpx CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build - set(CMAKE_Fortran_COMPILER ifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for serial build - else() - set(CMAKE_C_COMPILER mpiicc -cc=icx CACHE STRING "C compiler" FORCE) # C compiler for parallel build - set(CMAKE_CXX_COMPILER mpiicpc -cc=icpx CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build - set(CMAKE_Fortran_COMPILER mpiifort -fc=ifx CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build - endif() - set(comp_flags " -O3 -no-ansi-alias -funroll-loops -Wno-tautological-constant-compare ") +if ( COMPILER STREQUAL "intel_oneapi") + messege(ERROR "ONEAPI is not supported on IFA cluster") endif() -if ( compiler_lc STREQUAL "gnu") +if ( COMPILER STREQUAL "gnu") if (NO_MPI) set(CMAKE_C_COMPILER gcc CACHE STRING "C compiler" FORCE) # C compiler for serial build set(CMAKE_CXX_COMPILER g++ CACHE STRING "CXX compiler" FORCE) # C++ compiler for serial build @@ -41,13 +35,22 @@ if ( compiler_lc STREQUAL "gnu") set(CMAKE_CXX_COMPILER mpicxx CACHE STRING "CXX compiler" FORCE) # C++ compiler for parallel build set(CMAKE_Fortran_COMPILER mpifort CACHE STRING "Fortran compiler" FORCE) # Fortran compiler for parallel build endif() - set(comp_flags " -O3 -fno-strict-aliasing -funroll-loops -mavx2 -no-pie") + set(comp_flags -O3 -fno-strict-aliasing -funroll-loops -march=native -std=c++0x CACHE STRING "comp_flags to add" FORCE) endif() #specify stuff for run-script -set(cluster_queue "normal") -if (NO_MPI) - set(run_exec "mpirun") -else () - set(run_exec "srun") -endif () \ No newline at end of file +set(cluster_queue "none" CACHE STRING "queue" FORCE) + +if ( COMPILER STREQUAL "intel" OR COMPILER STREQUAL "intel_oneapi") + set(run_exec "mpiexec" CACHE STRING "exec run" FORCE) + set(prerun_env_export " " CACHE STRING "prerun exports" FORCE) +endif() + + +if ( COMPILER STREQUAL "gnu") + set(run_exec "mpirun" CACHE STRING "exec run" FORCE) + set(prerun_env_export " " CACHE STRING "prerun exports" FORCE) +endif () +message("prerun exprots:" ${prerun_env_export}) +message("run executable is:" ${run_exec}) +message("compiler choice:" ${COMPILER}) -- GitLab