Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ccpp_prebuild from build scripts to CMakeLists.txt #113

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
###############################################################################
Expand Down
10 changes: 0 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 4 additions & 4 deletions modulefiles/wcoss_dell_p3/fv3
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
56 changes: 24 additions & 32 deletions tests/compile_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down