-
Notifications
You must be signed in to change notification settings - Fork 211
CMake for reg2grb2 #268
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
CMake for reg2grb2 #268
Changes from all commits
77d4c78
e27a0db
78405e8
e8ed72e
c8a78d6
fcbb368
468fbae
99b8f67
1c3e53f
8447e96
5946fd5
afd4ade
96493a7
328583e
b4e6a5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,35 +5,19 @@ set -eux | |
| readonly UTILS_DIR=$(cd "$(dirname "$($cmd -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P) | ||
|
|
||
| # Adapt for global-workflow structure. | ||
| target=${target:-"NULL"} | ||
| source ${UTILS_DIR}/machine-setup.sh > /dev/null 2>&1 | ||
| modulefile=${UTILS_DIR}/../modulefiles/workflow_utils.$target | ||
| if [[ -f $modulefile ]]; then | ||
| set +x | ||
| source ${UTILS_DIR}/machine-setup.sh > /dev/null 2>&1 | ||
| source $modulefile | ||
| module list | ||
| set -x | ||
| else | ||
| echo "FATAL: modulefile $modulefile not found!" | ||
| exit 1 | ||
|
Comment on lines
+15
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assumes that on every machine there has to be a modulefile.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The need for this came to me based on the above comment. In the context of global-workflow, I don't know that manually loading a module beforehand is a use case to support, and I'd prefer the error to specify the actual problem rather than cmake just failing. |
||
| fi | ||
| # End adaptation | ||
|
|
||
| # Begin hack | ||
| # In place until nceplibs-ncio is in hpc-stack and available as a module | ||
| # After nceplibs-ncio is in hpc-stack, add the following line to | ||
| # ${UTILS_DIR}/../modulefiles/workflow_utils.<platform> | ||
| # "module load ncio/<ncio-version>" | ||
| # and remove this hack | ||
|
|
||
| [[ -d nceplibs-ncio ]] && rm -rf nceplibs-ncio | ||
| git clone -b develop https://github.com/noaa-emc/nceplibs-ncio | ||
| cd nceplibs-ncio | ||
| mkdir -p build && cd build | ||
| cmake -DCMAKE_INSTALL_PREFIX=../install .. | ||
| make -j ${BUILD_JOBS:-4} VERBOSE=${BUILD_VERBOSE:-} | ||
| make install | ||
| cd ../.. | ||
| export ncio_ROOT=$PWD/nceplibs-ncio/install | ||
| # End hack | ||
|
|
||
| BUILD_DIR=${BUILD_DIR:-${UTILS_DIR}/build} | ||
| [[ -d $BUILD_DIR ]] && rm -rf $BUILD_DIR | ||
| mkdir -p ${BUILD_DIR} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| list(APPEND fortran_src | ||
| reg2grb2.f | ||
| regdiag.f | ||
| ) | ||
|
|
||
| if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") | ||
| set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -free -convert big_endian -fp-model precise -assume byterecl") | ||
| elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") | ||
| set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fconvert=big-endian") | ||
| endif() | ||
|
|
||
| set(exe_name reg2grb2.x) | ||
| add_executable(${exe_name} ${fortran_src}) | ||
| target_link_libraries( | ||
| ${exe_name} | ||
| landsfcutil::landsfcutil_d | ||
| ip::ip_d | ||
| sp::sp_d | ||
| bacio::bacio_4 | ||
| w3nco::w3nco_4 | ||
|
Comment on lines
+16
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. has anyone verified that all of these are actually used in this program?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went through the makefile and compared which ones were being linked. I didn't go through the code line by line.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a question for @BrianCurtis-NOAA, but landsfcutil is a new dependency for this PR, so I assume yes for that at least.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aerorahul the old build_reg2grb2.sh has landsfcutil in a LIBS export which was then used in the makefile that was used to build reg2grb2. I don't see any subroutines that seem to be using any landsfcutil subroutines, but if needed I will spend more time on going line by line to see if i missed something. Let me know. |
||
| wgrib2::wgrib2_api | ||
| NetCDF::NetCDF_Fortran) | ||
|
|
||
| if(OpenMP_Fortran_FOUND) | ||
| target_link_libraries(${exe_name} OpenMP::OpenMP_Fortran) | ||
| endif() | ||
|
|
||
| install(TARGETS ${exe_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this required?
which mahcine is requiring this to be sourced that supports the global workflow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tried running build_workflow_utils stand-alone, $target isn't defined until it is set by machine-setup, so it was using NULL, then quietly not loading a modulefile because there wasn't one for NULL, then cmake would fail.