diff --git a/CMakeLists.txt b/CMakeLists.txt index 23092f8a96..dab5ef6482 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,42 @@ add_definitions(-DUSE_COND) add_definitions(-DNEW_TAUCTMAX) add_definitions(-DINTERNAL_FILE_NML) +if(CCPP) + + find_package(Python 3 QUIET COMPONENTS Interpreter) + if (NOT Python_Interpreter_FOUND) + find_package(Python 2.7 QUIET REQUIRED COMPONENTS Interpreter) + endif() + message("Found Python: ${Python_EXECUTABLE}") + + if(NOT DEFINED CCPP_SUITES) + set(CCPP_SUITES "FV3_GFS_2017_gfdlmp") + endif() + message("Configuring CCPP for SUITES = ${CCPP_SUITES}") + + execute_process(COMMAND FV3/ccpp/framework/scripts/ccpp_prebuild.py + "--config=FV3/ccpp/config/ccpp_prebuild_config.py" + "--suites=${CCPP_SUITES}" + "--builddir=${PROJECT_BINARY_DIR}/FV3" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_FILE ${PROJECT_BINARY_DIR}/ccpp_prebuild.out + ERROR_FILE ${PROJECT_BINARY_DIR}/ccpp_prebuild.err + ) + + # this should not be necessary; including CCPP_*.cmake here and passing + # SCHEMES, CAPS and TYPEDEFS via environment variables to CCPP build. + # CCPP should be able to directly include those three .cmake files. + + include(${PROJECT_BINARY_DIR}/FV3/ccpp/physics/CCPP_SCHEMES.cmake) + include(${PROJECT_BINARY_DIR}/FV3/ccpp/physics/CCPP_CAPS.cmake) + include(${PROJECT_BINARY_DIR}/FV3/ccpp/physics/CCPP_TYPEDEFS.cmake) + + set(ENV{CCPP_SCHEMES} "${SCHEMES}") + set(ENV{CCPP_CAPS} "${CAPS}") + set(ENV{CCPP_TYPEDEFS} "${TYPEDEFS}") + +endif() + ############################################################################### ### FMS ############################################################################### diff --git a/build.sh b/build.sh index ad6d89a9e9..85e9547815 100755 --- a/build.sh +++ b/build.sh @@ -23,16 +23,6 @@ rm -rf ${BUILD_DIR} mkdir ${BUILD_DIR} CCPP_SUITES="${CCPP_SUITES:-FV3_GFS_2017_gfdlmp}" - -./FV3/ccpp/framework/scripts/ccpp_prebuild.py \ - --config=FV3/ccpp/config/ccpp_prebuild_config.py \ - --suites=${CCPP_SUITES} \ - --builddir=${BUILD_DIR}/FV3 > ${BUILD_DIR}/ccpp_prebuild.log 2>&1 - -source ${BUILD_DIR}/FV3/ccpp/physics/CCPP_SCHEMES.sh -source ${BUILD_DIR}/FV3/ccpp/physics/CCPP_CAPS.sh -source ${BUILD_DIR}/FV3/ccpp/physics/CCPP_STATIC_API.sh - CMAKE_FLAGS+=" -DCCPP=ON -DSUITES=${CCPP_SUITES} -DNETCDF_DIR=${NETCDF}" cd ${BUILD_DIR} diff --git a/modulefiles/wcoss_dell_p3/fv3 b/modulefiles/wcoss_dell_p3/fv3 index 6ae8adc4e3..74a57b00a6 100644 --- a/modulefiles/wcoss_dell_p3/fv3 +++ b/modulefiles/wcoss_dell_p3/fv3 @@ -18,8 +18,9 @@ module-whatis "loads NEMS FV3 prerequisites on Venus and Mars" module load ips/18.0.1.163 module load impi/18.0.1 module load lsf/10.1 -module load cmake/3.10.0 -module load lsf/10.1 +module load cmake/3.16.2 +# module load python/3.6.3 +module load python/2.7.14 module use -a /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles @@ -44,13 +45,12 @@ module load post/8.0.6 module use /gpfs/dell2/emc/modeling/noscrub/emc.nemspara/soft/modulefiles module load hdf5_parallel/1.10.6 -module load netcdf_parallel/4.7.4 +module load netcdf_parallel/4.7.4 module load esmf/8.0.0_ParallelNetCDF ## ## load cmake ## -module load cmake/3.10.0 setenv CMAKE_C_COMPILER mpiicc setenv CMAKE_CXX_COMPILER mpiicpc setenv CMAKE_Fortran_COMPILER mpiifort diff --git a/tests/compile_cmake.sh b/tests/compile_cmake.sh index a9be59f378..751646c4c6 100755 --- a/tests/compile_cmake.sh +++ b/tests/compile_cmake.sh @@ -114,38 +114,30 @@ if [[ "${MAKE_OPT}" == *"CCPP=Y"* ]]; then CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DMULTI_GASES=OFF" fi - ( - # Check if suites argument is provided or not - set +ex - TEST=$( echo $MAKE_OPT | grep -e "SUITES=" ) - if [[ $? -eq 1 ]]; then - echo "No suites argument provided, compiling all available suites ..." - # Loop through all available suite definition files and extract suite names - SDFS=(../FV3/ccpp/suites/*.xml) - SUITES="" - for sdf in ${SDFS[@]}; do - suite=${sdf#"../FV3/ccpp/suites/suite_"} - suite=${suite%".xml"} - SUITES="${SUITES},${suite}" - done - # Remove leading comma - SUITES=${SUITES#","} - else - SUITES=$( echo $MAKE_OPT | sed 's/.* SUITES=//' | sed 's/ .*//' ) - fi - echo "Compiling suites ${SUITES}" - set -ex - cd ${PATHTR} - ./FV3/ccpp/framework/scripts/ccpp_prebuild.py --config=FV3/ccpp/config/ccpp_prebuild_config.py --suites=${SUITES} --builddir=tests/${BUILD_DIR}/FV3 - ) - - # Read list of schemes, caps, and static API - source ${BUILD_DIR}/FV3/ccpp/physics/CCPP_TYPEDEFS.sh - source ${BUILD_DIR}/FV3/ccpp/physics/CCPP_SCHEMES.sh - source ${BUILD_DIR}/FV3/ccpp/physics/CCPP_CAPS.sh - source ${BUILD_DIR}/FV3/ccpp/physics/CCPP_STATIC_API.sh - - fi + # Check if suites argument is provided or not + set +ex + TEST=$( echo $MAKE_OPT | grep -e "SUITES=" ) + if [[ $? -eq 1 ]]; then + echo "No suites argument provided, compiling all available suites ..." + # Loop through all available suite definition files and extract suite names + SDFS=(../FV3/ccpp/suites/*.xml) + SUITES="" + for sdf in ${SDFS[@]}; do + suite=${sdf#"../FV3/ccpp/suites/suite_"} + suite=${suite%".xml"} + SUITES="${SUITES},${suite}" + done + # Remove leading comma + SUITES=${SUITES#","} + else + SUITES=$( echo $MAKE_OPT | sed 's/.* SUITES=//' | sed 's/ .*//' ) + fi + echo "Compiling suites ${SUITES}" + set -ex + + CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DCCPP_SUITES=${SUITES}" + +fi if [[ "${MAKE_OPT}" == *"WW3=Y"* ]]; then CCPP_CMAKE_FLAGS="${CCPP_CMAKE_FLAGS} -DWW3=Y"