From 1925bd1f25f9d105b781bebd94816c0b624c2ffa Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Thu, 12 Sep 2019 16:20:43 -0400 Subject: [PATCH 01/85] Initial spack/cmake version --- CMakeLists.txt | 62 + cmake/Modules/FindBACIO.cmake | 40 + cmake/Modules/FindBACIO.cmake.orig | 63 + cmake/Modules/FindBUFR.cmake | 44 + cmake/Modules/FindBaselibs.cmake | 70 + cmake/Modules/FindCRTM.cmake | 41 + cmake/Modules/FindG2.cmake | 45 + cmake/Modules/FindG2C.cmake | 33 + cmake/Modules/FindG2TMPL.cmake | 41 + cmake/Modules/FindGEMPAK.cmake | 7 + cmake/Modules/FindGFSIO.cmake | 41 + cmake/Modules/FindGSICONTROL.cmake | 54 + cmake/Modules/FindHDF5.cmake | 25 + cmake/Modules/FindIP.cmake | 46 + cmake/Modules/FindMPI.cmake | 18 + cmake/Modules/FindNDATE.cmake | 13 + cmake/Modules/FindNEMSIO.cmake | 41 + cmake/Modules/FindNetCDF.cmake | 145 ++ cmake/Modules/FindSFCIO.cmake | 42 + cmake/Modules/FindSIGIO.cmake | 42 + cmake/Modules/FindSP.cmake | 43 + cmake/Modules/FindW3EMC.cmake | 49 + cmake/Modules/FindW3NCO.cmake | 44 + cmake/Modules/FindWRF.cmake | 36 + .../NewCMake/CMakeParseArguments.cmake | 11 + cmake/Modules/NewCMake/FindHDF5.cmake | 934 ++++++++++ cmake/Modules/NewCMake/FindMPI.cmake | 1514 +++++++++++++++++ .../NewCMake/FindMPI/fortranparam_mpi.f90.in | 4 + cmake/Modules/NewCMake/FindMPI/libver_mpi.c | 19 + .../NewCMake/FindMPI/libver_mpi.f90.in | 7 + cmake/Modules/NewCMake/FindMPI/mpiver.f90.in | 10 + cmake/Modules/NewCMake/FindMPI/test_mpi.c | 37 + .../Modules/NewCMake/FindMPI/test_mpi.f90.in | 6 + .../FindPackageHandleStandardArgs.cmake | 386 +++++ .../Modules/NewCMake/FindPackageMessage.cmake | 47 + .../SelectLibraryConfigurations.cmake | 70 + .../Testing/Temporary/CTestCostData.txt | 1 + cmake/Modules/Testing/Temporary/LastTest.log | 3 + cmake/Modules/comp_src.pl | 15 + cmake/Modules/findHelpers.cmake | 65 + cmake/Modules/findHelpers.cmake.orig | 69 + cmake/Modules/platforms/Cheyenne.cmake | 24 + cmake/Modules/platforms/Discover.cmake | 21 + cmake/Modules/platforms/Gaea.cmake | 14 + cmake/Modules/platforms/Generic.cmake | 16 + cmake/Modules/platforms/Generic.cmake.orig | 25 + cmake/Modules/platforms/Jet.cmake | 10 + cmake/Modules/platforms/S4.cmake | 10 + cmake/Modules/platforms/Theia.cmake | 55 + cmake/Modules/platforms/WCOSS-C.cmake | 60 + cmake/Modules/platforms/WCOSS-D.cmake | 21 + cmake/Modules/platforms/WCOSS.cmake | 61 + cmake/Modules/setCompilerFlags.cmake.orig | 167 ++ cmake/Modules/setGNUFlags.cmake | 62 + cmake/Modules/setHOST.cmake | 96 ++ cmake/Modules/setIntelFlags.cmake | 87 + cmake/Modules/setPGIFlags.cmake | 78 + cmake/Modules/setPlatformVariables.cmake | 10 + sorc/ncep_post.fd/CMakeLists.txt | 31 + sorc/ncep_post.fd/io_int_stubs.f | 147 ++ 60 files changed, 5278 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/Modules/FindBACIO.cmake create mode 100644 cmake/Modules/FindBACIO.cmake.orig create mode 100644 cmake/Modules/FindBUFR.cmake create mode 100644 cmake/Modules/FindBaselibs.cmake create mode 100644 cmake/Modules/FindCRTM.cmake create mode 100644 cmake/Modules/FindG2.cmake create mode 100644 cmake/Modules/FindG2C.cmake create mode 100644 cmake/Modules/FindG2TMPL.cmake create mode 100644 cmake/Modules/FindGEMPAK.cmake create mode 100644 cmake/Modules/FindGFSIO.cmake create mode 100644 cmake/Modules/FindGSICONTROL.cmake create mode 100644 cmake/Modules/FindHDF5.cmake create mode 100644 cmake/Modules/FindIP.cmake create mode 100644 cmake/Modules/FindMPI.cmake create mode 100644 cmake/Modules/FindNDATE.cmake create mode 100644 cmake/Modules/FindNEMSIO.cmake create mode 100644 cmake/Modules/FindNetCDF.cmake create mode 100644 cmake/Modules/FindSFCIO.cmake create mode 100644 cmake/Modules/FindSIGIO.cmake create mode 100644 cmake/Modules/FindSP.cmake create mode 100644 cmake/Modules/FindW3EMC.cmake create mode 100644 cmake/Modules/FindW3NCO.cmake create mode 100644 cmake/Modules/FindWRF.cmake create mode 100644 cmake/Modules/NewCMake/CMakeParseArguments.cmake create mode 100644 cmake/Modules/NewCMake/FindHDF5.cmake create mode 100644 cmake/Modules/NewCMake/FindMPI.cmake create mode 100644 cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in create mode 100644 cmake/Modules/NewCMake/FindMPI/libver_mpi.c create mode 100644 cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in create mode 100644 cmake/Modules/NewCMake/FindMPI/mpiver.f90.in create mode 100644 cmake/Modules/NewCMake/FindMPI/test_mpi.c create mode 100644 cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in create mode 100644 cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake create mode 100644 cmake/Modules/NewCMake/FindPackageMessage.cmake create mode 100644 cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake create mode 100644 cmake/Modules/Testing/Temporary/CTestCostData.txt create mode 100644 cmake/Modules/Testing/Temporary/LastTest.log create mode 100755 cmake/Modules/comp_src.pl create mode 100644 cmake/Modules/findHelpers.cmake create mode 100644 cmake/Modules/findHelpers.cmake.orig create mode 100644 cmake/Modules/platforms/Cheyenne.cmake create mode 100644 cmake/Modules/platforms/Discover.cmake create mode 100644 cmake/Modules/platforms/Gaea.cmake create mode 100644 cmake/Modules/platforms/Generic.cmake create mode 100644 cmake/Modules/platforms/Generic.cmake.orig create mode 100644 cmake/Modules/platforms/Jet.cmake create mode 100644 cmake/Modules/platforms/S4.cmake create mode 100644 cmake/Modules/platforms/Theia.cmake create mode 100644 cmake/Modules/platforms/WCOSS-C.cmake create mode 100644 cmake/Modules/platforms/WCOSS-D.cmake create mode 100644 cmake/Modules/platforms/WCOSS.cmake create mode 100644 cmake/Modules/setCompilerFlags.cmake.orig create mode 100644 cmake/Modules/setGNUFlags.cmake create mode 100644 cmake/Modules/setHOST.cmake create mode 100644 cmake/Modules/setIntelFlags.cmake create mode 100644 cmake/Modules/setPGIFlags.cmake create mode 100644 cmake/Modules/setPlatformVariables.cmake create mode 100644 sorc/ncep_post.fd/CMakeLists.txt create mode 100755 sorc/ncep_post.fd/io_int_stubs.f diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..a32bbd683 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 2.6) +project(ncep_post) +set(VERSION v1.1.1) +enable_language (Fortran) +if (NOT CMAKE_BUILD_TYPE) + set (CMAKE_BUILD_TYPE RELEASE CACHE STRING + "Choose the type of build, options are: PRODUCTION Debug Release." + FORCE) +endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + message("setting intel true") + set(IntelComp true ) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*") + set(GNUComp true ) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*") + set(PGIComp true ) +endif() +MESSAGE(${CMAKE_CURRENT_SOURCE_DIR}) +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE) +if(NOT BUILD_RELEASE ) + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) +endif() +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEGUG" BUILD_DEBUG) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) +SET(ARCHIVE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include") +set(Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include") +set(CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include") +file(MAKE_DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() +if(POLICY CMP0012) + cmake_policy(SET CMP0012 NEW) +endif() +find_package( MPI ) +find_package( OpenMP ) +find_package( Jasper ) +find_package( LAPACK ) +find_package( SIGIO ) +find_package( PNG ) +find_package( ZLIB ) +find_package( W3NCO ) +find_package( G2 ) +find_package( G2TMPL ) +find_package( BACIO ) +find_package( IP ) +find_package( SP ) +find_package( SFCIO ) +find_package( NEMSIO ) +find_package( GFSIO ) +find_package( W3EMC ) +find_package( CRTM ) +find_package( NetCDF ) + +add_subdirectory(sorc/ncep_post.fd) diff --git a/cmake/Modules/FindBACIO.cmake b/cmake/Modules/FindBACIO.cmake new file mode 100644 index 000000000..20bcdfad2 --- /dev/null +++ b/cmake/Modules/FindBACIO.cmake @@ -0,0 +1,40 @@ +# This module looks for environment variables detailing where BACIO lib is +# If variables are not set, BACIO will be built from external source +include(ExternalProject) +if(DEFINED ENV{BACIO_LIB4} ) + set(BACIO_LIBRARY $ENV{BACIO_LIB4} CACHE STRING "BACIO Library Location" ) + set(BACIO_VER $ENV{BACIO_VER} CACHE STRING "BACIO Version") + set(BACIO_8_LIBRARY $ENV{BACIO_LIBd} CACHE STRING "BACIO_8 Library Location") + set(BACIO_d_LIBRARY $ENV{BACIO_LIBd} CACHE STRING "BACIO_8 Library Location") +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-bacio + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-bacio + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-bacio + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-bacio OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("bacio version is ${LIBVERSION}") + set( BACIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libbacio_${LIBVERSION}_4.a ) + set( BACIO_8_LIBRARY ${PROJECT_BINARY_DIR}/lib/libbacio_${LIBVERSION}_4.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${BACIO_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-bacio ) + else() + set( CORE_BUILT ${BACIO_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-bacio ) + endif() + + set( BACIO_LIBRARY_PATH ${BACIO_LIBRARY} CACHE STRING "BACIO Library Location" ) +endif() diff --git a/cmake/Modules/FindBACIO.cmake.orig b/cmake/Modules/FindBACIO.cmake.orig new file mode 100644 index 000000000..c09df72a1 --- /dev/null +++ b/cmake/Modules/FindBACIO.cmake.orig @@ -0,0 +1,63 @@ +# This module looks for environment variables detailing where BACIO lib is +# If variables are not set, BACIO will be built from external source +include(ExternalProject) +if((NOT BUILD_BACIO ) AND (DEFINED ENV{BACIO_LIB4})) + set(BACIO_LIBRARY $ENV{BACIO_LIB4} ) +<<<<<<< HEAD + else() + find_library( BACIO_LIBRARY + NAMES libbacio.a libbacio_4.a libbacio_v${BACIO_VER}_4.a + HINTS $ENV{COREPATH}/lib /usr/local/jcsda/nwprod_gdas_2014/lib + ${COREPATH}/bacio/v${BACIO_VER} + ${COREPATH}/bacio/v${BACIO_VER}/intel + ${COREPATH}/bacio/v${BACIO_VER}/ips/${COMPILER_VERSION} + PATH_SUFFIXES + lib + ${NO_DEFAULT_PATH} + ) + message("Found BACIO library ${BACIO_LIBRARY}") + endif() + set( bacio ${BACIO_LIBRARY}) +endif() +if( NOT BACIO_LIBRARY ) # didn't find the library, so build it from source + message("Could not find BACIO library, so building from libsrc") + if( DEFINED ENV{BACIO_SRC} ) + set( BACIO_DIR $ENV{BACIO_SRC} CACHE STRING "BACIO Source Directory" ) +======= + if( CORE_LIBRARIES ) + list( APPEND CORE_LIBRARIES ${BACIO_LIBRARY} ) +>>>>>>> debug-fix + else() + set( CORE_LIBRARIES ${BACIO_LIBRARY} ) + endif() +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-bacio + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-bacio + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-bacio + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-bacio OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("bacio version is ${LIBVERSION}") + set( BACIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libbacio_${LIBVERSION}_4.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${BACIO_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-bacio ) + else() + set( CORE_BUILT ${BACIO_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-bacio ) + endif() +endif( ) + +set( BACIO_LIBRARY_PATH ${BACIO_LIBRARY} CACHE STRING "BACIO Library Location" ) + diff --git a/cmake/Modules/FindBUFR.cmake b/cmake/Modules/FindBUFR.cmake new file mode 100644 index 000000000..7f92204f9 --- /dev/null +++ b/cmake/Modules/FindBUFR.cmake @@ -0,0 +1,44 @@ +# This module looks for environment variables detailing where BUFR lib is +# If variables are not set, BUFR will be built from external source +include(ExternalProject) +if(DEFINED ENV{BUFR_LIB4} ) + set(BUFR_LIBRARY $ENV{BUFR_LIBd} CACHE STRING "BUFR Library Location" ) + set(BUFR_VER $ENV{BUFR_VER} CACHE STRING "BUFR Version") + set(BUFR_8_LIBRARY $ENV{BUFR_LIB8} CACHE STRING "BUFR_8 Library Location") + set(BUFR_4_LIBRARY $ENV{BUFR_LIB4} CACHE STRING "BUFR_4 Library Location") + set(BUFR_4DA_LIBRARY $ENV{BUFR_LIB4_DA} CACHE STRING "BUFR_DA_4 Library Location") +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-bufr + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-bufr + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + -DGSIBUILD=ON + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-bufr + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-bufr OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("bufr version is ${LIBVERSION}") + set( BUFR_LIBRARY ${PROJECT_BINARY_DIR}/lib/libbufr_${LIBVERSION}_d.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${BUFR_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-bufr ) + else() + set( CORE_BUILT ${BUFR_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-bufr ) + endif() +endif() + +set( BUFR_LIBRARY_PATH ${BUFR_LIBRARY} CACHE STRING "BUFR Library Location" ) +set( BUFR_4_LIBRARY_PATH ${BUFR_4_LIBRARY} CACHE STRING "BUFR Library Location" ) +set( BUFR_8_LIBRARY_PATH ${BUFR_8_LIBRARY} CACHE STRING "BUFR Library Location" ) + diff --git a/cmake/Modules/FindBaselibs.cmake b/cmake/Modules/FindBaselibs.cmake new file mode 100644 index 000000000..86a377641 --- /dev/null +++ b/cmake/Modules/FindBaselibs.cmake @@ -0,0 +1,70 @@ +if (NOT DEFINED ENV{BASEDIR}) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" ) + string(REGEX MATCH "mpt" MPT ${MPI_Fortran_INCLUDE_PATH}) + string(REGEX MATCH "impi" IMPI ${MPI_Fortran_INCLUDE_PATH}) + message("REGEX returns ${MPT} ") + if( MPT MATCHES "mpt" ) + message("setting mpt paths ") + set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_2/x86_64-unknown-linux-gnu/ifort_15.0.2.164-mpt_2.14/Linux") + elseif( IMPI MATCHES "impi" ) + set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_2/x86_64-unknown-linux-gnu/ifort_16.0.3.210-intelmpi_5.1.3.210/Linux") + else() + message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") + endif() + message("compiler version is ${COMPILER_VERSION}") + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU*" ) + string(REGEX MATCH "openmpi" OPENMPI ${MPI_Fortran_INCLUDE_PATH}) + message("REGEX returns ${OPENMPI} ") + if( OPENMPI MATCHES "openmpi" ) + message("setting openmpi paths ") + set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-4_0_8/x86_64-unknown-linux-gnu/gfortran_7.2.0-openmpi_3.0.0/Linux") + else() + message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") + endif() + message("compiler version is ${COMPILER_VERSION}") + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "pgc*" ) + string(REGEX MATCH "openmpi" OPENMPI ${MPI_Fortran_INCLUDE_PATH}) + if( OPENMPI MATCHES "openmpi" ) + set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_1/x86_64-unknown-linux-gnu/pgfortran_16.5-openmpi_1.10.3/Linux") + else() + message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") + endif() + message("compiler version is ${COMPILER_VERSION}") + endif() +else() + set(BASEDIR $ENV{BASEDIR}) +endif () +if (ESMA_SDF) + message (FATAL_ERROR "ERROR: -hdf option was thought to be obsolete when CMake was crafted.") +endif () + +link_directories (${BASEDIR}/lib) + +#------------------------------------------------------------------ +# netcdf +# The following command provides the list of libraries that netcdf +# uses. Unfortunately it also includes the library path and "-l" +# prefixes, which CMake handles in a different manner. So we need so +# strip off that item from the list +execute_process ( + COMMAND ${BASEDIR}/bin/nf-config --flibs + OUTPUT_VARIABLE LIB_NETCDF + ) + +string(REGEX MATCHALL " -l[^ ]*" _full_libs "${LIB_NETCDF}") +set (NETCDF_LIBRARIES CACHE INTERNAL "netcdf libs" ) +set (NETCDF_INCLUDES CACHE INTERNAL "netcdf includes" ) +foreach (lib ${_full_libs}) + string (REPLACE "-l" "" _tmp ${lib}) + string (STRIP ${_tmp} _tmp) + list (APPEND NETCDF_LIBRARIES ${_tmp}) +endforeach() +#------------------------------------------------------------------ + +list(APPEND NETCDF_INCLUDES ${BASEDIR}/include/netcdf) +list(APPEND NETCDF_INCLUDES ${BASEDIR}/include/hdf5) + +message(STATUS "NETCDF_INCLUDES: ${NETCDF_INCLUDES}") +message(STATUS "NETCDF_LIBRARIES: ${NETCDF_LIBRARIES}") diff --git a/cmake/Modules/FindCRTM.cmake b/cmake/Modules/FindCRTM.cmake new file mode 100644 index 000000000..c9e685134 --- /dev/null +++ b/cmake/Modules/FindCRTM.cmake @@ -0,0 +1,41 @@ +# This module looks for environment variables detailing where CRTM lib is +# If variables are not set, CRTM will be built from external source +include(ExternalProject) +if(DEFINED ENV{CRTM_LIB} ) + message("HEY!! setting CRTM library via environment variable") + set(CRTM_LIBRARY $ENV{CRTM_LIB} CACHE STRING "CRTM Library Location" ) + set(CRTM_INC $ENV{CRTM_INC} CACHE STRING "CRTM Include Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-crtm + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-crtm + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-crtm + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-crtm OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("crtm version is ${LIBVERSION}") + set( CRTM_LIBRARY ${PROJECT_BINARY_DIR}/lib/libcrtm_${LIBVERSION}_d.a ) + set( CRTM_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libcrtm_${LIBVERSION}_4.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${CRTM_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-crtm ) + else() + set( CORE_BUILT ${CRTM_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-crtm ) + endif() + +endif() + +set( CRTM_LIBRARY_PATH ${CRTM_LIBRARY} CACHE STRING "CRTM Library Location" ) +set( CRTM_INCLUDE_PATH ${CRTM_INC} CACHE STRING "CRTM Include Location" ) diff --git a/cmake/Modules/FindG2.cmake b/cmake/Modules/FindG2.cmake new file mode 100644 index 000000000..c7087fe87 --- /dev/null +++ b/cmake/Modules/FindG2.cmake @@ -0,0 +1,45 @@ +# This module looks for environment variables detailing where G2 lib is +# If variables are not set, G2 will be built from external source +include(ExternalProject) +if(DEFINED ENV{G2_DIR} ) + message("HEY!! setting G2 library via environment variable") + set(G2_LIBRARY $ENV{G2_LIBd} CACHE STRING "G2 Library Location" ) + set(G2_4_LIBRARY $ENV{G2_LIB4} CACHE STRING "G2_4 Library Location" ) + set(G2_INC4 $ENV{G2_INC4} CACHE STRING "G2_4 Include Location" ) + set(G2_INCd $ENV{G2_INCd} CACHE STRING "G2_d Include Location" ) + set(G2_LIBRARY_PATH ${G2_LIBRARY} CACHE STRING "G2 Library Location" ) + set(G2_4_LIBRARY_PATH ${G2_4_LIBRARY} CACHE STRING "G2_4 Library Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-g2 + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-g2 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2 + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2 OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("g2 version is ${LIBVERSION}") + set( G2_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2_${LIBVERSION}_d.a ) + set( G2_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2_${LIBVERSION}_4.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${G2_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-g2 ) + else() + set( CORE_BUILT ${G2_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-g2 ) + endif() + + set( G2_LIBRARY_PATH ${G2_LIBRARY} CACHE STRING "G2 Library Location" ) + set( G2_4_LIBRARY_PATH ${G2_4_LIBRARY} CACHE STRING "G2_4 Library Location" ) + +endif() diff --git a/cmake/Modules/FindG2C.cmake b/cmake/Modules/FindG2C.cmake new file mode 100644 index 000000000..70a91e678 --- /dev/null +++ b/cmake/Modules/FindG2C.cmake @@ -0,0 +1,33 @@ +# This module looks for environment variables detailing where G2 lib is +# If variables are not set, G2 will be built from external source +include(ExternalProject) +set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) +ExternalProject_Add(NCEPLIBS-g2c + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-g2c + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2c + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install +) +execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2c OUTPUT_VARIABLE LIBVERSION) +string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) +string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) +string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) +message("g2c version is ${LIBVERSION}") +set( G2_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2c_${LIBVERSION}.a ) +if( CORE_BUILT ) + list( APPEND CORE_BUILT ${G2_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-g2c ) +else() + set( CORE_BUILT ${G2_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-g2c ) +endif() + +set( G2_LIBRARY_PATH ${G2_LIBRARY} CACHE STRING "G2 Library Location" ) + diff --git a/cmake/Modules/FindG2TMPL.cmake b/cmake/Modules/FindG2TMPL.cmake new file mode 100644 index 000000000..b994d764e --- /dev/null +++ b/cmake/Modules/FindG2TMPL.cmake @@ -0,0 +1,41 @@ +# This module looks for environment variables detailing where G2TMPL lib is +# If variables are not set, G2TMPL will be built from external source +include(ExternalProject) +if(DEFINED ENV{G2TMPL_DIR} ) + message("HEY!! setting G2TMPL library via environment variable") + set(G2TMPL_LIBRARY $ENV{G2TMPL_LIBd} CACHE STRING "G2TMPL Library Location" ) + set(G2TMPL_INC $ENV{G2TMPL_INCd} CACHE STRING "G2TMPL_d Include Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-g2tmpl + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-g2tmpl + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2tmpl + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2tmpl OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("g2tmpl version is ${LIBVERSION}") + set( G2TMPL_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2tmpl_${LIBVERSION}_d.a ) + set( G2TMPL_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2tmpl_${LIBVERSION}_4.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${G2TMPL_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-g2tmpl ) + else() + set( CORE_BUILT ${G2TMPL_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-g2tmpl ) + endif() + + set( G2TMPL_LIBRARY_PATH ${G2TMPL_LIBRARY} CACHE STRING "G2TMPL Library Location" ) + set( G2TMPL_INCLUDE_PATH ${G2TMPL_INC} CACHE STRING "G2TMPL Include Location" ) + +endif() diff --git a/cmake/Modules/FindGEMPAK.cmake b/cmake/Modules/FindGEMPAK.cmake new file mode 100644 index 000000000..fc7f8c127 --- /dev/null +++ b/cmake/Modules/FindGEMPAK.cmake @@ -0,0 +1,7 @@ +# - Find GEMPAK +if(DEFINED ENV{GEMPAK}) + set(GEMINC $ENV{GEMPAK}/include CACHE STRING "GEMPAK Include Path" ) + set(OS_INC $ENV{OS_INC} CACHE STRING "GEMPAK OS Include Path" ) +else () + message(FATAL_ERROR "Could not find GEMPAK module") +endif() diff --git a/cmake/Modules/FindGFSIO.cmake b/cmake/Modules/FindGFSIO.cmake new file mode 100644 index 000000000..47960715d --- /dev/null +++ b/cmake/Modules/FindGFSIO.cmake @@ -0,0 +1,41 @@ +# This module looks for environment variables detailing where GFSIO lib is +# If variables are not set, GFSIO will be built from external source +include(ExternalProject) +if(DEFINED ENV{GFSIO_DIR} ) + message("HEY!! setting GFSIO library via environment variable") + set(GFSIO_LIBRARY $ENV{GFSIO_LIB4} CACHE STRING "GFSIO Library Location" ) + set(GFSIO_INC $ENV{GFSIO_INC4} CACHE STRING "GFSIO_4 Include Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-gfsio + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-gfsio + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-gfsio + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-gfsio OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("gfsio version is ${LIBVERSION}") + set( GFSIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libgfsio_${LIBVERSION}_d.a ) + set( GFSIO_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libgfsio_${LIBVERSION}_4.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${GFSIO_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-gfsio ) + else() + set( CORE_BUILT ${GFSIO_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-gfsio ) + endif() + + set( GFSIO_LIBRARY_PATH ${GFSIO_LIBRARY} CACHE STRING "GFSIO Library Location" ) + set( GFSIO_INCLUDE_PATH ${GFSIO_INC} CACHE STRING "GFSIO Include Location" ) + +endif() diff --git a/cmake/Modules/FindGSICONTROL.cmake b/cmake/Modules/FindGSICONTROL.cmake new file mode 100644 index 000000000..8b5ced537 --- /dev/null +++ b/cmake/Modules/FindGSICONTROL.cmake @@ -0,0 +1,54 @@ +# - Find the Control version of GSI to use for regression testing + +set( NO_DEFAULT_PATH ) +message("Control path is ${CONTROLPATH}") +find_file( CONTROL_EXE + NAMES gsi.x global_gsi ${GSIEXEC} + HINTS + ${CONTROLPATH} + ${CONTROLPATH}/bin + ${CONTROLPATH}/exec + $ENV{CONTROLPATH} + $ENV{CONTROLPATH}/bin + $ENV{CONTROLPATH}/exec + $ENV{CONTROLPATH}/src + ${CMAKE_SOURCE_DIR}/../trunk/src + ${CMAKE_SOURCE_DIR}/../../trunk/src + ${PROJECT_BINARY_DIR}/../build-trunk/bin + /da/save/Michael.Lueken/svn1/build/bin + /da/save/Michael.Lueken/svn1/src + /gpfs/dell2/emc/modeling/noscrub/Michael.Lueken/svn1/build/bin + /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/build/bin + /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/src + /scratch4/NCEPDEV/da/save/Michael.Lueken/svn1_old/build/bin + /scratch4/NCEPDEV/da/save/Michael.Lueken/svn1/src + + ${NO_DEFAULT_PATH}) + +set( GSICONTROL ${CONTROL_EXE} CACHE STRING "GSI control executable for regression testing" FORCE ) + +find_file( ENKF_CONTROL_EXE + NAMES enkf_gfs.x global_enkf ${ENKFEXEC} + HINTS + ${CONTROLPATH} + ${CONTROLPATH}/bin + ${CONTROLPATH}/exec + $ENV{CONTROLPATH} + $ENV{CONTROLPATH}/bin + $ENV{CONTROLPATH}/exec + ${CMAKE_SOURCE_DIR}/../trunk/src/enkf + ${PROJECT_BINARY_DIR}/../build-trunk/bin + $ENV{CONTROLPATH}/enkf + $ENV{CONTROLPATH}/src/enkf + /da/save/Michael.Lueken/svn1/build/bin + /da/save/Michael.Lueken/svn1/src/enkf + /gpfs/dell2/emc/modeling/noscrub/Michael.Lueken/svn1/build/bin + /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/build/bin + /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/src/enkf + /scratch4/NCEPDEV/da/save/Michael.Lueken/svn1_old/build/bin + /scratch4/NCEPDEV/da/save/Michael.Lueken/svn1/src/enkf + + ${NO_DEFAULT_PATH}) + +set( ENKFCONTROL ${ENKF_CONTROL_EXE} CACHE STRING "ENKF control executable for regression testing" FORCE ) + diff --git a/cmake/Modules/FindHDF5.cmake b/cmake/Modules/FindHDF5.cmake new file mode 100644 index 000000000..15525f96e --- /dev/null +++ b/cmake/Modules/FindHDF5.cmake @@ -0,0 +1,25 @@ +# This extends CMake's FindHDF5.cmake to add support to include MPI include +# paths and libraries in the HDF5 ones if HDF5_IS_PARALLEL is ON +# (BUG #0014363). + +# include the default FindHDF5.cmake. +#if(CMAKE_VERSION VERSION_LESS 3.6.1) +if(CMAKE_VERSION VERSION_GREATER 3.0 ) + include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindHDF5.cmake) +else() + include(${CMAKE_ROOT}/Modules/FindHDF5.cmake) +endif() +#endif() + +if(HDF5_FOUND AND (HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)) +# include(vtkMPI) + if(MPI_C_INCLUDE_PATH) + list(APPEND HDF5_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH}) + endif() + if(MPI_C_LIBRARIES) + list(APPEND HDF5_LIBRARIES ${MPI_C_LIBRARIES}) + endif() + if(MPI_CXX_LIBRARIES) + list(APPEND HDF5_LIBRARIES ${MPI_CXX_LIBRARIES}) + endif() +endif() diff --git a/cmake/Modules/FindIP.cmake b/cmake/Modules/FindIP.cmake new file mode 100644 index 000000000..3f4a991a5 --- /dev/null +++ b/cmake/Modules/FindIP.cmake @@ -0,0 +1,46 @@ +# This module looks for environment variables detailing where IP lib is +# If variables are not set, IP will be built from external source + +include(ExternalProject) +if(DEFINED ENV{IP_LIBd} ) + message("HEY!! setting IP library via environment variable") + set(IP_LIBRARY $ENV{IP_LIBd} CACHE STRING "IP Library Location" ) + set(IP_4_LIBRARY $ENV{IP_LIB4} CACHE STRING "IP_4 Library Location" ) + set(IP_8_LIBRARY $ENV{IP_LIB4} CACHE STRING "IP_8 Library Location" ) + set(IP_INC4 $ENV{IP_INC4} CACHE STRING "IP_4 Include Location" ) + set(IP_INC8 $ENV{IP_INC8} CACHE STRING "IP_8 Include Location" ) + set(IP_INCd $ENV{IP_INCd} CACHE STRING "IP_8 Include Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-ip + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-ip + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-ip + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-ip OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("ip version is ${LIBVERSION}") + set( IP_LIBRARY ${PROJECT_BINARY_DIR}/lib/libip_${LIBVERSION}_d.a ) + set( IP_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libip_${LIBVERSION}_4.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${IP_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-ip ) + else() + set( CORE_BUILT ${IP_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-ip ) + endif() +endif() + +set( IP_LIBRARY_PATH ${IP_LIBRARY} CACHE STRING "IP Library Location" ) +set( IP_4_LIBRARY_PATH ${IP_4_LIBRARY} CACHE STRING "IP_4 Library Location" ) + diff --git a/cmake/Modules/FindMPI.cmake b/cmake/Modules/FindMPI.cmake new file mode 100644 index 000000000..8e0a0c95b --- /dev/null +++ b/cmake/Modules/FindMPI.cmake @@ -0,0 +1,18 @@ +# This extends CMake's FindHDF5.cmake to add support to include MPI include +# paths and libraries in the HDF5 ones if HDF5_IS_PARALLEL is ON +# (BUG #0014363). + +# include the default FindMPI.cmake. +if(CMAKE_VERSION VERSION_LESS 3.1) + include(${CMAKE_ROOT}/Modules/FindMPI.cmake) +elseif(CMAKE_VERSION VERSION_LESS 3.6) + message("Using new FindMPI") + include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindMPI.cmake) +# set(MPI_Fortran_INCLUDE_DIRS ${MPI_Fortran_INCLUDE_PATH} CACHE INTERNAL "Deprecated Variable Name") +else() + message("Using installed FindMPI") + include(${CMAKE_ROOT}/Modules/FindMPI.cmake) +# set(MPI_Fortran_INCLUDE_DIRS ${MPI_Fortran_INCLUDE_PATH} CACHE INTERNAL "Deprecated Variable Name") + message("include dirs are ${MPI_Fortran_INCLUDE_DIRS}") + message("include PATH ${MPI_Fortran_INCLUDE_PATH}") +endif() diff --git a/cmake/Modules/FindNDATE.cmake b/cmake/Modules/FindNDATE.cmake new file mode 100644 index 000000000..44bf4f1cd --- /dev/null +++ b/cmake/Modules/FindNDATE.cmake @@ -0,0 +1,13 @@ +# - Find the NDATE utility or build it + +set( NO_DEFAULT_PATH ) +if(DEFINED ENV{NDATE}) + set(NDATE $ENV{NDATE} ) +else() + find_file( NDATE + NAMES ndate.x ndate + HINTS + /nwprod/util/exec + $ENV{NWPROD}/util/exec + ${NO_DEFAULT_PATH}) +endif() diff --git a/cmake/Modules/FindNEMSIO.cmake b/cmake/Modules/FindNEMSIO.cmake new file mode 100644 index 000000000..c202b8b9c --- /dev/null +++ b/cmake/Modules/FindNEMSIO.cmake @@ -0,0 +1,41 @@ +# This module looks for environment variables detailing where NEMSIO lib is +# If variables are not set, NEMSIO will be built from external source +include(ExternalProject) +if(DEFINED ENV{NEMSIO_LIB} ) + message("HEY!! setting NEMSIO library via environment variable") + set(NEMSIO_LIBRARY $ENV{NEMSIO_LIB} CACHE STRING "IP Library Location" ) + set(NEMSIOINC $ENV{NEMSIO_INC} CACHE STRING "NEMSIO_4 Include Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-nemsio + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-nemsio + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-nemsio + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-nemsio OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("nemsio version is ${LIBVERSION}") + set( NEMSIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libnemsio_${LIBVERSION}.a ) + set( NEMSIOINC ${PROJECT_BINARY_DIR}/include ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${NEMSIO_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-nemsio) + else() + set( CORE_BUILT ${NEMSIO_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-nemsio) + endif() +endif() + +set( NEMSIO_LIBRARY_PATH ${NEMSIO_LIBRARY} CACHE STRING "NEMSIO Library Location" ) +set( NEMSIO_INCLUDE_PATH ${NEMSIOINC} CACHE STRING "NEMSIO Include Location" ) + diff --git a/cmake/Modules/FindNetCDF.cmake b/cmake/Modules/FindNetCDF.cmake new file mode 100644 index 000000000..cf095d53b --- /dev/null +++ b/cmake/Modules/FindNetCDF.cmake @@ -0,0 +1,145 @@ +# - Find NetCDF +# Find the native NetCDF includes and library +# +# NETCDF_INCLUDES - where to find netcdf.h, etc +# NETCDF_LIBRARIES - Link these libraries when using NetCDF +# NETCDF_FOUND - True if NetCDF found including required interfaces (see below) +# +# Your package can require certain interfaces to be FOUND by setting these +# +# NETCDF_CXX - require the C++ interface and link the C++ library +# NETCDF_F77 - require the F77 interface and link the fortran library +# NETCDF_F90 - require the F90 interface and link the fortran library +# +# The following are not for general use and are included in +# NETCDF_LIBRARIES if the corresponding option above is set. +# +# NETCDF_LIBRARIES_C - Just the C interface +# NETCDF_LIBRARIES_CXX - C++ interface, if available +# NETCDF_LIBRARIES_F77 - Fortran 77 interface, if available +# NETCDF_LIBRARIES_F90 - Fortran 90 interface, if available +# +# Normal usage would be: +# set (NETCDF_F90 "YES") +# find_package (NetCDF REQUIRED) +# target_link_libraries (uses_f90_interface ${NETCDF_LIBRARIES}) +# target_link_libraries (only_uses_c_interface ${NETCDF_LIBRARIES_C}) + + +set(NETCDF_DIR $ENV{NETCDF}) + +if (NETCDF_INCLUDES AND NETCDF_LIBRARIES) + # Already in cache, be silent + set (NETCDF_FIND_QUIETLY TRUE) +endif (NETCDF_INCLUDES AND NETCDF_LIBRARIES) + +if(DEFINED ENV{NETCDF4}) + set(NETCDF_DIR $ENV{NETCDF4}) +elseif(DEFINED ENV{NETCDF_DIR}) + set(NETCDF_DIR $ENV{NETCDF_DIR}) +elseif(DEFINED ENV{NETCDF_HOME}) + set(NETCDF_DIR $ENV{NETCDF_HOME}) +elseif( DEFINED ENV{NETCDF} ) + set(NETCDF_DIR $ENV{NETCDF}) +elseif(DEFINED ENV{SSEC_NETCDF4_DIR}) + set(NETCDF_DIR $ENV{SSEC_NETCDF4_DIR}) +elseif(DEFINED ENV{SSEC_NETCDF_DIR}) + set(NETCDF_DIR $ENV{SSEC_NETCDF_DIR}) +endif() +if(DEFINED ENV{NETCDF_FORTRAN}) + set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN}) +elseif(DEFINED ENV{NETCDF_FORTRAN_DIR}) + set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN_DIR}) +endif() +find_path (NETCDF_INCLUDES netcdf.h + HINTS ${NETCDF_DIR}/include $ENV{SSEC_NETCDF_DIR}/include ) + +find_program (NETCDF_META netcdf_meta.h + HINTS ${NETCDF_INCLUDES} ${CMAKE_INSTALL_PREFIX} + ) +if (NETCDF_META) + file (STRINGS ${NETCDF_META} NETCDF_VERSION REGEX "define NC_VERSION_MAJOR") + string (REGEX REPLACE "#define NC_VERSION_MAJOR " "" NETCDF_VERSION ${NETCDF_VERSION}) + string (REGEX REPLACE "\\/\\*\\!< netcdf-c major version. \\*\\/" "" NETCDF_VERSION ${NETCDF_VERSION}) + string (REGEX REPLACE " " "" NETCDF_VERSION ${NETCDF_VERSION} ) + if(${NETCDF_VERSION} GREATER "3") + set(NETCDF_F90 "YES") + endif() +endif (NETCDF_META) + +find_library (NETCDF_flib + names libnetcdff.a netcdff.a libnetcdff.so netcdff.so + HINTS + ${NETCDF_DIR}/lib + ${NETCDF_FORTRAN_DIR}/lib + ${NETCDF_FORTRAN}/lib + ${NETCDF_FORTRAN_ROOT}/lib +) + +if (NETCDF_flib) + set(NETCDF_F90 "YES") + +endif() +find_library (NETCDF_LIBRARIES_C + NAMES netcdf + HINTS ${NETCDF_DIR}/lib ) +mark_as_advanced(NETCDF_LIBRARIES_C) + +if("${NETCDF_DIR}" STREQUAL "") + message(FATAL_ERROR " + Cannot find NETCDF!!!! + + ") +endif() +find_file (NETCDF_NCDUMP + NAMES ncdump + HINTS ${NETCDF_DIR}/bin ) +mark_as_advanced(NETCDF_NCDUMP) +execute_process(COMMAND ${NETCDF_NCDUMP} + ERROR_VARIABLE NCDUMP_INFO) +string(FIND "${NCDUMP_INFO}" "version" VERSION_LOC REVERSE) +math(EXPR VERSION_LOC "${VERSION_LOC} + 9") +string(SUBSTRING "${NCDUMP_INFO}" ${VERSION_LOC} 1 NETCDF_MAJOR_VERSION) +if (${NETCDF_MAJOR_VERSION} LESS 4) + message(FATAL_ERROR " + Current NETCDF is ${NETCDF_DIR} + !!!! NETCDF version 4.0 and above is required !!!! + + ") +endif() + +set (NetCDF_has_interfaces "YES") # will be set to NO if we're missing any interfaces +set (NetCDF_libs ${NETCDF_LIBRARIES_C} ${NETCDF_LIBRARIES_Fortran}) +message("netcdf_libs is ${NetCDF_libs}") +get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARIES_C}" PATH) + +macro (NetCDF_check_interface lang header libs) + if (NETCDF_${lang}) + find_path (NETCDF_INCLUDES_${lang} NAMES ${header} + HINTS ${NETCDF_INCLUDES} ${NETCDF_FORTRAN}/include NO_DEFAULT_PATH) + find_library (NETCDF_LIBRARIES_${lang} NAMES ${libs} + HINTS ${NetCDF_lib_dirs} ${NETCDF_FORTRAN}/lib NO_DEFAULT_PATH) + mark_as_advanced (NETCDF_INCLUDES_${lang} NETCDF_LIBRARIES_${lang}) + if (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) + list (INSERT NetCDF_libs 0 ${NETCDF_LIBRARIES_${lang}}) # prepend so that -lnetcdf is last + else (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) + set (NetCDF_has_interfaces "NO") + message (STATUS "Failed to find NetCDF interface for ${lang}") + endif (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) + endif (NETCDF_${lang}) +endmacro (NetCDF_check_interface) + +NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++) +NetCDF_check_interface (F77 netcdf.inc netcdff) +NetCDF_check_interface (F90 netcdf.mod netcdff) +if( NETCDF_LIBRARIES_F90 ) + set( NETCDF4 "YES" ) +endif() + +set (NETCDF_LIBRARIES "${NetCDF_libs}" CACHE STRING "All NetCDF libraries required for interface level") +# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if +# all listed variables are TRUE +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (NetCDF DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDES NetCDF_has_interfaces) + +mark_as_advanced (NETCDF_LIBRARIES NETCDF_INCLUDES) diff --git a/cmake/Modules/FindSFCIO.cmake b/cmake/Modules/FindSFCIO.cmake new file mode 100644 index 000000000..e31d45b9d --- /dev/null +++ b/cmake/Modules/FindSFCIO.cmake @@ -0,0 +1,42 @@ +# This module looks for environment variables detailing where SFCIO lib is +# If variables are not set, SFCIO will be built from external source +include(ExternalProject) +if(DEFINED ENV{SFCIO_DIR} ) + message("HEY!! setting SFCIO library via environment variable") + set(SFCIO_LIBRARY $ENV{SFCIO_LIB} CACHE STRING "SP Library Location" ) + set(SFCIO_4_LIBRARY $ENV{SFCIO_LIB4} CACHE STRING "SFCIO4 Library Location" ) + set(SFCIO_INC $ENV{SFCIO_INC} CACHE STRING "SFCIO d Include Location" ) + set(SFCIO_4_INC $ENV{SFCIO_INC4} CACHE STRING "SFCIO4 Include Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-sfcio + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-sfcio + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-sfcio + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-sfcio OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("sfcio version is ${LIBVERSION}") + set( SFCIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libsfcio_${LIBVERSION}.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${SFCIO_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-sfcio ) + else() + set( CORE_BUILT ${SFCIO_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-sfcio ) + endif() +endif() + +set( SFCIO_LIBRARY_PATH ${SFCIO_LIBRARY} CACHE STRING "SFCIO Library Location" ) +set( SFCIO_INCLUDE_PATH ${SFCIO_LIBRARY} CACHE STRING "SFCIO Include Location" ) + diff --git a/cmake/Modules/FindSIGIO.cmake b/cmake/Modules/FindSIGIO.cmake new file mode 100644 index 000000000..7a5ed6db9 --- /dev/null +++ b/cmake/Modules/FindSIGIO.cmake @@ -0,0 +1,42 @@ +# This module looks for environment variables detailing where SIGIO lib is +# If variables are not set, SIGIO will be built from external source +include(ExternalProject) +if(DEFINED ENV{SIGIO_DIR} ) + message("HEY!! setting SIGIO library via environment variable") + set(SIGIO_LIBRARY $ENV{SIGIO_LIB} CACHE STRING "SP Library Location" ) + set(SIGIO_4_LIBRARY $ENV{SIGIO_LIB4} CACHE STRING "SIGIO4 Library Location" ) + set(SIGIO_INC $ENV{SIGIO_INC} CACHE STRING "SIGIO d Include Location" ) + set(SIGIO_4_INC $ENV{SIGIO_INC4} CACHE STRING "SIGIO4 Include Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-sigio + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-sigio + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-sigio + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-sigio OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("sigio version is ${LIBVERSION}") + set( SIGIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libsigio_${LIBVERSION}.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${SIGIO_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-sigio ) + else() + set( CORE_BUILT ${SIGIO_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-sigio ) + endif() + +endif() +set( SIGIO_LIBRARY_PATH ${SIGIO_LIBRARY} CACHE STRING "SIGIO Library Location" ) +set( SIGIO_INCLUDE_PATH ${SIGIO_LIBRARY} CACHE STRING "SIGIO include Location" ) + diff --git a/cmake/Modules/FindSP.cmake b/cmake/Modules/FindSP.cmake new file mode 100644 index 000000000..3101d6464 --- /dev/null +++ b/cmake/Modules/FindSP.cmake @@ -0,0 +1,43 @@ +# This module looks for environment variables detailing where SP lib is +# If variables are not set, SP will be built from external source + +include(ExternalProject) +if(DEFINED ENV{SP_LIBd} ) + message("HEY!! setting SP library via environment variable") + set(SP_LIBRARY $ENV{SP_LIBd} CACHE STRING "SP Library Location" ) + set(SP_4_LIBRARY $ENV{SP_LIB4} CACHE STRING "SP_4 Library Location" ) + set(SP_8_LIBRARY $ENV{SP_LIB4} CACHE STRING "SP_8 Library Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-sp + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-sp + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-sp + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-sp OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("sp version is ${LIBVERSION}") + set( SP_LIBRARY ${PROJECT_BINARY_DIR}/lib/libsp_${LIBVERSION}_d.a ) + set( SP_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libsp_${LIBVERSION}_4.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${SP_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-sp ) + else() + set( CORE_BUILT ${SP_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-sp ) + endif() +endif() + +set( SP_LIBRARY_PATH ${SP_LIBRARY} CACHE STRING "SP Library Location" ) +set( SP_4_LIBRARY_PATH ${SP_4_LIBRARY} CACHE STRING "SP_4 Library Location" ) + diff --git a/cmake/Modules/FindW3EMC.cmake b/cmake/Modules/FindW3EMC.cmake new file mode 100644 index 000000000..0f3b828a4 --- /dev/null +++ b/cmake/Modules/FindW3EMC.cmake @@ -0,0 +1,49 @@ +# This module looks for environment variables detailing where W3EMC lib is +# If variables are not set, W3EMC will be built from external source +include(ExternalProject) +if(DEFINED ENV{W3EMC_LIBd} ) + message("HEY!! setting W3EMC library via environment variable") + set(W3EMC_LIBRARY $ENV{W3EMC_LIBd} CACHE STRING "SP Library Location" ) + set(W3EMC_4_LIBRARY $ENV{W3EMC_LIB4} CACHE STRING "W3EMC4 Library Location" ) + set(W3EMCINC $ENV{W3EMC_INC} CACHE STRING "W3EMC d Include Location" ) + set(W3EMC4INC $ENV{W3EMC_INC4} CACHE STRING "W3EMC4 Include Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + ExternalProject_Add(NCEPLIBS-w3emc + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-w3emc + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DEXTRA_INCLUDE=${PROJECT_BINARY_DIR}/include + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-w3emc + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + add_dependencies(NCEPLIBS-w3emc NCEPLIBS-sigio) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-w3emc OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("w3emc version is ${LIBVERSION}") + set( W3EMC_LIBRARY ${PROJECT_BINARY_DIR}/lib/libw3emc_${LIBVERSION}_d.a ) + set( W3EMC_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libw3emc_${LIBVERSION}_4.a ) + set(W3EMCINC ${PROJECT_BINARY_DIR}/include ) + set(W3EMC4INC ${PROJECT_BINARY_DIR}/include_4 ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${W3EMC_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-w3emc ) + else() + set( CORE_BUILT ${W3EMC_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-w3emc ) + endif() +endif() + +set( W3EMC_LIBRARY_PATH ${W3EMC_LIBRARY} CACHE STRING "W3EMC Library Location" ) +set( W3EMC_4_LIBRARY_PATH ${W3EMC_4_LIBRARY} CACHE STRING "W3EMC_4 Library Location" ) +set( W3EMC_INCLUDE_PATH ${W3EMCINC} CACHE STRING "W3EMC Include Location" ) +set( W3EMC_INCLUDE_4_PATH ${W3EMC4INC} CACHE STRING "W3EMC_4 Include Location" ) + diff --git a/cmake/Modules/FindW3NCO.cmake b/cmake/Modules/FindW3NCO.cmake new file mode 100644 index 000000000..f20149df7 --- /dev/null +++ b/cmake/Modules/FindW3NCO.cmake @@ -0,0 +1,44 @@ +# This module looks for environment variables detailing where W3NCO lib is +# If variables are not set, W3NCO will be built from external source +include(ExternalProject) +if(DEFINED ENV{W3NCO_LIB4} ) + set(W3NCO_LIBRARY $ENV{W3NCO_LIBd} CACHE STRING "W3NCO Library Location" ) + set(W3NCO_4_LIBRARY $ENV{W3NCO_LIB4} CACHE STRING "W3NCO_4 Library Location" ) + set(W3NCO_8_LIBRARY $ENV{W3NCO_LIB8} CACHE STRING "W3NCO_4 Library Location" ) +else() + set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + set(SRC_DIR ${PROJECT_SOURCE_DIR}/../NCEPLIBS-w3nco) + ExternalProject_Add(NCEPLIBS-w3nco + PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-w3nco + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + -DCMAKE_BUILD_TYPE=RELEASE + SOURCE_DIR ${SRC_DIR} + INSTALL_DIR ${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${SRC_DIR} OUTPUT_VARIABLE LIBVERSION) + string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) + string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) + string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) + message("w3nco version is ${LIBVERSION}") + set( W3NCO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libw3nco_${LIBVERSION}_d.a ) + set( W3NCO_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libw3nco_${LIBVERSION}_4.a ) + if( CORE_BUILT ) + list( APPEND CORE_BUILT ${W3NCO_LIBRARY} ) + list( APPEND EXT_BUILT NCEPLIBS-w3nco ) + else() + set( CORE_BUILT ${W3NCO_LIBRARY} ) + set( EXT_BUILT NCEPLIBS-w3nco ) + endif() + +endif() +set( W3NCO_LIBRARY_PATH ${W3NCO_LIBRARY} CACHE STRING "W3NCO Library Location" ) +set( W3NCO_4_LIBRARY_PATH ${W3NCO_4_LIBRARY} CACHE STRING "W3NCO_4 Library Location" ) +set( W3NCO_8_LIBRARY_PATH ${W3NCO_8_LIBRARY} CACHE STRING "W3NCO_4 Library Location" ) + + diff --git a/cmake/Modules/FindWRF.cmake b/cmake/Modules/FindWRF.cmake new file mode 100644 index 000000000..43faf4664 --- /dev/null +++ b/cmake/Modules/FindWRF.cmake @@ -0,0 +1,36 @@ +# - Find the WRF modules + +set( NO_DEFAULT_PATH ) +find_library( IOINT_LIB + NAMES libwrfio_int.a + HINTS + ${WRFPATH}/external/io_int + $ENV{WRFPATH}/external/io_int + /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_int + /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/external/io_int + ${NO_DEFAULT_PATH}) + +find_library( WRFNETCDF_LIB + NAMES libwrfio_nf.a + HINTS + ${WRFPATH}/external/io_netcdf /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_netcdf + $ENV{WRFPATH}/external/io_netcdf /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_netcdf + /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/external/io_netcdf + ${NO_DEFAULT_PATH}) +find_file( FRAMEPACK + NAMES pack_utils.o + HINTS + ${WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame + $ENV{WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame + /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/frame + ${NO_DEFAULT_PATH}) +find_file( FRAMEMODULE + NAMES module_machine.o + HINTS + ${WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame + $ENV{WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame + /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/frame + ${NO_DEFAULT_PATH}) + +set( WRF_LIBRARIES ${IOINT_LIB} ${WRFNETCDF_LIB} ${FRAMEPACK} ${FRAMEMODULE} ) + diff --git a/cmake/Modules/NewCMake/CMakeParseArguments.cmake b/cmake/Modules/NewCMake/CMakeParseArguments.cmake new file mode 100644 index 000000000..7ee2bbace --- /dev/null +++ b/cmake/Modules/NewCMake/CMakeParseArguments.cmake @@ -0,0 +1,11 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# CMakeParseArguments +# ------------------- +# +# This module once implemented the :command:`cmake_parse_arguments` command +# that is now implemented natively by CMake. It is now an empty placeholder +# for compatibility with projects that include it to get the command from +# CMake 3.4 and lower. diff --git a/cmake/Modules/NewCMake/FindHDF5.cmake b/cmake/Modules/NewCMake/FindHDF5.cmake new file mode 100644 index 000000000..fd8891cf2 --- /dev/null +++ b/cmake/Modules/NewCMake/FindHDF5.cmake @@ -0,0 +1,934 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindHDF5 +# -------- +# +# Find HDF5, a library for reading and writing self describing array data. +# +# +# +# This module invokes the HDF5 wrapper compiler that should be installed +# alongside HDF5. Depending upon the HDF5 Configuration, the wrapper +# compiler is called either h5cc or h5pcc. If this succeeds, the module +# will then call the compiler with the -show argument to see what flags +# are used when compiling an HDF5 client application. +# +# The module will optionally accept the COMPONENTS argument. If no +# COMPONENTS are specified, then the find module will default to finding +# only the HDF5 C library. If one or more COMPONENTS are specified, the +# module will attempt to find the language bindings for the specified +# components. The only valid components are C, CXX, Fortran, HL, and +# Fortran_HL. If the COMPONENTS argument is not given, the module will +# attempt to find only the C bindings. +# +# This module will read the variable +# HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a +# static link to a dynamic link for HDF5 and all of it's dependencies. +# To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES +# variable is set before the call to find_package. +# +# To provide the module with a hint about where to find your HDF5 +# installation, you can set the environment variable HDF5_ROOT. The +# Find module will then look in this path when searching for HDF5 +# executables, paths, and libraries. +# +# Both the serial and parallel HDF5 wrappers are considered and the first +# directory to contain either one will be used. In the event that both appear +# in the same directory the serial version is preferentially selected. This +# behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to +# true. +# +# In addition to finding the includes and libraries required to compile +# an HDF5 client application, this module also makes an effort to find +# tools that come with the HDF5 distribution that may be useful for +# regression testing. +# +# This module will define the following variables: +# +# :: +# +# HDF5_FOUND - true if HDF5 was found on the system +# HDF5_VERSION - HDF5 version in format Major.Minor.Release +# HDF5_INCLUDE_DIRS - Location of the hdf5 includes +# HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated) +# HDF5_DEFINITIONS - Required compiler definitions for HDF5 +# HDF5_LIBRARIES - Required libraries for all requested bindings +# HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API for all +# bindings, if the HL component is enabled +# +# Available components are: C CXX Fortran and HL. For each enabled language +# binding, a corresponding HDF5_${LANG}_LIBRARIES variable, and potentially +# HDF5_${LANG}_DEFINITIONS, will be defined. +# If the HL component is enabled, then an HDF5_${LANG}_HL_LIBRARIES will +# also be defined. With all components enabled, the following variables will be defined: +# +# :: +# +# HDF5_C_DEFINITIONS -- Required compiler definitions for HDF5 C bindings +# HDF5_CXX_DEFINITIONS -- Required compiler definitions for HDF5 C++ bindings +# HDF5_Fortran_DEFINITIONS -- Required compiler definitions for HDF5 Fortran bindings +# HDF5_C_INCLUDE_DIRS -- Required include directories for HDF5 C bindings +# HDF5_CXX_INCLUDE_DIRS -- Required include directories for HDF5 C++ bindings +# HDF5_Fortran_INCLUDE_DIRS -- Required include directories for HDF5 Fortran bindings +# HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings +# HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings +# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings +# HDF5_C_HL_LIBRARIES - Required libraries for the high level C bindings +# HDF5_CXX_HL_LIBRARIES - Required libraries for the high level C++ bindings +# HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran +# bindings. +# +# HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support +# HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler +# HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler +# HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler +# HDF5_C_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C compiler +# which is also the HDF5 wrapper +# HDF5_CXX_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C++ +# compiler which is also +# the HDF5 wrapper +# HDF5_Fortran_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary +# Fortran compiler which +# is also the HDF5 wrapper +# HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool +# +# The following variable can be set to guide the search for HDF5 libraries and includes: +# +# ``HDF5_ROOT`` +# Specify the path to the HDF5 installation to use. +# +# ``HDF5_FIND_DEBUG`` +# Set to a true value to get some extra debugging output. +# +# ``HDF5_NO_FIND_PACKAGE_CONFIG_FILE`` +# Set to a true value to skip trying to find ``hdf5-config.cmake``. + +# This module is maintained by Will Dicharry . + +include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +# List of the valid HDF5 components +set(HDF5_VALID_LANGUAGE_BINDINGS C CXX Fortran) + +# Validate the list of find components. +if(NOT HDF5_FIND_COMPONENTS) + set(HDF5_LANGUAGE_BINDINGS "C") +else() + set(HDF5_LANGUAGE_BINDINGS) + # add the extra specified components, ensuring that they are valid. + set(FIND_HL OFF) + foreach(component IN LISTS HDF5_FIND_COMPONENTS) + list(FIND HDF5_VALID_LANGUAGE_BINDINGS ${component} component_location) + if(NOT component_location EQUAL -1) + list(APPEND HDF5_LANGUAGE_BINDINGS ${component}) + elseif(component STREQUAL "HL") + set(FIND_HL ON) + elseif(component STREQUAL "Fortran_HL") # only for compatibility + list(APPEND HDF5_LANGUAGE_BINDINGS Fortran) + set(FIND_HL ON) + set(HDF5_FIND_REQUIRED_Fortran_HL False) + set(HDF5_FIND_REQUIRED_Fortran True) + set(HDF5_FIND_REQUIRED_HL True) + else() + message(FATAL_ERROR "${component} is not a valid HDF5 component.") + endif() + endforeach() + if(NOT HDF5_LANGUAGE_BINDINGS) + get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) + foreach(__lang IN LISTS __langs) + if(__lang MATCHES "^(C|CXX|Fortran)$") + list(APPEND HDF5_LANGUAGE_BINDINGS ${__lang}) + endif() + endforeach() + endif() + list(REMOVE_ITEM HDF5_FIND_COMPONENTS Fortran_HL) # replaced by Fortran and HL + list(REMOVE_DUPLICATES HDF5_LANGUAGE_BINDINGS) +endif() + +# Determine whether to search for serial or parallel executable first +if(HDF5_PREFER_PARALLEL) + set(HDF5_C_COMPILER_NAMES h5pcc h5cc) + set(HDF5_CXX_COMPILER_NAMES h5pc++ h5c++) + set(HDF5_Fortran_COMPILER_NAMES h5pfc h5fc) +else() + set(HDF5_C_COMPILER_NAMES h5cc h5pcc) + set(HDF5_CXX_COMPILER_NAMES h5c++ h5pc++) + set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc) +endif() + +# We may have picked up some duplicates in various lists during the above +# process for the language bindings (both the C and C++ bindings depend on +# libz for example). Remove the duplicates. It appears that the default +# CMake behavior is to remove duplicates from the end of a list. However, +# for link lines, this is incorrect since unresolved symbols are searched +# for down the link line. Therefore, we reverse the list, remove the +# duplicates, and then reverse it again to get the duplicates removed from +# the beginning. +macro(_HDF5_remove_duplicates_from_beginning _list_name) + if(${_list_name}) + list(REVERSE ${_list_name}) + list(REMOVE_DUPLICATES ${_list_name}) + list(REVERSE ${_list_name}) + endif() +endmacro() + + +# Test first if the current compilers automatically wrap HDF5 + +function(_HDF5_test_regular_compiler_C success version is_parallel) + set(scratch_directory + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) + if(NOT ${success} OR + NOT EXISTS ${scratch_directory}/compiler_has_h5_c) + set(test_file ${scratch_directory}/cmake_hdf5_test.c) + file(WRITE ${test_file} + "#include \n" + "#include \n" + "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" + "#ifdef H5_HAVE_PARALLEL\n" + "const char* info_parallel = \"INFO\" \":\" \"PARALLEL\";\n" + "#endif\n" + "int main(int argc, char **argv) {\n" + " int require = 0;\n" + " require += info_ver[argc];\n" + "#ifdef H5_HAVE_PARALLEL\n" + " require += info_parallel[argc];\n" + "#endif\n" + " hid_t fid;\n" + " fid = H5Fcreate(\"foo.h5\",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);\n" + " return 0;\n" + "}") + try_compile(${success} ${scratch_directory} ${test_file} + COPY_FILE ${scratch_directory}/compiler_has_h5_c + ) + endif() + if(${success}) + file(STRINGS ${scratch_directory}/compiler_has_h5_c INFO_STRINGS + REGEX "^INFO:" + ) + string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?" + INFO_VER "${INFO_STRINGS}" + ) + set(${version} ${CMAKE_MATCH_1}) + if(CMAKE_MATCH_3) + set(${version} ${HDF5_C_VERSION}.${CMAKE_MATCH_3}) + endif() + set(${version} ${${version}} PARENT_SCOPE) + + if(INFO_STRINGS MATCHES "INFO:PARALLEL") + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() + endif() +endfunction() + +function(_HDF5_test_regular_compiler_CXX success version is_parallel) + set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) + if(NOT ${success} OR + NOT EXISTS ${scratch_directory}/compiler_has_h5_cxx) + set(test_file ${scratch_directory}/cmake_hdf5_test.cxx) + file(WRITE ${test_file} + "#include \n" + "#ifndef H5_NO_NAMESPACE\n" + "using namespace H5;\n" + "#endif\n" + "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" + "#ifdef H5_HAVE_PARALLEL\n" + "const char* info_parallel = \"INFO\" \":\" \"PARALLEL\";\n" + "#endif\n" + "int main(int argc, char **argv) {\n" + " int require = 0;\n" + " require += info_ver[argc];\n" + "#ifdef H5_HAVE_PARALLEL\n" + " require += info_parallel[argc];\n" + "#endif\n" + " H5File file(\"foo.h5\", H5F_ACC_TRUNC);\n" + " return 0;\n" + "}") + try_compile(${success} ${scratch_directory} ${test_file} + COPY_FILE ${scratch_directory}/compiler_has_h5_cxx + ) + endif() + if(${success}) + file(STRINGS ${scratch_directory}/compiler_has_h5_cxx INFO_STRINGS + REGEX "^INFO:" + ) + string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?" + INFO_VER "${INFO_STRINGS}" + ) + set(${version} ${CMAKE_MATCH_1}) + if(CMAKE_MATCH_3) + set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3}) + endif() + set(${version} ${${version}} PARENT_SCOPE) + + if(INFO_STRINGS MATCHES "INFO:PARALLEL") + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() + endif() +endfunction() + +function(_HDF5_test_regular_compiler_Fortran success is_parallel) + if(NOT ${success}) + set(scratch_directory + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) + set(test_file ${scratch_directory}/cmake_hdf5_test.f90) + file(WRITE ${test_file} + "program hdf5_hello\n" + " use hdf5\n" + " use h5lt\n" + " use h5ds\n" + " integer error\n" + " call h5open_f(error)\n" + " call h5close_f(error)\n" + "end\n") + try_compile(${success} ${scratch_directory} ${test_file}) + if(${success}) + execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig + OUTPUT_VARIABLE config_output + ERROR_VARIABLE config_error + RESULT_VARIABLE config_result + ) + if(config_output MATCHES "Parallel HDF5: yes") + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() + endif() + endif() +endfunction() + +# Invoke the HDF5 wrapper compiler. The compiler return value is stored to the +# return_value argument, the text output is stored to the output variable. +macro( _HDF5_invoke_compiler language output return_value version is_parallel) + set(${version}) + if(HDF5_USE_STATIC_LIBRARIES) + set(lib_type_args -noshlib) + else() + set(lib_type_args -shlib) + endif() + set(scratch_dir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) + if("${language}" STREQUAL "C") + set(test_file ${scratch_dir}/cmake_hdf5_test.c) + elseif("${language}" STREQUAL "CXX") + set(test_file ${scratch_dir}/cmake_hdf5_test.cxx) + elseif("${language}" STREQUAL "Fortran") + set(test_file ${scratch_dir}/cmake_hdf5_test.f90) + endif() + exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} + ARGS -show ${lib_type_args} ${test_file} + OUTPUT_VARIABLE ${output} + RETURN_VALUE ${return_value} + ) + if(NOT ${${return_value}} EQUAL 0) + message(STATUS + "Unable to determine HDF5 ${language} flags from HDF5 wrapper.") + endif() + exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} + ARGS -showconfig + OUTPUT_VARIABLE config_output + RETURN_VALUE config_return + ) + if(NOT ${return_value} EQUAL 0) + message( STATUS + "Unable to determine HDF5 ${language} version from HDF5 wrapper.") + endif() + string(REGEX MATCH "HDF5 Version: ([a-zA-Z0-9\\.\\-]*)" version_match "${config_output}") + if(version_match) + string(REPLACE "HDF5 Version: " "" ${version} "${version_match}") + string(REPLACE "-patch" "." ${version} "${${version}}") + endif() + if(config_output MATCHES "Parallel HDF5: yes") + set(${is_parallel} TRUE) + else() + set(${is_parallel} FALSE) + endif() +endmacro() + +# Parse a compile line for definitions, includes, library paths, and libraries. +macro( _HDF5_parse_compile_line + compile_line_var + include_paths + definitions + library_paths + libraries + libraries_hl) + + separate_arguments(_HDF5_COMPILE_ARGS UNIX_COMMAND "${${compile_line_var}}") + + foreach(arg IN LISTS _HDF5_COMPILE_ARGS) + if("${arg}" MATCHES "^-I(.*)$") + # include directory + list(APPEND ${include_paths} "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-D(.*)$") + # compile definition + list(APPEND ${definitions} "-D${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-L(.*)$") + # library search path + list(APPEND ${library_paths} "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-l(hdf5.*hl.*)$") + # library name (hl) + list(APPEND ${libraries_hl} "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-l(.*)$") + # library name + list(APPEND ${libraries} "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.(a|so|dylib|sl|lib)$") + # library file + if(NOT EXISTS "${arg}") + continue() + endif() + get_filename_component(_HDF5_LPATH "${arg}" DIRECTORY) + get_filename_component(_HDF5_LNAME "${arg}" NAME_WE) + string(REGEX REPLACE "^lib" "" _HDF5_LNAME "${_HDF5_LNAME}") + list(APPEND ${library_paths} "${_HDF5_LPATH}") + if(_HDF5_LNAME MATCHES "hdf5.*hl") + list(APPEND ${libraries_hl} "${_HDF5_LNAME}") + else() + list(APPEND ${libraries} "${_HDF5_LNAME}") + endif() + endif() + endforeach() +endmacro() + +# Select a preferred imported configuration from a target +function(_HDF5_select_imported_config target imported_conf) + # We will first assign the value to a local variable _imported_conf, then assign + # it to the function argument at the end. + get_target_property(_imported_conf ${target} MAP_IMPORTED_CONFIG_${CMAKE_BUILD_TYPE}) + if (NOT _imported_conf) + # Get available imported configurations by examining target properties + get_target_property(_imported_conf ${target} IMPORTED_CONFIGURATIONS) + if(HDF5_FIND_DEBUG) + message(STATUS "Found imported configurations: ${_imported_conf}") + endif() + # Find the imported configuration that we prefer. + # We do this by making list of configurations in order of preference, + # starting with ${CMAKE_BUILD_TYPE} and ending with the first imported_conf + set(_preferred_confs ${CMAKE_BUILD_TYPE}) + list(GET _imported_conf 0 _fallback_conf) + list(APPEND _preferred_confs RELWITHDEBINFO RELEASE DEBUG ${_fallback_conf}) + if(HDF5_FIND_DEBUG) + message(STATUS "Start search through imported configurations in the following order: ${_preferred_confs}") + endif() + # Now find the first of these that is present in imported_conf + cmake_policy(PUSH) + cmake_policy(SET CMP0057 NEW) # support IN_LISTS + foreach (_conf IN LISTS _preferred_confs) + if (${_conf} IN_LIST _imported_conf) + set(_imported_conf ${_conf}) + break() + endif() + endforeach() + cmake_policy(POP) + endif() + if(HDF5_FIND_DEBUG) + message(STATUS "Selected imported configuration: ${_imported_conf}") + endif() + # assign value to function argument + set(${imported_conf} ${_imported_conf} PARENT_SCOPE) +endfunction() + + +if(NOT HDF5_ROOT) + set(HDF5_ROOT $ENV{HDF5_ROOT}) +endif() +if(HDF5_ROOT) + set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH) +else() + set(_HDF5_SEARCH_OPTS) +endif() + +# Try to find HDF5 using an installed hdf5-config.cmake +if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE) + find_package(HDF5 QUIET NO_MODULE + HINTS ${HDF5_ROOT} + ${_HDF5_SEARCH_OPTS} + ) + if( HDF5_FOUND) + if(HDF5_FIND_DEBUG) + message(STATUS "Found HDF5 at ${HDF5_DIR} via NO_MODULE. Now trying to extract locations etc.") + endif() + set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL}) + set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) + set(HDF5_LIBRARIES) + if (NOT TARGET hdf5 AND NOT TARGET hdf5-static AND NOT TARGET hdf5-shared) + # Some HDF5 versions (e.g. 1.8.18) used hdf5::hdf5 etc + set(_target_prefix "hdf5::") + endif() + set(HDF5_C_TARGET ${_target_prefix}hdf5) + set(HDF5_C_HL_TARGET ${_target_prefix}hdf5_hl) + set(HDF5_CXX_TARGET ${_target_prefix}hdf5_cpp) + set(HDF5_CXX_HL_TARGET ${_target_prefix}hdf5_hl_cpp) + set(HDF5_Fortran_TARGET ${_target_prefix}hdf5_fortran) + set(HDF5_Fortran_HL_TARGET ${_target_prefix}hdf5_hl_fortran) + set(HDF5_DEFINITIONS "") + if(HDF5_USE_STATIC_LIBRARIES) + set(_suffix "-static") + else() + set(_suffix "-shared") + endif() + foreach(_lang ${HDF5_LANGUAGE_BINDINGS}) + + #Older versions of hdf5 don't have a static/shared suffix so + #if we detect that occurrence clear the suffix + if(_suffix AND NOT TARGET ${HDF5_${_lang}_TARGET}${_suffix}) + if(NOT TARGET ${HDF5_${_lang}_TARGET}) + #cant find this component with or without the suffix + #so bail out, and let the following locate HDF5 + set(HDF5_FOUND FALSE) + break() + endif() + set(_suffix "") + endif() + + if(HDF5_FIND_DEBUG) + message(STATUS "Trying to get properties of target ${HDF5_${_lang}_TARGET}${_suffix}") + endif() + # Find library for this target. Complicated as on Windows with a DLL, we need to search for the import-lib. + _HDF5_select_imported_config(${HDF5_${_lang}_TARGET}${_suffix} _hdf5_imported_conf) + get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} ) + if (NOT _hdf5_lang_location) + # no import lib, just try LOCATION + get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf}) + if (NOT _hdf5_lang_location) + get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION) + endif() + endif() + if( _hdf5_lang_location ) + set(HDF5_${_lang}_LIBRARY ${_hdf5_lang_location}) + list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix}) + set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix}) + set(HDF5_${_lang}_FOUND True) + endif() + if(FIND_HL) + get_target_property(__lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} ) + if (NOT _hdf5_lang_hl_location) + get_target_property(_hdf5_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf}) + if (NOT _hdf5_hl_lang_location) + get_target_property(_hdf5_hl_lang_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION) + endif() + endif() + if( _hdf5_lang_hl_location ) + set(HDF5_${_lang}_HL_LIBRARY ${_hdf5_lang_hl_location}) + list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix}) + set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix}) + set(HDF5_HL_FOUND True) + endif() + unset(_hdf5_lang_hl_location) + endif() + unset(_hdf5_imported_conf) + unset(_hdf5_lang_location) + endforeach() + endif() +endif() + +if(NOT HDF5_FOUND) + set(_HDF5_NEED_TO_SEARCH False) + set(HDF5_COMPILER_NO_INTERROGATE True) + # Only search for languages we've enabled + foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) + # First check to see if our regular compiler is one of wrappers + if(__lang STREQUAL "C") + _HDF5_test_regular_compiler_C( + HDF5_${__lang}_COMPILER_NO_INTERROGATE + HDF5_${__lang}_VERSION + HDF5_${__lang}_IS_PARALLEL) + elseif(__lang STREQUAL "CXX") + _HDF5_test_regular_compiler_CXX( + HDF5_${__lang}_COMPILER_NO_INTERROGATE + HDF5_${__lang}_VERSION + HDF5_${__lang}_IS_PARALLEL) + elseif(__lang STREQUAL "Fortran") + _HDF5_test_regular_compiler_Fortran( + HDF5_${__lang}_COMPILER_NO_INTERROGATE + HDF5_${__lang}_IS_PARALLEL) + else() + continue() + endif() + if(HDF5_${__lang}_COMPILER_NO_INTERROGATE) + message(STATUS "HDF5: Using hdf5 compiler wrapper for all ${__lang} compiling") + set(HDF5_${__lang}_FOUND True) + set(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE + "${CMAKE_${__lang}_COMPILER}" + CACHE FILEPATH "HDF5 ${__lang} compiler wrapper") + set(HDF5_${__lang}_DEFINITIONS) + set(HDF5_${__lang}_INCLUDE_DIRS) + set(HDF5_${__lang}_LIBRARIES) + set(HDF5_${__lang}_HL_LIBRARIES) + + mark_as_advanced(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE) + + set(HDF5_${__lang}_FOUND True) + set(HDF5_HL_FOUND True) + else() + set(HDF5_COMPILER_NO_INTERROGATE False) + # If this language isn't using the wrapper, then try to seed the + # search options with the wrapper + find_program(HDF5_${__lang}_COMPILER_EXECUTABLE + NAMES ${HDF5_${__lang}_COMPILER_NAMES} NAMES_PER_DIR + HINTS ${HDF5_ROOT} + PATH_SUFFIXES bin Bin + DOC "HDF5 ${__lang} Wrapper compiler. Used only to detect HDF5 compile flags." + ${_HDF5_SEARCH_OPTS} + ) + mark_as_advanced( HDF5_${__lang}_COMPILER_EXECUTABLE ) + unset(HDF5_${__lang}_COMPILER_NAMES) + + if(HDF5_${__lang}_COMPILER_EXECUTABLE) + _HDF5_invoke_compiler(${__lang} HDF5_${__lang}_COMPILE_LINE + HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION HDF5_${__lang}_IS_PARALLEL) + if(HDF5_${__lang}_RETURN_VALUE EQUAL 0) + message(STATUS "HDF5: Using hdf5 compiler wrapper to determine ${__lang} configuration") + _HDF5_parse_compile_line( HDF5_${__lang}_COMPILE_LINE + HDF5_${__lang}_INCLUDE_DIRS + HDF5_${__lang}_DEFINITIONS + HDF5_${__lang}_LIBRARY_DIRS + HDF5_${__lang}_LIBRARY_NAMES + HDF5_${__lang}_HL_LIBRARY_NAMES + ) + set(HDF5_${__lang}_LIBRARIES) + + foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES) + set(_HDF5_SEARCH_NAMES_LOCAL) + if("x${L}" MATCHES "hdf5") + # hdf5 library + set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) + if(HDF5_USE_STATIC_LIBRARIES) + if(WIN32) + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}) + else() + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) + endif() + endif() + else() + # external library + set(_HDF5_SEARCH_OPTS_LOCAL) + endif() + find_library(HDF5_${__lang}_LIBRARY_${L} + NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR + HINTS ${HDF5_${__lang}_LIBRARY_DIRS} + ${HDF5_ROOT} + ${_HDF5_SEARCH_OPTS_LOCAL} + ) + unset(_HDF5_SEARCH_OPTS_LOCAL) + unset(_HDF5_SEARCH_NAMES_LOCAL) + if(HDF5_${__lang}_LIBRARY_${L}) + list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) + else() + list(APPEND HDF5_${__lang}_LIBRARIES ${L}) + endif() + endforeach() + if(FIND_HL) + set(HDF5_${__lang}_HL_LIBRARIES) + foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES) + set(_HDF5_SEARCH_NAMES_LOCAL) + if("x${L}" MATCHES "hdf5") + # hdf5 library + set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) + if(HDF5_USE_STATIC_LIBRARIES) + if(WIN32) + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}) + else() + set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) + endif() + endif() + else() + # external library + set(_HDF5_SEARCH_OPTS_LOCAL) + endif() + find_library(HDF5_${__lang}_LIBRARY_${L} + NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR + HINTS ${HDF5_${__lang}_LIBRARY_DIRS} + ${HDF5_ROOT} + ${_HDF5_SEARCH_OPTS_LOCAL} + ) + unset(_HDF5_SEARCH_OPTS_LOCAL) + unset(_HDF5_SEARCH_NAMES_LOCAL) + if(HDF5_${__lang}_LIBRARY_${L}) + list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) + else() + list(APPEND HDF5_${__lang}_HL_LIBRARIES ${L}) + endif() + endforeach() + set(HDF5_HL_FOUND True) + endif() + + set(HDF5_${__lang}_FOUND True) + _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_DEFINITIONS) + _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_INCLUDE_DIRS) + _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_LIBRARIES) + _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_HL_LIBRARIES) + else() + set(_HDF5_NEED_TO_SEARCH True) + endif() + else() + set(_HDF5_NEED_TO_SEARCH True) + endif() + endif() + if(HDF5_${__lang}_VERSION) + if(NOT HDF5_VERSION) + set(HDF5_VERSION ${HDF5_${__lang}_VERSION}) + elseif(NOT HDF5_VERSION VERSION_EQUAL HDF5_${__lang}_VERSION) + message(WARNING "HDF5 Version found for language ${__lang}, ${HDF5_${__lang}_VERSION} is different than previously found version ${HDF5_VERSION}") + endif() + endif() + if(DEFINED HDF5_${__lang}_IS_PARALLEL) + if(NOT DEFINED HDF5_IS_PARALLEL) + set(HDF5_IS_PARALLEL ${HDF5_${__lang}_IS_PARALLEL}) + elseif(NOT HDF5_IS_PARALLEL AND HDF5_${__lang}_IS_PARALLEL) + message(WARNING "HDF5 found for language ${__lang} is parallel but previously found language is not parallel.") + elseif(HDF5_IS_PARALLEL AND NOT HDF5_${__lang}_IS_PARALLEL) + message(WARNING "HDF5 found for language ${__lang} is not parallel but previously found language is parallel.") + endif() + endif() + endforeach() +else() + set(_HDF5_NEED_TO_SEARCH True) +endif() + +if(NOT HDF5_FOUND AND HDF5_COMPILER_NO_INTERROGATE) + # No arguments necessary, all languages can use the compiler wrappers + set(HDF5_FOUND True) + set(HDF5_METHOD "Included by compiler wrappers") + set(HDF5_REQUIRED_VARS HDF5_METHOD) +elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH) + # Compiler wrappers aren't being used by the build but were found and used + # to determine necessary include and library flags + set(HDF5_INCLUDE_DIRS) + set(HDF5_LIBRARIES) + set(HDF5_HL_LIBRARIES) + foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) + if(HDF5_${__lang}_FOUND) + if(NOT HDF5_${__lang}_COMPILER_NO_INTERROGATE) + list(APPEND HDF5_DEFINITIONS ${HDF5_${__lang}_DEFINITIONS}) + list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIRS}) + list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES}) + if(FIND_HL) + list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES}) + endif() + endif() + endif() + endforeach() + _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS) + _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS) + _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES) + _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES) + set(HDF5_FOUND True) + set(HDF5_REQUIRED_VARS HDF5_LIBRARIES) + if(FIND_HL) + list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES) + endif() +endif() + +find_program( HDF5_DIFF_EXECUTABLE + NAMES h5diff + HINTS ${HDF5_ROOT} + PATH_SUFFIXES bin Bin + ${_HDF5_SEARCH_OPTS} + DOC "HDF5 file differencing tool." ) +mark_as_advanced( HDF5_DIFF_EXECUTABLE ) + +if( NOT HDF5_FOUND ) + # seed the initial lists of libraries to find with items we know we need + set(HDF5_C_LIBRARY_NAMES hdf5) + set(HDF5_C_HL_LIBRARY_NAMES hdf5_hl) + + set(HDF5_CXX_LIBRARY_NAMES hdf5_cpp ${HDF5_C_LIBRARY_NAMES}) + set(HDF5_CXX_HL_LIBRARY_NAMES hdf5_hl_cpp ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_CXX_LIBRARY_NAMES}) + + set(HDF5_Fortran_LIBRARY_NAMES hdf5_fortran ${HDF5_C_LIBRARY_NAMES}) + set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES}) + + foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) + # find the HDF5 include directories + if("${__lang}" STREQUAL "Fortran") + set(HDF5_INCLUDE_FILENAME hdf5.mod) + elseif("${__lang}" STREQUAL "CXX") + set(HDF5_INCLUDE_FILENAME H5Cpp.h) + else() + set(HDF5_INCLUDE_FILENAME hdf5.h) + endif() + + find_path(HDF5_${__lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME} + HINTS ${HDF5_ROOT} + PATHS $ENV{HOME}/.local/include + PATH_SUFFIXES include Include + ${_HDF5_SEARCH_OPTS} + ) + mark_as_advanced(HDF5_${__lang}_INCLUDE_DIR) + # set the _DIRS variable as this is what the user will normally use + set(HDF5_${__lang}_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR}) + list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR}) + + # find the HDF5 libraries + foreach(LIB IN LISTS HDF5_${__lang}_LIBRARY_NAMES) + if(HDF5_USE_STATIC_LIBRARIES) + # According to bug 1643 on the CMake bug tracker, this is the + # preferred method for searching for a static library. + # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search + # first for the full static library name, but fall back to a + # generic search on the name if the static search fails. + set( THIS_LIBRARY_SEARCH_DEBUG + lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug + lib${LIB}d-static.a lib${LIB}_debug-static.a ${LIB}d-static ${LIB}_D-static ${LIB}_debug-static ) + set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a lib${LIB} lib${LIB}-static.a ${LIB}-static) + else() + set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) + set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) + if(WIN32) + list(APPEND HDF5_DEFINITIONS "-DH5_BUILT_AS_DYNAMIC_LIB") + endif() + endif() + find_library(HDF5_${LIB}_LIBRARY_DEBUG + NAMES ${THIS_LIBRARY_SEARCH_DEBUG} + HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib + ${_HDF5_SEARCH_OPTS} + ) + find_library( HDF5_${LIB}_LIBRARY_RELEASE + NAMES ${THIS_LIBRARY_SEARCH_RELEASE} + HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib + ${_HDF5_SEARCH_OPTS} + ) + select_library_configurations( HDF5_${LIB} ) + list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY}) + endforeach() + if(HDF5_${__lang}_LIBRARIES) + set(HDF5_${__lang}_FOUND True) + endif() + + # Append the libraries for this language binding to the list of all + # required libraries. + list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES}) + + if(FIND_HL) + foreach(LIB IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES) + if(HDF5_USE_STATIC_LIBRARIES) + # According to bug 1643 on the CMake bug tracker, this is the + # preferred method for searching for a static library. + # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search + # first for the full static library name, but fall back to a + # generic search on the name if the static search fails. + set( THIS_LIBRARY_SEARCH_DEBUG + lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug + lib${LIB}d-static.a lib${LIB}_debug-static.a lib${LIB}d-static lib${LIB}_D-static lib${LIB}_debug-static ) + set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} lib${LIB}-static.a lib${LIB}-static) + else() + set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) + set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) + endif() + find_library(HDF5_${LIB}_LIBRARY_DEBUG + NAMES ${THIS_LIBRARY_SEARCH_DEBUG} + HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib + ${_HDF5_SEARCH_OPTS} + ) + find_library( HDF5_${LIB}_LIBRARY_RELEASE + NAMES ${THIS_LIBRARY_SEARCH_RELEASE} + HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib + ${_HDF5_SEARCH_OPTS} + ) + select_library_configurations( HDF5_${LIB} ) + list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${LIB}_LIBRARY}) + endforeach() + + # Append the libraries for this language binding to the list of all + # required libraries. + list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES}) + endif() + endforeach() + if(FIND_HL AND HDF5_HL_LIBRARIES) + set(HDF5_HL_FOUND True) + endif() + + _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS) + _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS) + _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES) + _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES) + + # If the HDF5 include directory was found, open H5pubconf.h to determine if + # HDF5 was compiled with parallel IO support + set( HDF5_IS_PARALLEL FALSE ) + set( HDF5_VERSION "" ) + foreach( _dir IN LISTS HDF5_INCLUDE_DIRS ) + foreach(_hdr "${_dir}/H5pubconf.h" "${_dir}/H5pubconf-64.h" "${_dir}/H5pubconf-32.h") + if( EXISTS "${_hdr}" ) + file( STRINGS "${_hdr}" + HDF5_HAVE_PARALLEL_DEFINE + REGEX "HAVE_PARALLEL 1" ) + if( HDF5_HAVE_PARALLEL_DEFINE ) + set( HDF5_IS_PARALLEL TRUE ) + endif() + unset(HDF5_HAVE_PARALLEL_DEFINE) + + file( STRINGS "${_hdr}" + HDF5_VERSION_DEFINE + REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" ) + if( "${HDF5_VERSION_DEFINE}" MATCHES + "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?\"" ) + set( HDF5_VERSION "${CMAKE_MATCH_1}" ) + if( CMAKE_MATCH_3 ) + set( HDF5_VERSION ${HDF5_VERSION}.${CMAKE_MATCH_3}) + endif() + endif() + unset(HDF5_VERSION_DEFINE) + endif() + endforeach() + endforeach() + set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL + "HDF5 library compiled with parallel IO support" ) + mark_as_advanced( HDF5_IS_PARALLEL ) + + set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS) + if(FIND_HL) + list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES) + endif() +endif() + +# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of +# HDF5_INCLUDE_DIRS +if( HDF5_INCLUDE_DIRS ) + set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) +endif() + +# If HDF5_REQUIRED_VARS is empty at this point, then it's likely that +# something external is trying to explicitly pass already found +# locations +if(NOT HDF5_REQUIRED_VARS) + set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS) +endif() + +find_package_handle_standard_args(HDF5 + REQUIRED_VARS ${HDF5_REQUIRED_VARS} + VERSION_VAR HDF5_VERSION + HANDLE_COMPONENTS +) + +unset(_HDF5_SEARCH_OPTS) + +if( HDF5_FOUND AND NOT HDF5_DIR) + # hide HDF5_DIR for the non-advanced user to avoid confusion with + # HDF5_DIR-NOT_FOUND while HDF5 was found. + mark_as_advanced(HDF5_DIR) +endif() + +if (HDF5_FIND_DEBUG) + message(STATUS "HDF5_DIR: ${HDF5_DIR}") + message(STATUS "HDF5_DEFINITIONS: ${HDF5_DEFINITIONS}") + message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}") + message(STATUS "HDF5_LIBRARIES: ${HDF5_LIBRARIES}") + message(STATUS "HDF5_HL_LIBRARIES: ${HDF5_HL_LIBRARIES}") + foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) + message(STATUS "HDF5_${__lang}_DEFINITIONS: ${HDF5_${__lang}_DEFINITIONS}") + message(STATUS "HDF5_${__lang}_INCLUDE_DIR: ${HDF5_${__lang}_INCLUDE_DIR}") + message(STATUS "HDF5_${__lang}_INCLUDE_DIRS: ${HDF5_${__lang}_INCLUDE_DIRS}") + message(STATUS "HDF5_${__lang}_LIBRARY: ${HDF5_${__lang}_LIBRARY}") + message(STATUS "HDF5_${__lang}_LIBRARIES: ${HDF5_${__lang}_LIBRARIES}") + message(STATUS "HDF5_${__lang}_HL_LIBRARY: ${HDF5_${__lang}_HL_LIBRARY}") + message(STATUS "HDF5_${__lang}_HL_LIBRARIES: ${HDF5_${__lang}_HL_LIBRARIES}") + endforeach() +endif() diff --git a/cmake/Modules/NewCMake/FindMPI.cmake b/cmake/Modules/NewCMake/FindMPI.cmake new file mode 100644 index 000000000..5cd2a2afe --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI.cmake @@ -0,0 +1,1514 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindMPI +# ------- +# +# Find a Message Passing Interface (MPI) implementation. +# +# The Message Passing Interface (MPI) is a library used to write +# high-performance distributed-memory parallel applications, and is +# typically deployed on a cluster. MPI is a standard interface (defined +# by the MPI forum) for which many implementations are available. +# +# Variables for using MPI +# ^^^^^^^^^^^^^^^^^^^^^^^ +# +# The module exposes the components ``C``, ``CXX``, ``MPICXX`` and ``Fortran``. +# Each of these controls the various MPI languages to search for. +# The difference between ``CXX`` and ``MPICXX`` is that ``CXX`` refers to the +# MPI C API being usable from C++, whereas ``MPICXX`` refers to the MPI-2 C++ API +# that was removed again in MPI-3. +# +# Depending on the enabled components the following variables will be set: +# +# ``MPI_FOUND`` +# Variable indicating that MPI settings for all requested languages have been found. +# If no components are specified, this is true if MPI settings for all enabled languages +# were detected. Note that the ``MPICXX`` component does not affect this variable. +# ``MPI_VERSION`` +# Minimal version of MPI detected among the requested languages, or all enabled languages +# if no components were specified. +# +# This module will set the following variables per language in your +# project, where ```` is one of C, CXX, or Fortran: +# +# ``MPI__FOUND`` +# Variable indicating the MPI settings for ```` were found and that +# simple MPI test programs compile with the provided settings. +# ``MPI__COMPILER`` +# MPI compiler for ```` if such a program exists. +# ``MPI__COMPILE_OPTIONS`` +# Compilation options for MPI programs in ````, given as a :ref:`;-list `. +# ``MPI__COMPILE_DEFINITIONS`` +# Compilation definitions for MPI programs in ````, given as a :ref:`;-list `. +# ``MPI__INCLUDE_DIRS`` +# Include path(s) for MPI header. +# ``MPI__LINK_FLAGS`` +# Linker flags for MPI programs. +# ``MPI__LIBRARIES`` +# All libraries to link MPI programs against. +# +# Additionally, the following :prop_tgt:`IMPORTED` targets are defined: +# +# ``MPI::MPI_`` +# Target for using MPI from ````. +# +# The following variables indicating which bindings are present will be defined: +# +# ``MPI_MPICXX_FOUND`` +# Variable indicating whether the MPI-2 C++ bindings are present (introduced in MPI-2, removed with MPI-3). +# ``MPI_Fortran_HAVE_F77_HEADER`` +# True if the Fortran 77 header ``mpif.h`` is available. +# ``MPI_Fortran_HAVE_F90_MODULE`` +# True if the Fortran 90 module ``mpi`` can be used for accessing MPI (MPI-2 and higher only). +# ``MPI_Fortran_HAVE_F08_MODULE`` +# True if the Fortran 2008 ``mpi_f08`` is available to MPI programs (MPI-3 and higher only). +# +# If possible, the MPI version will be determined by this module. The facilities to detect the MPI version +# were introduced with MPI-1.2, and therefore cannot be found for older MPI versions. +# +# ``MPI__VERSION_MAJOR`` +# Major version of MPI implemented for ```` by the MPI distribution. +# ``MPI__VERSION_MINOR`` +# Minor version of MPI implemented for ```` by the MPI distribution. +# ``MPI__VERSION`` +# MPI version implemented for ```` by the MPI distribution. +# +# Note that there's no variable for the C bindings being accessible through ``mpi.h``, since the MPI standards +# always have required this binding to work in both C and C++ code. +# +# For running MPI programs, the module sets the following variables +# +# ``MPIEXEC_EXECUTABLE`` +# Executable for running MPI programs, if such exists. +# ``MPIEXEC_NUMPROC_FLAG`` +# Flag to pass to ``mpiexec`` before giving it the number of processors to run on. +# ``MPIEXEC_MAX_NUMPROCS`` +# Number of MPI processors to utilize. Defaults to the number +# of processors detected on the host system. +# ``MPIEXEC_PREFLAGS`` +# Flags to pass to ``mpiexec`` directly before the executable to run. +# ``MPIEXEC_POSTFLAGS`` +# Flags to pass to ``mpiexec`` after other flags. +# +# Variables for locating MPI +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# This module performs a three step search for an MPI implementation: +# +# 1. Check if the compiler has MPI support built-in. This is the case if the user passed a +# compiler wrapper as ``CMAKE__COMPILER`` or if they're on a Cray system. +# 2. Attempt to find an MPI compiler wrapper and determine the compiler information from it. +# 3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings. +# Currently, only Microsoft MPI and MPICH2 on Windows are supported. +# +# For controlling the second step, the following variables may be set: +# +# ``MPI__COMPILER`` +# Search for the specified compiler wrapper and use it. +# ``MPI__COMPILER_FLAGS`` +# Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers +# support linking debug or tracing libraries if a specific flag is passed and this variable +# may be used to obtain them. +# ``MPI_COMPILER_FLAGS`` +# Used to initialize ``MPI__COMPILER_FLAGS`` if no language specific flag has been given. +# Empty by default. +# ``MPI_EXECUTABLE_SUFFIX`` +# A suffix which is appended to all names that are being looked for. For instance you may set this +# to ``.mpich`` or ``.openmpi`` to prefer the one or the other on Debian and its derivatives. +# +# In order to control the guessing step, the following variable may be set: +# +# ``MPI_GUESS_LIBRARY_NAME`` +# Valid values are ``MSMPI`` and ``MPICH2``. If set, only the given library will be searched for. +# By default, ``MSMPI`` will be preferred over ``MPICH2`` if both are available. +# This also sets ``MPI_SKIP_COMPILER_WRAPPER`` to ``true``, which may be overridden. +# +# Each of the search steps may be skipped with the following control variables: +# +# ``MPI_ASSUME_NO_BUILTIN_MPI`` +# If true, the module assumes that the compiler itself does not provide an MPI implementation and +# skips to step 2. +# ``MPI_SKIP_COMPILER_WRAPPER`` +# If true, no compiler wrapper will be searched for. +# ``MPI_SKIP_GUESSING`` +# If true, the guessing step will be skipped. +# +# Additionally, the following control variable is available to change search behavior: +# +# ``MPI_CXX_SKIP_MPICXX`` +# Add some definitions that will disable the MPI-2 C++ bindings. +# Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof, +# for example MVAPICH or Intel MPI. +# +# If the find procedure fails for a variable ``MPI__WORKS``, then the settings detected by or passed to +# the module did not work and even a simple MPI test program failed to compile. +# +# If all of these parameters were not sufficient to find the right MPI implementation, a user may +# disable the entire autodetection process by specifying both a list of libraries in ``MPI__LIBRARIES`` +# and a list of include directories in ``MPI__ADDITIONAL_INCLUDE_DIRS``. +# Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the +# settings in the cache. +# +# Cache variables for MPI +# ^^^^^^^^^^^^^^^^^^^^^^^ +# +# The variable ``MPI__INCLUDE_DIRS`` will be assembled from the following variables. +# For C and CXX: +# +# ``MPI__HEADER_DIR`` +# Location of the ``mpi.h`` header on disk. +# +# For Fortran: +# +# ``MPI_Fortran_F77_HEADER_DIR`` +# Location of the Fortran 77 header ``mpif.h``, if it exists. +# ``MPI_Fortran_MODULE_DIR`` +# Location of the ``mpi`` or ``mpi_f08`` modules, if available. +# +# For all languages the following variables are additionally considered: +# +# ``MPI__ADDITIONAL_INCLUDE_DIRS`` +# A :ref:`;-list ` of paths needed in addition to the normal include directories. +# ``MPI__INCLUDE_DIR`` +# Path variables for include folders referred to by ````. +# ``MPI__ADDITIONAL_INCLUDE_VARS`` +# A :ref:`;-list ` of ```` that will be added to the include locations of ````. +# +# The variable ``MPI__LIBRARIES`` will be assembled from the following variables: +# +# ``MPI__LIBRARY`` +# The location of a library called ```` for use with MPI. +# ``MPI__LIB_NAMES`` +# A :ref:`;-list ` of ```` that will be added to the include locations of ````. +# +# Usage of mpiexec +# ^^^^^^^^^^^^^^^^ +# +# When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically +# use all of the ``MPIEXEC_EXECUTABLE`` flags as follows: +# +# :: +# +# ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} +# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS +# +# where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to +# pass to the MPI program. +# +# Advanced variables for using MPI +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# The module can perform some advanced feature detections upon explicit request. +# +# **Important notice:** The following checks cannot be performed without *executing* an MPI test program. +# Consider the special considerations for the behavior of :command:`try_run` during cross compilation. +# Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems. +# You should only enable these detections if you absolutely need the information. +# +# If the following variables are set to true, the respective search will be performed: +# +# ``MPI_DETERMINE_Fortran_CAPABILITIES`` +# Determine for all available Fortran bindings what the values of ``MPI_SUBARRAYS_SUPPORTED`` and +# ``MPI_ASYNC_PROTECTS_NONBLOCKING`` are and make their values available as ``MPI_Fortran__SUBARRAYS`` +# and ``MPI_Fortran__ASYNCPROT``, where ```` is one of ``F77_HEADER``, ``F90_MODULE`` and +# ``F08_MODULE``. +# ``MPI_DETERMINE_LIBRARY_VERSION`` +# For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI__LIBRARY_VERSION``. +# This information is usually tied to the runtime component of an MPI implementation and might differ depending on ````. +# Note that the return value is entirely implementation defined. This information might be used to identify +# the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor. +# +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ +# +# For backward compatibility with older versions of FindMPI, these +# variables are set, but deprecated: +# +# :: +# +# MPI_COMPILER MPI_LIBRARY MPI_EXTRA_LIBRARY +# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_LINK_FLAGS +# MPI_LIBRARIES +# +# In new projects, please use the ``MPI__XXX`` equivalents. +# Additionally, the following variables are deprecated: +# +# ``MPI__COMPILE_FLAGS`` +# Use ``MPI__COMPILE_OPTIONS`` and ``MPI__COMPILE_DEFINITIONS`` instead. +# ``MPI__INCLUDE_PATH`` +# For consumption use ``MPI__INCLUDE_DIRS`` and for specifying folders use ``MPI__ADDITIONAL_INCLUDE_DIRS`` instead. +# ``MPIEXEC`` +# Use ``MPIEXEC_EXECUTABLE`` instead. + +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) # if IN_LIST + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +# Generic compiler names +set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r) +set(_MPI_CXX_GENERIC_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++ + mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r) +set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r + mpif90 mpif90_r mpf90 mpf90_r + mpif77 mpif77_r mpf77 mpf77_r + mpifc) + +# GNU compiler names +set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r) +set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r mpigxx) +set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r + mpig77 mpig77_r mpg77 mpg77_r) + +# Intel MPI compiler names on Windows +if(WIN32) + list(APPEND _MPI_C_GENERIC_COMPILER_NAMES mpicc.bat) + list(APPEND _MPI_CXX_GENERIC_COMPILER_NAMES mpicxx.bat) + list(APPEND _MPI_Fortran_GENERIC_COMPILER_NAMES mpifc.bat) + + # Intel MPI compiler names + set(_MPI_Intel_C_COMPILER_NAMES mpiicc.bat) + set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc.bat) + set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort.bat mpif77.bat mpif90.bat) + + # Intel MPI compiler names for MSMPI + set(_MPI_MSVC_C_COMPILER_NAMES mpicl.bat) + set(_MPI_MSVC_CXX_COMPILER_NAMES mpicl.bat) +else() + # Intel compiler names + set(_MPI_Intel_C_COMPILER_NAMES mpiicc) + set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++) + set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77) +endif() + +# PGI compiler names +set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc) +set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC) +set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77) + +# XLC MPI Compiler names +set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r) +set(_MPI_XL_CXX_COMPILER_NAMES mpixlcxx mpixlC mpixlc++ mpxlcxx mpxlc++ mpixlc++ mpxlCC + mpixlcxx_r mpixlC_r mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r) +set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95_r + mpixlf90 mpixlf90_r mpxlf90 mpxlf90_r + mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r + mpixlf mpixlf_r mpxlf mpxlf_r) + +# Prepend vendor-specific compiler wrappers to the list. If we don't know the compiler, +# attempt all of them. +# By attempting vendor-specific compiler names first, we should avoid situations where the compiler wrapper +# stems from a proprietary MPI and won't know which compiler it's being used for. For instance, Intel MPI +# controls its settings via the I_MPI_CC environment variables if the generic name is being used. +# If we know which compiler we're working with, we can use the most specialized wrapper there is in order to +# pick up the right settings for it. +foreach (LANG IN ITEMS C CXX Fortran) + set(_MPI_${LANG}_COMPILER_NAMES "") + foreach (id IN ITEMS GNU Intel MSVC PGI XL) + if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id) + list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${id}_${LANG}_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) + endif() + unset(_MPI_${id}_${LANG}_COMPILER_NAMES) + endforeach() + list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${LANG}_GENERIC_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) + unset(_MPI_${LANG}_GENERIC_COMPILER_NAMES) +endforeach() + +# Names to try for mpiexec +# Only mpiexec commands are guaranteed to behave as described in the standard, +# mpirun commands are not covered by the standard in any way whatsoever. +# lamexec is the executable for LAM/MPI, srun is for SLURM or Open MPI with SLURM support. +# srun -n X is however a valid command, so it behaves 'like' mpiexec. +set(_MPIEXEC_NAMES_BASE mpiexec mpiexec.hydra mpiexec.mpd mpirun lamexec srun) + +unset(_MPIEXEC_NAMES) +foreach(_MPIEXEC_NAME IN LISTS _MPIEXEC_NAMES_BASE) + list(APPEND _MPIEXEC_NAMES "${_MPIEXEC_NAME}${MPI_EXECUTABLE_SUFFIX}") +endforeach() +unset(_MPIEXEC_NAMES_BASE) + +function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) + if(DEFINED MPI_${LANG}_COMPILER_FLAGS) +# separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}") + separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS "${MPI_${LANG}_COMPILER_FLAGS}") + else() + separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}") + endif() + execute_process( + COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG} + OUTPUT_VARIABLE WRAPPER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE WRAPPER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE WRAPPER_RETURN) + # Some compiler wrappers will yield spurious zero return values, for example + # Intel MPI tolerates unknown arguments and if the MPI wrappers loads a shared + # library that has invalid or missing version information there would be warning + # messages emitted by ld.so in the compiler output. In either case, we'll treat + # the output as invalid. + if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") + set(WRAPPER_RETURN 255) + endif() + # Ensure that no error output might be passed upwards. + if(NOT WRAPPER_RETURN EQUAL 0) + unset(WRAPPER_OUTPUT) + endif() + set(${OUTPUT_VARIABLE} "${WRAPPER_OUTPUT}" PARENT_SCOPE) + set(${RESULT_VARIABLE} "${WRAPPER_RETURN}" PARENT_SCOPE) +endfunction() + +function (_MPI_interrogate_compiler lang) + unset(MPI_COMPILE_CMDLINE) + unset(MPI_LINK_CMDLINE) + + unset(MPI_COMPILE_OPTIONS_WORK) + unset(MPI_COMPILE_DEFINITIONS_WORK) + unset(MPI_INCLUDE_DIRS_WORK) + unset(MPI_LINK_FLAGS_WORK) + unset(MPI_LIB_NAMES_WORK) + unset(MPI_LIB_FULLPATHS_WORK) + + # Check whether the -showme:compile option works. This indicates that we have either Open MPI + # or a newer version of LAM/MPI, and implies that -showme:link will also work. + # Open MPI also supports -show, but separates linker and compiler information + _MPI_check_compiler(${LANG} "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + if (MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-showme:link" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) + + if (NOT MPI_COMPILER_RETURN EQUAL 0) + unset(MPI_COMPILE_CMDLINE) + endif() + endif() + + # MPICH and MVAPICH offer -compile-info and -link-info. + # For modern versions, both do the same as -show. However, for old versions, they do differ + # when called for mpicxx and mpif90 and it's necessary to use them over -show in order to find the + # removed MPI C++ bindings. + if (NOT MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + + if (MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-link-info" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) + + if (NOT MPI_COMPILER_RETURN EQUAL 0) + unset(MPI_COMPILE_CMDLINE) + endif() + endif() + endif() + + # MPICH, MVAPICH2 and Intel MPI just use "-show". Open MPI also offers this, but the + # -showme commands are more specialized. + if (NOT MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + endif() + + # Older versions of LAM/MPI have "-showme". Open MPI also supports this. + # Unknown to MPICH, MVAPICH and Intel MPI. + if (NOT MPI_COMPILER_RETURN EQUAL 0) + _MPI_check_compiler(${LANG} "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) + endif() + + if (NOT (MPI_COMPILER_RETURN EQUAL 0) OR NOT (DEFINED MPI_COMPILE_CMDLINE)) + # Cannot interrogate this compiler, so exit. + set(MPI_${LANG}_WRAPPER_FOUND FALSE PARENT_SCOPE) + return() + endif() + unset(MPI_COMPILER_RETURN) + + # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE + # into MPI_LINK_CMDLINE, if we didn't find the link line. + if (NOT DEFINED MPI_LINK_CMDLINE) + set(MPI_LINK_CMDLINE "${MPI_COMPILE_CMDLINE}") + endif() + + # At this point, we obtained some output from a compiler wrapper that works. + # We'll now try to parse it into variables with meaning to us. + if("${LANG}" STREQUAL "Fortran") + # Some MPICH-1 and MVAPICH-1 versions return a three command answer for Fortran, consisting + # out of a symlink command for mpif.h, the actual compiler command and a deletion of the + # created symlink. We need to detect that case, remember the include path and drop the + # symlink/deletion operation to obtain the link/compile lines we'd usually expect. + if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h") + get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY) + string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") + string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") + string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") + string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") + endif() + endif() + + # The Intel MPI wrapper on Linux will emit some objcopy commands after its compile command + # if -static_mpi was passed to the wrapper. To avoid spurious matches, we need to drop these lines. + if(UNIX) + string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") + string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") + endif() + + # Extract compile options from the compile command line. + string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}") + + foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS) + string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}") + # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries + # themselves were built with this flag. However, this flag is unrelated to using MPI, and + # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore + # produce inconsistent results with the regularly flags. + # Similarly, aliasing flags do not belong into our flag array. + if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f(stack-protector|(no-|)strict-aliasing|PI[CE]|pi[ce])") + list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}") + endif() + endforeach() + + # Same deal, with the definitions. We also treat arguments passed to the preprocessor directly. + string(REGEX MATCHALL "(^| )(-Wp,|-Xpreprocessor |)[-/]D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}") + + foreach(_MPI_COMPILE_DEFINITION IN LISTS MPI_ALL_COMPILE_DEFINITIONS) + string(REGEX REPLACE "^ ?(-Wp,|-Xpreprocessor )?[-/]D" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") + string(REPLACE "\"" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") + if(NOT "${_MPI_COMPILE_DEFINITION}" MATCHES "^_FORTIFY_SOURCE.*") + list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${_MPI_COMPILE_DEFINITION}") + endif() + endforeach() + + # Extract include paths from compile command line + string(REGEX MATCHALL "(^| )[-/]I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") + + # If extracting failed to work, we'll try using -showme:incdirs. + if (NOT MPI_ALL_INCLUDE_PATHS) + _MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN) + if(MPI_INCDIRS_COMPILER_RETURN) + separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}") + endif() + endif() + + foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS) + string(REGEX REPLACE "^ ?[-/]I" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") + string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") + get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH) + list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}") + endforeach() + + # Extract linker paths from the link command line + string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker |)(-L|[/-]LIBPATH:|[/-]libpath:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") + + # If extracting failed to work, we'll try using -showme:libdirs. + if (NOT MPI_ALL_LINK_PATHS) + _MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN) + if(MPI_LIBDIRS_COMPILER_RETURN) + separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}") + endif() + endif() + + foreach(_MPI_LPATH IN LISTS MPI_ALL_LINK_PATHS) + string(REGEX REPLACE "^ ?(-Wl,|-Xlinker )?(-L|[/-]LIBPATH:|[/-]libpath:)" "" _MPI_LPATH "${_MPI_LPATH}") + string(REPLACE "\"" "" _MPI_LPATH "${_MPI_LPATH}") + get_filename_component(_MPI_LPATH "${_MPI_LPATH}" REALPATH) + list(APPEND MPI_LINK_DIRECTORIES_WORK "${_MPI_LPATH}") + endforeach() + + # Extract linker flags from the link command line + string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") + + foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS) + string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG) + # MPI might be marked to build with non-executable stacks but this should not propagate. + if (NOT "${_MPI_LINK_FLAG}" MATCHES "(-Wl,|-Xlinker )-z,noexecstack") + if (MPI_LINK_FLAGS_WORK) + string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}") + else() + set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}") + endif() + endif() + endforeach() + + # Extract the set of libraries to link against from the link command + # line + string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + + foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) + string(REGEX REPLACE "^ ?-l" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) + if(NOT "${_MPI_LIB_PATH}" STREQUAL "") + list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") + else() + list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") + endif() + endforeach() + + if(WIN32) + # A compiler wrapper on Windows will just have the name of the + # library to link on its link line, potentially with a full path + string(REGEX MATCHALL "(^| )([^\" ]+\\.lib|\"[^\"]+\\.lib\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) + string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) + if(NOT "${_MPI_LIB_PATH}" STREQUAL "") + list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") + else() + list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") + endif() + endforeach() + else() + # On UNIX platforms, archive libraries can be given with full path. + string(REGEX MATCHALL "(^| )([^\" ]+\\.a|\"[^\"]+\\.a\")" MPI_LIBFULLPATHS "${MPI_LINK_CMDLINE}") + foreach(_MPI_LIB_NAME IN LISTS MPI_LIBFULLPATHS) + string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) + if(NOT "${_MPI_LIB_PATH}" STREQUAL "") + list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") + else() + list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") + endif() + endforeach() + endif() + + # An MPI compiler wrapper could have its MPI libraries in the implictly + # linked directories of the compiler itself. + if(DEFINED CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) + list(APPEND MPI_LINK_DIRECTORIES_WORK "${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}") + endif() + + # Determine full path names for all of the libraries that one needs + # to link against in an MPI program + unset(MPI_PLAIN_LIB_NAMES_WORK) + foreach(_MPI_LIB_NAME IN LISTS MPI_LIB_NAMES_WORK) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_NAME}" NAME_WE) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${MPI_LINK_DIRECTORIES_WORK} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endforeach() + + # Deal with the libraries given with full path next + unset(MPI_DIRECT_LIB_NAMES_WORK) + foreach(_MPI_LIB_FULLPATH IN LISTS MPI_LIB_FULLPATHS_WORK) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME) + get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_FULLPATH}" DIRECTORY) + list(APPEND MPI_DIRECT_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_PATH} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endforeach() + if(MPI_DIRECT_LIB_NAMES_WORK) + set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}") + endif() + + # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to + # link it in that case. -lpthread is covered by the normal library treatment on the other hand. + if("${MPI_COMPILE_CMDLINE}" MATCHES "-pthread") + list(APPEND MPI_COMPILE_OPTIONS_WORK "-pthread") + if(MPI_LINK_FLAGS_WORK) + string(APPEND MPI_LINK_FLAGS_WORK " -pthread") + else() + set(MPI_LINK_FLAGS_WORK "-pthread") + endif() + endif() + + if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}") + endif() + if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}") + endif() + if(MPI_${LANG}_EXTRA_LIB_NAMES) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") + endif() + + # If we found MPI, set up all of the appropriate cache entries + if(NOT MPI_${LANG}_COMPILE_OPTIONS) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) + endif() + if(NOT MPI_${LANG}_COMPILE_DEFINITIONS) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_COMPILE_DEFINITIONS_WORK} CACHE STRING "MPI ${LANG} compilation definitions" FORCE) + endif() + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} additional include directories" FORCE) + endif() + if(NOT MPI_${LANG}_LINK_FLAGS) + set(MPI_${LANG}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${LANG} linker flags" FORCE) + endif() + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES ${MPI_PLAIN_LIB_NAMES_WORK} CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + set(MPI_${LANG}_WRAPPER_FOUND TRUE PARENT_SCOPE) +endfunction() + +function(_MPI_guess_settings LANG) + set(MPI_GUESS_FOUND FALSE) + # Currently only MSMPI and MPICH2 on Windows are supported, so we can skip this search if we're not targeting that. + if(WIN32) + # MSMPI + + # The environment variables MSMPI_INC and MSMPILIB32/64 are the only ways of locating the MSMPI_SDK, + # which is installed separately from the runtime. Thus it's possible to have mpiexec but not MPI headers + # or import libraries and vice versa. + if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MSMPI") + # We first attempt to locate the msmpi.lib. Should be find it, we'll assume that the MPI present is indeed + # Microsoft MPI. + if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB64}") + set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x64") + else() + set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB32}") + set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x86") + endif() + + find_library(MPI_msmpi_LIBRARY + NAMES msmpi + HINTS ${MPI_MSMPI_LIB_PATH} + DOC "Location of the msmpi library for Microsoft MPI") + mark_as_advanced(MPI_msmpi_LIBRARY) + + if(MPI_msmpi_LIBRARY) + # Next, we attempt to locate the MPI header. Note that for Fortran we know that mpif.h is a way + # MSMPI can be used and therefore that header has to be present. + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + get_filename_component(MPI_MSMPI_INC_DIR "$ENV{MSMPI_INC}" REALPATH) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MSMPI_INC_DIR}" CACHE STRING "MPI ${LANG} additional include directories" FORCE) + unset(MPI_MSMPI_INC_DIR) + endif() + + # For MSMPI, one can compile the MPI module by building the mpi.f90 shipped with the MSMPI SDK, + # thus it might be present or provided by the user. Figuring out which is supported is done later on. + # The PGI Fortran compiler for instance ships a prebuilt set of modules in its own include folder. + # Should a user be employing PGI or have built its own set and provided it via cache variables, the + # splitting routine would have located the module files. + + # For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran + # we need some extra library to glue Fortran support together: + # MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names + # ending with a c are using the cdecl calling convention, whereas those ending with an s are for Fortran + # implementations using stdcall. Therefore, the 64-bit MSMPI only ships those ending in 'c', whereas the 32-bit + # has both variants available. + # The second difference is the last but one letter, if it's an e(nd), the length of a string argument is + # passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed), + # it's passed immediately after the string address. + + # To summarize: + # - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention + # - msmpifmc: CHARACTER length passed directly after string address and using cdecl calling convention + # - msmpifes: CHARACTER length passed after the parameter list and using stdcall calling convention + # - msmpifms: CHARACTER length passed directly after string address and using stdcall calling convention + # 32-bit MSMPI ships all four libraries, 64-bit MSMPI ships only the first two. + + # As is, Intel Fortran and PGI Fortran both use the 'ec' variant of the calling convention, whereas + # the old Compaq Visual Fortran compiler defaulted to the 'ms' version. It's possible to make Intel Fortran + # use the CVF calling convention using /iface:cvf, but we assume - and this is also assumed in FortranCInterface - + # this isn't the case. It's also possible to make CVF use the 'ec' variant, using /iface=(cref,nomixed_str_len_arg). + + # Our strategy is now to locate all libraries, but enter msmpifec into the LIB_NAMES array. + # Should this not be adequate it's a straightforward way for a user to change the LIB_NAMES array and + # have his library found. Still, this should not be necessary outside of exceptional cases, as reasoned. + if ("${LANG}" STREQUAL "Fortran") + set(MPI_MSMPI_CALLINGCONVS c) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4) + list(APPEND MPI_MSMPI_CALLINGCONVS s) + endif() + foreach(mpistrlenpos IN ITEMS e m) + foreach(mpicallingconv IN LISTS MPI_MSMPI_CALLINGCONVS) + find_library(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY + NAMES msmpif${mpistrlenpos}${mpicallingconv} + HINTS "${MPI_MSMPI_LIB_PATH}" + DOC "Location of the msmpi${mpistrlenpos}${mpicallingconv} library for Microsoft MPI") + mark_as_advanced(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY) + endforeach() + endforeach() + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES "msmpi;msmpifec" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + + # At this point we're *not* done. MSMPI requires an additional include file for Fortran giving the value + # of MPI_AINT. This file is called mpifptr.h located in the x64 and x86 subfolders, respectively. + find_path(MPI_mpifptr_INCLUDE_DIR + NAMES "mpifptr.h" + HINTS "${MPI_MSMPI_INC_PATH_EXTRA}" + DOC "Location of the mpifptr.h extra header for Microsoft MPI") + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS "mpifptr" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) + endif() + mark_as_advanced(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS MPI_mpifptr_INCLUDE_DIR) + else() + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES "msmpi" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + endif() + mark_as_advanced(MPI_${LANG}_LIB_NAMES) + set(MPI_GUESS_FOUND TRUE) + endif() + endif() + + # At this point there's not many MPIs that we could still consider. + # OpenMPI 1.6.x and below supported Windows, but these ship compiler wrappers that still work. + # The only other relevant MPI implementation without a wrapper is MPICH2, which had Windows support in 1.4.1p1 and older. + if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2") + set(MPI_MPICH_PREFIX_PATHS + "$ENV{ProgramW6432}/MPICH2/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/../lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]/lib" + ) + + # All of C, C++ and Fortran will need mpi.lib, so we'll look for this first + find_library(MPI_mpi_LIBRARY + NAMES mpi + HINTS ${MPI_MPICH_PREFIX_PATHS}) + mark_as_advanced(MPI_mpi_LIBRARY) + # If we found mpi.lib, we detect the rest of MPICH2 + if(MPI_mpi_LIBRARY) + set(MPI_MPICH_LIB_NAMES "mpi") + # If MPI-2 C++ bindings are requested, we need to locate cxx.lib as well. + # Otherwise, MPICH_SKIP_MPICXX will be defined and these bindings aren't needed. + if("${LANG}" STREQUAL "CXX" AND NOT MPI_CXX_SKIP_MPICXX) + find_library(MPI_cxx_LIBRARY + NAMES cxx + HINTS ${MPI_MPICH_PREFIX_PATHS}) + mark_as_advanced(MPI_cxx_LIBRARY) + list(APPEND MPI_MPICH_LIB_NAMES "cxx") + # For Fortran, MPICH2 provides three different libraries: + # fmpich2.lib which uses uppercase symbols and cdecl, + # fmpich2s.lib which uses uppercase symbols and stdcall (32-bit only), + # fmpich2g.lib which uses lowercase symbols with double underscores and cdecl. + # fmpich2s.lib would be useful for Compaq Visual Fortran, fmpich2g.lib has to be used with GNU g77 and is also + # provided in the form of an .a archive for MinGW and Cygwin. From our perspective, fmpich2.lib is the only one + # we need to try, and if it doesn't work with the given Fortran compiler we'd find out later on during validation + elseif("${LANG}" STREQUAL "Fortran") + find_library(MPI_fmpich2_LIBRARY + NAMES fmpich2 + HINTS ${MPI_MPICH_PREFIX_PATHS}) + find_library(MPI_fmpich2s_LIBRARY + NAMES fmpich2s + HINTS ${MPI_MPICH_PREFIX_PATHS}) + find_library(MPI_fmpich2g_LIBRARY + NAMES fmpich2g + HINTS ${MPI_MPICH_PREFIX_PATHS}) + mark_as_advanced(MPI_fmpich2_LIBRARY MPI_fmpich2s_LIBRARY MPI_fmpich2g_LIBRARY) + list(APPEND MPI_MPICH_LIB_NAMES "fmpich2") + endif() + + if(NOT MPI_${LANG}_LIB_NAMES) + set(MPI_${LANG}_LIB_NAMES "${MPI_MPICH_LIB_NAMES}" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) + endif() + unset(MPI_MPICH_LIB_NAMES) + + if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + # For MPICH2, the include folder would be in ../include relative to the library folder. + get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_mpi_LIBRARY}" DIRECTORY) + get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_MPICH_ROOT_DIR}" DIRECTORY) + if(IS_DIRECTORY "${MPI_MPICH_ROOT_DIR}/include") + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MPICH_ROOT_DIR}/include" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) + endif() + unset(MPI_MPICH_ROOT_DIR) + endif() + set(MPI_GUESS_FOUND TRUE) + endif() + unset(MPI_MPICH_PREFIX_PATHS) + endif() + endif() + set(MPI_${LANG}_GUESS_FOUND "${MPI_GUESS_FOUND}" PARENT_SCOPE) +endfunction() + +function(_MPI_adjust_compile_definitions LANG) + if("${LANG}" STREQUAL "CXX") + # To disable the C++ bindings, we need to pass some definitions since the mpi.h header has to deal with both C and C++ + # bindings in MPI-2. + if(MPI_CXX_SKIP_MPICXX AND NOT MPI_${LANG}_COMPILE_DEFINITIONS MATCHES "SKIP_MPICXX") + # MPICH_SKIP_MPICXX is being used in MPICH and derivatives like MVAPICH or Intel MPI + # OMPI_SKIP_MPICXX is being used in Open MPI + # _MPICC_H is being used for IBM Platform MPI + list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX" "OMPI_SKIP_MPICXX" "_MPICC_H") + set(MPI_${LANG}_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}" CACHE STRING "MPI ${LANG} compilation definitions" FORCE) + endif() + endif() +endfunction() + +macro(_MPI_assemble_libraries LANG) + set(MPI_${LANG}_LIBRARIES "") + # Only for libraries do we need to check whether the compiler's linking stage is separate. + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT) + foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) + endforeach() + endif() +endmacro() + +macro(_MPI_assemble_include_dirs LANG) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_${LANG}_INCLUDE_DIRS "") + else() + set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") + if("${LANG}" MATCHES "(C|CXX)") + if(MPI_${LANG}_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + else() # Fortran + if(MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + endif() + if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + endif() + endif() + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}") + endforeach() + endif() + endif() +endmacro() + +function(_MPI_split_include_dirs LANG) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + return() + endif() + # Backwards compatibility: Search INCLUDE_PATH if given. + if(MPI_${LANG}_INCLUDE_PATH) + list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") + endif() + + # We try to find the headers/modules among those paths (and system paths) + # For C/C++, we just need to have a look for mpi.h. + if("${LANG}" MATCHES "(C|CXX)") + find_path(MPI_${LANG}_HEADER_DIR "mpi.h" + HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} + ) + mark_as_advanced(MPI_${LANG}_HEADER_DIR) + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + # Fortran is more complicated here: An implementation could provide + # any of the Fortran 77/90/2008 APIs for MPI. For example, MSMPI + # only provides Fortran 77 and - if mpi.f90 is built - potentially + # a Fortran 90 module. + elseif("${LANG}" STREQUAL "Fortran") + find_path(MPI_${LANG}_F77_HEADER_DIR "mpif.h" + HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} + ) + find_path(MPI_${LANG}_MODULE_DIR + NAMES "mpi.mod" "mpi_f08.mod" + HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} + ) + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS + "${MPI_${LANG}_F77_HEADER_DIR}" + "${MPI_${LANG}_MODULE_DIR}" + ) + endif() + mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) + endif() + # Remove duplicates and default system directories from the list. + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR}) + endforeach() + endif() + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) +endfunction() + +macro(_MPI_create_imported_target LANG) + if(NOT TARGET MPI::MPI_${LANG}) + add_library(MPI::MPI_${LANG} INTERFACE IMPORTED) + endif() + + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}") + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}") + + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "") + if(MPI_${LANG}_LINK_FLAGS) + set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LINK_FLAGS}") + endif() + # If the compiler links MPI implicitly, no libraries will be found as they're contained within + # CMAKE__IMPLICIT_LINK_LIBRARIES already. + if(MPI_${LANG}_LIBRARIES) + set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}") + endif() + # Given the new design of FindMPI, INCLUDE_DIRS will always be located, even under implicit linking. + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}") +endmacro() + +function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY) + set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI") + set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/FindMPI") + set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin") + unset(MPI_TEST_COMPILE_DEFINITIONS) + if("${LANG}" STREQUAL "Fortran") + if("${MODE}" STREQUAL "F90_MODULE") + set(MPI_Fortran_INCLUDE_LINE "use mpi\n implicit none") + elseif("${MODE}" STREQUAL "F08_MODULE") + set(MPI_Fortran_INCLUDE_LINE "use mpi_f08\n implicit none") + else() # F77 header + set(MPI_Fortran_INCLUDE_LINE "implicit none\n include 'mpif.h'") + endif() + configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.f90.in" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90" @ONLY) + set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90") + elseif("${LANG}" STREQUAL "CXX") + configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.c" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp" COPYONLY) + set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp") + if("${MODE}" STREQUAL "TEST_MPICXX") + set(MPI_TEST_COMPILE_DEFINITIONS TEST_MPI_MPICXX) + endif() + else() # C + set(MPI_TEST_SOURCE_FILE "${SRC_DIR}/${MPI_TEST_FILE_NAME}.c") + endif() + if(RUN_BINARY) + try_run(MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} + "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" + COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} + LINK_LIBRARIES MPI::MPI_${LANG} + RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}) + set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE) + else() + try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} + "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" + COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} + LINK_LIBRARIES MPI::MPI_${LANG} + COPY_FILE "${BIN_FILE}") + endif() +endfunction() + +macro(_MPI_check_lang_works LANG) + # For Fortran we may have by the MPI-3 standard an implementation that provides: + # - the mpi_f08 module + # - *both*, the mpi module and 'mpif.h' + # Since older MPI standards (MPI-1) did not define anything but 'mpif.h', we need to check all three individually. + if( NOT MPI_${LANG}_WORKS ) + if("${LANG}" STREQUAL "Fortran") + set(MPI_Fortran_INTEGER_LINE "(kind=MPI_INTEGER_KIND)") + _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE) + _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE) + _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE) + + set(MPI_${LANG}_WORKS FALSE) + + foreach(mpimethod IN ITEMS F77_HEADER F08_MODULE F90_MODULE) + if(MPI_RESULT_${LANG}_test_mpi_${mpimethod}) + set(MPI_${LANG}_WORKS TRUE) + set(MPI_${LANG}_HAVE_${mpimethod} TRUE) + else() + set(MPI_${LANG}_HAVE_${mpimethod} FALSE) + endif() + endforeach() + # MPI-1 versions had no MPI_INTGER_KIND defined, so we need to try without it. + # However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header. + unset(MPI_Fortran_INTEGER_LINE) + if(NOT MPI_${LANG}_WORKS) + _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE) + if(MPI_RESULT_${LANG}_test_mpi_F77_HEADER_NOKIND) + set(MPI_${LANG}_WORKS TRUE) + set(MPI_${LANG}_HAVE_F77_HEADER TRUE) + endif() + endif() + else() + _MPI_try_staged_settings(${LANG} test_mpi normal FALSE) + # If 'test_mpi' built correctly, we've found valid MPI settings. There might not be MPI-2 C++ support, but there can't + # be MPI-2 C++ support without the C bindings being present, so checking for them is sufficient. + set(MPI_${LANG}_WORKS "${MPI_RESULT_${LANG}_test_mpi_normal}") + endif() + endif() +endmacro() + +# Some systems install various MPI implementations in separate folders in some MPI prefix +# This macro enumerates all such subfolders and adds them to the list of hints that will be searched. +macro(MPI_search_mpi_prefix_folder PREFIX_FOLDER) + if(EXISTS "${PREFIX_FOLDER}") + file(GLOB _MPI_folder_children RELATIVE "${PREFIX_FOLDER}" "${PREFIX_FOLDER}/*") + foreach(_MPI_folder_child IN LISTS _MPI_folder_children) + if(IS_DIRECTORY "${PREFIX_FOLDER}/${_MPI_folder_child}") + list(APPEND MPI_HINT_DIRS "${PREFIX_FOLDER}/${_MPI_folder_child}") + endif() + endforeach() + endif() +endmacro() + +set(MPI_HINT_DIRS ${MPI_HOME} $ENV{MPI_ROOT} $ENV{MPI_HOME} $ENV{I_MPI_ROOT}) +if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux") + # SUSE Linux Enterprise Server stores its MPI implementations under /usr/lib64/mpi/gcc/ + # We enumerate the subfolders and append each as a prefix + MPI_search_mpi_prefix_folder("/usr/lib64/mpi/gcc") +elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") + # MSMPI stores its runtime in a special folder, this adds the possible locations to the hints. + list(APPEND MPI_HINT_DIRS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]") +elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") + # FreeBSD ships mpich under the normal system paths - but available openmpi implementations + # will be found in /usr/local/mpi/ + MPI_search_mpi_prefix_folder("/usr/local/mpi") +endif() + +# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. +# The MPI standard does not mandate the existence of either, but instead only makes requirements if a distribution +# ships an mpiexec program (mpirun executables are not regulated by the standard). +find_program(MPIEXEC_EXECUTABLE + NAMES ${_MPIEXEC_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${MPI_HINT_DIRS} + DOC "Executable for running MPI programs.") + +# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin). +# This gives us a fairly reliable base directory to search for /bin /lib and /include from. +get_filename_component(_MPI_BASE_DIR "${MPIEXEC_EXECUTABLE}" PATH) +get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) + +# According to the MPI standard, section 8.8 -n is a guaranteed, and the only guaranteed way to +# launch an MPI process using mpiexec if such a program exists. +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for mpiexec; the next option will be the number of processes.") +set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by mpiexec.") +set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will be placed after all flags passed to mpiexec.") + +# Set the number of processes to the physical processor count +cmake_host_system_information(RESULT _MPIEXEC_NUMPROCS QUERY NUMBER_OF_PHYSICAL_CORES) +set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.") +unset(_MPIEXEC_NUMPROCS) +mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS) + +#============================================================================= +# Backward compatibility input hacks. Propagate the FindMPI hints to C and +# CXX if the respective new versions are not defined. Translate the old +# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${LANG}_LIBRARIES. +# +# Once we find the new variables, we translate them back into their old +# equivalents below. +if(NOT MPI_IGNORE_LEGACY_VARIABLES) + foreach (LANG IN ITEMS C CXX) + # Old input variables. + set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) + + # Set new vars based on their old equivalents, if the new versions are not already set. + foreach (var ${_MPI_OLD_INPUT_VARS}) + if (NOT MPI_${LANG}_${var} AND MPI_${var}) + set(MPI_${LANG}_${var} "${MPI_${var}}") + endif() + endforeach() + + # Chop the old compile flags into options and definitions + + unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + if(MPI_${LANG}_COMPILE_FLAGS) + separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") + foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) + if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") + list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") + else() + list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}") + endif() + endforeach() + unset(MPI_SEPARATE_FLAGS) + endif() + + # If a list of libraries was given, we'll split it into new-style cache variables + unset(MPI_${LANG}_EXTRA_LIB_NAMES) + if(NOT MPI_${LANG}_LIB_NAMES) + foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) + if(_MPI_LIB) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) + get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) + list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endif() + endforeach() + endif() + endforeach() +endif() +#============================================================================= + +unset(MPI_VERSION) +unset(MPI_VERSION_MAJOR) +unset(MPI_VERSION_MINOR) + +unset(_MPI_MIN_VERSION) + +# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. +if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) + set(MPI_SKIP_COMPILER_WRAPPER TRUE) +endif() + +# This loop finds the compilers and sends them off for interrogation. +foreach(LANG IN ITEMS C CXX Fortran) + if(CMAKE_${LANG}_COMPILER_LOADED) + if(NOT MPI_FIND_COMPONENTS) + set(_MPI_FIND_${LANG} TRUE) + elseif( ${LANG} IN_LIST MPI_FIND_COMPONENTS) + set(_MPI_FIND_${LANG} TRUE) + elseif( ${LANG} STREQUAL CXX AND NOT MPI_CXX_SKIP_MPICXX AND MPICXX IN_LIST MPI_FIND_COMPONENTS ) + set(_MPI_FIND_${LANG} TRUE) + else() + set(_MPI_FIND_${LANG} FALSE) + endif() + else() + set(_MPI_FIND_${LANG} FALSE) + endif() + if(_MPI_FIND_${LANG}) + if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS ) + set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.") + mark_as_advanced(MPI_CXX_SKIP_MPICXX) + endif() + if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) + set(MPI_${LANG}_TRIED_IMPLICIT FALSE) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) + if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) + # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. + # Cray PrgEnv. + _MPI_create_imported_target(${LANG}) + _MPI_check_lang_works(${LANG}) + + # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. + if(MPI_${LANG}_WORKS) + set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) + endif() + set(MPI_${LANG}_TRIED_IMPLICIT TRUE) + endif() + + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WRAPPER_FOUND FALSE) + set(MPI_PINNED_COMPILER FALSE) + + if(NOT MPI_SKIP_COMPILER_WRAPPER) + if(MPI_${LANG}_COMPILER) + # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. + if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") + # Get rid of our default list of names and just search for the name the user wants. + set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") + unset(MPI_${LANG}_COMPILER CACHE) + endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(MPI_PINNED_COMPILER TRUE) + endif() + + # If we have an MPI base directory, we'll try all compiler names in that one first. + # This should prevent mixing different MPI environments + if(_MPI_BASE_DIR) + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${_MPI_BASE_DIR} + NO_DEFAULT_PATH + DOC "MPI compiler for ${LANG}" + ) + endif() + + # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), + # we shall try searching in the default paths. + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + DOC "MPI compiler for ${LANG}" + ) + + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_PINNED_COMPILER TRUE) + + # If we haven't made the implicit compiler test yet, perform it now. + if(NOT MPI_${LANG}_TRIED_IMPLICIT) + _MPI_create_imported_target(${LANG}) + _MPI_check_lang_works(${LANG}) + endif() + + # Should the MPI compiler not work implicitly for MPI, still interrogate it. + # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used + # directly during linkage instead of CMAKE__COMPILER will not work. + if(NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) + _MPI_interrogate_compiler(${LANG}) + else() + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) + endif() + elseif(MPI_${LANG}_COMPILER) + _MPI_interrogate_compiler(${LANG}) + endif() + endif() + + if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) + # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the + # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. + if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) + set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) + else() + _MPI_guess_settings(${LANG}) + endif() + endif() + endif() + endif() + + _MPI_split_include_dirs(${LANG}) + _MPI_assemble_include_dirs(${LANG}) + _MPI_assemble_libraries(${LANG}) + + _MPI_adjust_compile_definitions(${LANG}) + # We always create imported targets even if they're empty + _MPI_create_imported_target(${LANG}) + + if(NOT MPI_${LANG}_WORKS) + _MPI_check_lang_works(${LANG}) + endif() + + # Next, we'll initialize the MPI variables that have not been previously set. + set(MPI_${LANG}_COMPILE_OPTIONS "" CACHE STRING "MPI ${LANG} compilation flags" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) + if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + endif() + mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS + MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) + + # If we've found MPI, then we'll perform additional analysis: Determine the MPI version, MPI library version, supported + # MPI APIs (i.e. MPI-2 C++ bindings). For Fortran we also need to find specific parameters if we're under MPI-3. + if(MPI_${LANG}_WORKS) + if("${LANG}" STREQUAL "CXX" AND NOT DEFINED MPI_MPICXX_FOUND) + if(NOT MPI_CXX_SKIP_MPICXX AND NOT MPI_CXX_VALIDATE_SKIP_MPICXX) + _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE) + if(MPI_RESULT_${LANG}_test_mpi_MPICXX) + set(MPI_MPICXX_FOUND TRUE) + else() + set(MPI_MPICXX_FOUND FALSE) + endif() + else() + set(MPI_MPICXX_FOUND FALSE) + endif() + endif() + + # At this point, we know the bindings present but not the MPI version or anything else. + if(NOT DEFINED MPI_${LANG}_VERSION) + unset(MPI_${LANG}_VERSION_MAJOR) + unset(MPI_${LANG}_VERSION_MINOR) + endif() + set(MPI_BIN_FOLDER ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI) + + # For Fortran, we'll want to use the most modern MPI binding to test capabilities other than the + # Fortran parameters, since those depend on the method of consumption. + # For C++, we can always use the C bindings, and should do so, since the C++ bindings do not exist in MPI-3 + # whereas the C bindings do, and the C++ bindings never offered any feature advantage over their C counterparts. + if("${LANG}" STREQUAL "Fortran") + if(MPI_${LANG}_HAVE_F08_MODULE) + set(MPI_${LANG}_HIGHEST_METHOD F08_MODULE) + elseif(MPI_${LANG}_HAVE_F90_MODULE) + set(MPI_${LANG}_HIGHEST_METHOD F90_MODULE) + else() + set(MPI_${LANG}_HIGHEST_METHOD F77_HEADER) + endif() + + # Another difference between C and Fortran is that we can't use the preprocessor to determine whether MPI_VERSION + # and MPI_SUBVERSION are provided. These defines did not exist in MPI 1.0 and 1.1 and therefore might not + # exist. For C/C++, test_mpi.c will handle the MPI_VERSION extraction, but for Fortran, we need mpiver.f90. + if(NOT DEFINED MPI_${LANG}_VERSION) + _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE) + if(MPI_RESULT_${LANG}_mpiver_${MPI_${LANG}_HIGHEST_METHOD}) + file(STRINGS ${MPI_BIN_FOLDER}/mpiver_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") + if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") + set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") + set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") + endif() + endif() + endif() + + # Finally, we want to find out which capabilities a given interface supports, compare the MPI-3 standard. + # This is determined by interface specific parameters MPI_SUBARRAYS_SUPPORTED and MPI_ASYNC_PROTECTS_NONBLOCKING + # and might vary between the different methods of consumption. + if(MPI_DETERMINE_Fortran_CAPABILITIES AND NOT MPI_Fortran_CAPABILITIES_DETERMINED) + foreach(mpimethod IN ITEMS F08_MODULE F90_MODULE F77_HEADER) + if(MPI_${LANG}_HAVE_${mpimethod}) + set(MPI_${LANG}_${mpimethod}_SUBARRAYS FALSE) + set(MPI_${LANG}_${mpimethod}_ASYNCPROT FALSE) + _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE) + if(MPI_RESULT_${LANG}_fortranparam_mpi_${mpimethod} AND + NOT "${MPI_RUN_RESULT_${LANG}_fortranparam_mpi_${mpimethod}}" STREQUAL "FAILED_TO_RUN") + if("${MPI_RUN_OUTPUT_${LANG}_fortranparam_mpi_${mpimethod}}" MATCHES + ".*INFO:SUBARRAYS\\[ *([TF]) *\\]-ASYNCPROT\\[ *([TF]) *\\].*") + if("${CMAKE_MATCH_1}" STREQUAL "T") + set(MPI_${LANG}_${mpimethod}_SUBARRAYS TRUE) + endif() + if("${CMAKE_MATCH_2}" STREQUAL "T") + set(MPI_${LANG}_${mpimethod}_ASYNCPROT TRUE) + endif() + endif() + endif() + endif() + endforeach() + set(MPI_Fortran_CAPABILITIES_DETERMINED TRUE) + endif() + else() + set(MPI_${LANG}_HIGHEST_METHOD normal) + + # By the MPI-2 standard, MPI_VERSION and MPI_SUBVERSION are valid for both C and C++ bindings. + if(NOT DEFINED MPI_${LANG}_VERSION) + file(STRINGS ${MPI_BIN_FOLDER}/test_mpi_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") + if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") + set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") + set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") + endif() + endif() + endif() + + unset(MPI_BIN_FOLDER) + + # At this point, we have dealt with determining the MPI version and parameters for each Fortran method available. + # The one remaining issue is to determine which MPI library is installed. + # Determining the version and vendor of the MPI library is only possible via MPI_Get_library_version() at runtime, + # and therefore we cannot do this while cross-compiling (a user may still define MPI__LIBRARY_VERSION_STRING + # themselves and we'll attempt splitting it, which is equivalent to provide the try_run output). + # It's also worth noting that the installed version string can depend on the language, or on the system the binary + # runs on if MPI is not statically linked. + if(MPI_DETERMINE_LIBRARY_VERSION AND NOT MPI_${LANG}_LIBRARY_VERSION_STRING) + _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE) + if(MPI_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD} AND + "${MPI_RUN_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" EQUAL "0") + string(STRIP "${MPI_RUN_OUTPUT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" + MPI_${LANG}_LIBRARY_VERSION_STRING) + else() + set(MPI_${LANG}_LIBRARY_VERSION_STRING "NOTFOUND") + endif() + endif() + endif() + + set(MPI_${LANG}_FIND_QUIETLY ${MPI_FIND_QUIETLY}) + set(MPI_${LANG}_FIND_VERSION ${MPI_FIND_VERSION}) + set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) + + unset(MPI_${LANG}_REQUIRED_VARS) + if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") + endforeach() + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_LIB_NAMES") + if("${LANG}" STREQUAL "Fortran") + # For Fortran we only need one of the module or header directories to have *some* support for MPI. + if(NOT MPI_${LANG}_MODULE_DIR) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_F77_HEADER_DIR") + endif() + if(NOT MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_MODULE_DIR") + endif() + else() + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_HEADER_DIR") + endif() + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(mpiincvar IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpiincvar}_INCLUDE_DIR") + endforeach() + endif() + # Append the works variable now. If the settings did not work, this will show up properly. + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") + else() + # If the compiler worked implicitly, use its path as output. + # Should the compiler variable be set, we also require it to work. + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_COMPILER") + if(MPI_${LANG}_COMPILER) + list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") + endif() + endif() + find_package_handle_standard_args(MPI_${LANG} REQUIRED_VARS ${MPI_${LANG}_REQUIRED_VARS} + VERSION_VAR MPI_${LANG}_VERSION) + + if(DEFINED MPI_${LANG}_VERSION) + if(NOT _MPI_MIN_VERSION OR _MPI_MIN_VERSION VERSION_GREATER MPI_${LANG}_VERSION) + set(_MPI_MIN_VERSION MPI_${LANG}_VERSION) + endif() + endif() + endif() +endforeach() + +unset(_MPI_REQ_VARS) +foreach(LANG IN ITEMS C CXX Fortran) + if((NOT MPI_FIND_COMPONENTS AND CMAKE_${LANG}_COMPILER_LOADED) OR LANG IN_LIST MPI_FIND_COMPONENTS) + list(APPEND _MPI_REQ_VARS "MPI_${LANG}_FOUND") + endif() +endforeach() + +if(MPICXX IN_LIST MPI_FIND_COMPONENTS) + list(APPEND _MPI_REQ_VARS "MPI_MPICXX_FOUND") +endif() + +find_package_handle_standard_args(MPI + REQUIRED_VARS ${_MPI_REQ_VARS} + VERSION_VAR ${_MPI_MIN_VERSION} + HANDLE_COMPONENTS) + +#============================================================================= +# More backward compatibility stuff + +# For compatibility reasons, we also define MPIEXEC +set(MPIEXEC "${MPIEXEC_EXECUTABLE}") + +# Copy over MPI__INCLUDE_PATH from the assembled INCLUDE_DIRS. +foreach(LANG IN ITEMS C CXX Fortran) + if(MPI_${LANG}_FOUND) + set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}") + unset(MPI_${LANG}_COMPILE_FLAGS) + if(MPI_${LANG}_COMPILE_OPTIONS) + set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}") + endif() + if(MPI_${LANG}_COMPILE_DEFINITIONS) + foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS) + string(APPEND MPI_${LANG}_COMPILE_FLAGS " -D${_MPI_DEF}") + endforeach() + endif() + endif() +endforeach() + +# Bare MPI sans ${LANG} vars are set to CXX then C, depending on what was found. +# This mimics the behavior of the old language-oblivious FindMPI. +set(_MPI_OLD_VARS COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES) +if (MPI_CXX_FOUND) + foreach (var ${_MPI_OLD_VARS}) + set(MPI_${var} ${MPI_CXX_${var}}) + endforeach() +elseif (MPI_C_FOUND) + foreach (var ${_MPI_OLD_VARS}) + set(MPI_${var} ${MPI_C_${var}}) + endforeach() +endif() + +# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache. +if (MPI_LIBRARIES) + list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK) + set(MPI_LIBRARY "${MPI_LIBRARY_WORK}") + unset(MPI_LIBRARY_WORK) +else() + set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND") +endif() + +list(LENGTH MPI_LIBRARIES MPI_NUMLIBS) +if (MPI_NUMLIBS GREATER 1) + set(MPI_EXTRA_LIBRARY_WORK "${MPI_LIBRARIES}") + list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0) + set(MPI_EXTRA_LIBRARY "${MPI_EXTRA_LIBRARY_WORK}") + unset(MPI_EXTRA_LIBRARY_WORK) +else() + set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") +endif() +set(MPI_IGNORE_LEGACY_VARIABLES TRUE) +#============================================================================= + +# unset these vars to cleanup namespace +unset(_MPI_OLD_VARS) +unset(_MPI_PREFIX_PATH) +unset(_MPI_BASE_DIR) +foreach (lang C CXX Fortran) + unset(_MPI_${LANG}_COMPILER_NAMES) +endforeach() + +cmake_policy(POP) diff --git a/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in new file mode 100644 index 000000000..30f912c62 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in @@ -0,0 +1,4 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + print *, 'INFO:SUBARRAYS[', MPI_SUBARRAYS_SUPPORTED, ']-ASYNCPROT[', MPI_ASYNC_PROTECTS_NONBLOCKING, ']' + end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/libver_mpi.c b/cmake/Modules/NewCMake/FindMPI/libver_mpi.c new file mode 100644 index 000000000..be9d19d43 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/libver_mpi.c @@ -0,0 +1,19 @@ +#include + +#ifdef __cplusplus +#include +#else +#include +#endif + +int main(int argc, char* argv[]) +{ + char mpilibver_str[MPI_MAX_LIBRARY_VERSION_STRING]; + int mpilibver_len; + MPI_Get_library_version(mpilibver_str, &mpilibver_len); +#ifdef __cplusplus + std::puts(mpilibver_str); +#else + puts(mpilibver_str); +#endif +} diff --git a/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in new file mode 100644 index 000000000..793858716 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in @@ -0,0 +1,7 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpilibver_str + integer(kind=MPI_INTEGER_KIND) :: ierror, reslen + call MPI_GET_LIBRARY_VERSION(mpilibver_str, reslen, ierror) + print *, mpilibver_str + end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in b/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in new file mode 100644 index 000000000..a25452385 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in @@ -0,0 +1,10 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + integer(kind=kind(MPI_VERSION)), parameter :: zero = ichar('0') + character, dimension(17), parameter :: mpiver_str =& + (/ 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', '-', 'V', 'E', 'R', '[', & + char(zero + MPI_VERSION), & + '.', & + char(zero + MPI_SUBVERSION), ']' /) + print *, mpiver_str + end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/test_mpi.c b/cmake/Modules/NewCMake/FindMPI/test_mpi.c new file mode 100644 index 000000000..b8a308a4b --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/test_mpi.c @@ -0,0 +1,37 @@ +#include + +#ifdef __cplusplus +#include +#else +#include +#endif + +#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) +const char mpiver_str[] = { 'I', 'N', + 'F', 'O', + ':', 'M', + 'P', 'I', + '-', 'V', + 'E', 'R', + '[', ('0' + MPI_VERSION), + '.', ('0' + MPI_SUBVERSION), + ']', '\0' }; +#endif + +int main(int argc, char* argv[]) +{ +#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) +#ifdef __cplusplus + std::puts(mpiver_str); +#else + puts(mpiver_str); +#endif +#endif +#ifdef TEST_MPI_MPICXX + MPI::MPI_Init(&argc, &argv); + MPI::MPI_Finalize(); +#else + MPI_Init(&argc, &argv); + MPI_Finalize(); +#endif +} diff --git a/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in new file mode 100644 index 000000000..4d43a04d6 --- /dev/null +++ b/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in @@ -0,0 +1,6 @@ + program hello + @MPI_Fortran_INCLUDE_LINE@ + integer@MPI_Fortran_INTEGER_LINE@ ierror + call MPI_INIT(ierror) + call MPI_FINALIZE(ierror) + end program diff --git a/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake b/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake new file mode 100644 index 000000000..67f6bd6f2 --- /dev/null +++ b/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,386 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPackageHandleStandardArgs +----------------------------- + +This module provides a function intended to be used in :ref:`Find Modules` +implementing :command:`find_package()` calls. It handles the +``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. +It also sets the ``_FOUND`` variable. The package is +considered found if all variables listed contain valid results, e.g. +valid filepaths. + +.. command:: find_package_handle_standard_args + + There are two signatures:: + + find_package_handle_standard_args( + (DEFAULT_MSG|) + ... + ) + + find_package_handle_standard_args( + [FOUND_VAR ] + [REQUIRED_VARS ...] + [VERSION_VAR ] + [HANDLE_COMPONENTS] + [CONFIG_MODE] + [FAIL_MESSAGE ] + ) + + The ``_FOUND`` variable will be set to ``TRUE`` if all + the variables ``...`` are valid and any optional + constraints are satisfied, and ``FALSE`` otherwise. A success or + failure message may be displayed based on the results and on + whether the ``REQUIRED`` and/or ``QUIET`` option was given to + the :command:`find_package` call. + + The options are: + + ``(DEFAULT_MSG|)`` + In the simple signature this specifies the failure message. + Use ``DEFAULT_MSG`` to ask for a default message to be computed + (recommended). Not valid in the full signature. + + ``FOUND_VAR `` + Obsolete. Specifies either ``_FOUND`` or + ``_FOUND`` as the result variable. This exists only + for compatibility with older versions of CMake and is now ignored. + Result variables of both names are always set for compatibility. + + ``REQUIRED_VARS ...`` + Specify the variables which are required for this package. + These may be named in the generated failure message asking the + user to set the missing variable values. Therefore these should + typically be cache entries such as ``FOO_LIBRARY`` and not output + variables like ``FOO_LIBRARIES``. + + ``VERSION_VAR `` + Specify the name of a variable that holds the version of the package + that has been found. This version will be checked against the + (potentially) specified required version given to the + :command:`find_package` call, including its ``EXACT`` option. + The default messages include information about the required + version and the version which has been actually found, both + if the version is ok or not. + + ``HANDLE_COMPONENTS`` + Enable handling of package components. In this case, the command + will report which components have been found and which are missing, + and the ``_FOUND`` variable will be set to ``FALSE`` + if any of the required components (i.e. not the ones listed after + the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are + missing. + + ``CONFIG_MODE`` + Specify that the calling find module is a wrapper around a + call to ``find_package( NO_MODULE)``. This implies + a ``VERSION_VAR`` value of ``_VERSION``. The command + will automatically check whether the package configuration file + was found. + + ``FAIL_MESSAGE `` + Specify a custom failure message instead of using the default + generated message. Not recommended. + +Example for the simple signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibXml2 DEFAULT_MSG + LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) + +The ``LibXml2`` package is considered to be found if both +``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. +Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found +and ``REQUIRED`` was used, it fails with a +:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was +used or not. If it is found, success will be reported, including +the content of the first ````. On repeated CMake runs, +the same message will not be printed again. + +Example for the full signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibArchive + REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR + VERSION_VAR LibArchive_VERSION) + +In this case, the ``LibArchive`` package is considered to be found if +both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. +Also the version of ``LibArchive`` will be checked by using the version +contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, +the default messages will be printed. + +Another example for the full signature: + +.. code-block:: cmake + + find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) + find_package_handle_standard_args(Automoc4 CONFIG_MODE) + +In this case, a ``FindAutmoc4.cmake`` module wraps a call to +``find_package(Automoc4 NO_MODULE)`` and adds an additional search +directory for ``automoc4``. Then the call to +``find_package_handle_standard_args`` produces a proper success/failure +message. +#]=======================================================================] + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) + +# internal helper macro +macro(_FPHSA_FAILURE_MESSAGE _msg) + if (${_NAME}_FIND_REQUIRED) + message(FATAL_ERROR "${_msg}") + else () + if (NOT ${_NAME}_FIND_QUIETLY) + message(STATUS "${_msg}") + endif () + endif () +endmacro() + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + if(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + else() + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + if(${_NAME}_CONSIDERED_CONFIGS) + set(configsText "") + list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + math(EXPR configsCount "${configsCount} - 1") + foreach(currentConfigIndex RANGE ${configsCount}) + list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + string(APPEND configsText " ${filename} (version ${version})\n") + endforeach() + if (${_NAME}_NOT_FOUND_MESSAGE) + string(APPEND configsText " Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") + endif() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") + + else() + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + endif() + endif() +endmacro() + + +function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + +# Set up the arguments for `cmake_parse_arguments`. + set(options CONFIG_MODE HANDLE_COMPONENTS) + set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) + set(multiValueArgs REQUIRED_VARS) + +# Check whether we are in 'simple' or 'extended' mode: + set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + if(${INDEX} EQUAL -1) + set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + set(FPHSA_REQUIRED_VARS ${ARGN}) + set(FPHSA_VERSION_VAR) + else() + cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) + + if(FPHSA_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT FPHSA_FAIL_MESSAGE) + set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + endif() + + # In config-mode, we rely on the variable _CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + if(FPHSA_CONFIG_MODE) + list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + set(FPHSA_VERSION_VAR ${_NAME}_VERSION) + endif() + + if(NOT FPHSA_REQUIRED_VARS) + message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + endif() + endif() + +# now that we collected all arguments, process them + + if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") + set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + endif() + + list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + + string(TOUPPER ${_NAME} _NAME_UPPER) + string(TOLOWER ${_NAME} _NAME_LOWER) + + if(FPHSA_FOUND_VAR) + if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") + set(_FOUND_VAR ${FPHSA_FOUND_VAR}) + else() + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") + endif() + else() + set(_FOUND_VAR ${_NAME_UPPER}_FOUND) + endif() + + # collect all variables which were not found, so they can be printed, so the + # user knows better what went wrong (#6375) + set(MISSING_VARS "") + set(DETAILS "") + # check if all passed variables are valid + set(FPHSA_FOUND_${_NAME} TRUE) + foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) + if(NOT ${_CURRENT_VAR}) + set(FPHSA_FOUND_${_NAME} FALSE) + string(APPEND MISSING_VARS " ${_CURRENT_VAR}") + else() + string(APPEND DETAILS "[${${_CURRENT_VAR}}]") + endif() + endforeach() + if(FPHSA_FOUND_${_NAME}) + set(${_NAME}_FOUND TRUE) + set(${_NAME_UPPER}_FOUND TRUE) + else() + set(${_NAME}_FOUND FALSE) + set(${_NAME_UPPER}_FOUND FALSE) + endif() + + # component handling + unset(FOUND_COMPONENTS_MSG) + unset(MISSING_COMPONENTS_MSG) + + if(FPHSA_HANDLE_COMPONENTS) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(${_NAME}_${comp}_FOUND) + + if(NOT DEFINED FOUND_COMPONENTS_MSG) + set(FOUND_COMPONENTS_MSG "found components: ") + endif() + string(APPEND FOUND_COMPONENTS_MSG " ${comp}") + + else() + + if(NOT DEFINED MISSING_COMPONENTS_MSG) + set(MISSING_COMPONENTS_MSG "missing components: ") + endif() + string(APPEND MISSING_COMPONENTS_MSG " ${comp}") + + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + string(APPEND MISSING_VARS " ${comp}") + endif() + + endif() + endforeach() + set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") + string(APPEND DETAILS "[c${COMPONENT_MSG}]") + endif() + + # version handling: + set(VERSION_MSG "") + set(VERSION_OK TRUE) + + # check with DEFINED here as the requested or found version may be "0" + if (DEFINED ${_NAME}_FIND_VERSION) + if(DEFINED ${FPHSA_VERSION_VAR}) + set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}}) + + if(${_NAME}_FIND_VERSION_EXACT) # exact version required + # count the dots in the version string + string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}") + # add one dot because there is one dot more than there are components + string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) + if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) + # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT + # is at most 4 here. Therefore a simple lookup table is used. + if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) + set(_VERSION_REGEX "[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) + set(_VERSION_REGEX "[^.]*\\.[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") + else () + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") + endif () + string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}") + unset(_VERSION_REGEX) + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") + endif () + unset(_VERSION_HEAD) + else () + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") + endif () + endif () + unset(_VERSION_DOTS) + + else() # minimum version specified: + if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") + endif () + endif() + + else() + + # if the package was not found, but a version was given, add that to the output: + if(${_NAME}_FIND_VERSION_EXACT) + set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") + else() + set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") + endif() + + endif() + else () + # Check with DEFINED as the found version may be 0. + if(DEFINED ${FPHSA_VERSION_VAR}) + set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")") + endif() + endif () + + if(VERSION_OK) + string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]") + else() + set(${_NAME}_FOUND FALSE) + endif() + + + # print the result: + if (${_NAME}_FOUND) + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") + else () + + if(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + else() + if(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + else() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}") + endif() + endif() + + endif () + + set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) + set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) +endfunction() diff --git a/cmake/Modules/NewCMake/FindPackageMessage.cmake b/cmake/Modules/NewCMake/FindPackageMessage.cmake new file mode 100644 index 000000000..6821cee4f --- /dev/null +++ b/cmake/Modules/NewCMake/FindPackageMessage.cmake @@ -0,0 +1,47 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindPackageMessage +# ------------------ +# +# +# +# FIND_PACKAGE_MESSAGE( "message for user" "find result details") +# +# This macro is intended to be used in FindXXX.cmake modules files. It +# will print a message once for each unique find result. This is useful +# for telling the user where a package was found. The first argument +# specifies the name (XXX) of the package. The second argument +# specifies the message to display. The third argument lists details +# about the find result so that if they change the message will be +# displayed again. The macro also obeys the QUIET argument to the +# find_package command. +# +# Example: +# +# :: +# +# if(X11_FOUND) +# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" +# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") +# else() +# ... +# endif() + +function(FIND_PACKAGE_MESSAGE pkg msg details) + # Avoid printing a message repeatedly for the same find result. + if(NOT ${pkg}_FIND_QUIETLY) + string(REPLACE "\n" "" details "${details}") + set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) + if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") + # The message has not yet been printed. + message(STATUS "${msg}") + + # Save the find details in the cache to avoid printing the same + # message again. + set("${DETAILS_VAR}" "${details}" + CACHE INTERNAL "Details about finding ${pkg}") + endif() + endif() +endfunction() diff --git a/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake b/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake new file mode 100644 index 000000000..dce6f9926 --- /dev/null +++ b/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake @@ -0,0 +1,70 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# SelectLibraryConfigurations +# --------------------------- +# +# +# +# select_library_configurations( basename ) +# +# This macro takes a library base name as an argument, and will choose +# good values for basename_LIBRARY, basename_LIBRARIES, +# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what +# has been found and set. If only basename_LIBRARY_RELEASE is defined, +# basename_LIBRARY will be set to the release value, and +# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND. +# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will +# take the debug value, and basename_LIBRARY_RELEASE will be set to +# basename_LIBRARY_RELEASE-NOTFOUND. +# +# If the generator supports configuration types, then basename_LIBRARY +# and basename_LIBRARIES will be set with debug and optimized flags +# specifying the library to be used for the given configuration. If no +# build type has been set or the generator in use does not support +# configuration types, then basename_LIBRARY and basename_LIBRARIES will +# take only the release value, or the debug value if the release one is +# not set. + +# This macro was adapted from the FindQt4 CMake module and is maintained by Will +# Dicharry . + +macro( select_library_configurations basename ) + if(NOT ${basename}_LIBRARY_RELEASE) + set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + if(NOT ${basename}_LIBRARY_DEBUG) + set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + + if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND + NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND + ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) ) + # if the generator supports configuration types or CMAKE_BUILD_TYPE + # is set, then set optimized and debug options. + set( ${basename}_LIBRARY "" ) + foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) + list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) + endforeach() + foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG ) + list( APPEND ${basename}_LIBRARY debug "${_libname}" ) + endforeach() + elseif( ${basename}_LIBRARY_RELEASE ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) + elseif( ${basename}_LIBRARY_DEBUG ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} ) + else() + set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND") + endif() + + set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" ) + + if( ${basename}_LIBRARY ) + set( ${basename}_FOUND TRUE ) + endif() + + mark_as_advanced( ${basename}_LIBRARY_RELEASE + ${basename}_LIBRARY_DEBUG + ) +endmacro() diff --git a/cmake/Modules/Testing/Temporary/CTestCostData.txt b/cmake/Modules/Testing/Temporary/CTestCostData.txt new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/cmake/Modules/Testing/Temporary/CTestCostData.txt @@ -0,0 +1 @@ +--- diff --git a/cmake/Modules/Testing/Temporary/LastTest.log b/cmake/Modules/Testing/Temporary/LastTest.log new file mode 100644 index 000000000..811fffbb0 --- /dev/null +++ b/cmake/Modules/Testing/Temporary/LastTest.log @@ -0,0 +1,3 @@ +Start testing: Apr 08 18:46 UTC +---------------------------------------------------------- +End testing: Apr 08 18:46 UTC diff --git a/cmake/Modules/comp_src.pl b/cmake/Modules/comp_src.pl new file mode 100755 index 000000000..510be2504 --- /dev/null +++ b/cmake/Modules/comp_src.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl + + @list = @ARGV; + foreach(@list) { + $file = $_; + $compfile = "../../../P2/cmake/Modules/".$file; + $diffs = `diff $file $compfile`; + if($diffs != '') { + print "------------------------------------\n"; + print "$file\n"; + print "$diffs\n"; + print "------------------------------------\n"; + } + } + diff --git a/cmake/Modules/findHelpers.cmake b/cmake/Modules/findHelpers.cmake new file mode 100644 index 000000000..436554c91 --- /dev/null +++ b/cmake/Modules/findHelpers.cmake @@ -0,0 +1,65 @@ + +function (findSrc varName version varDir ) + if(EXISTS ${CMAKE_SOURCE_DIR}/libsrc/${varName}) + message("setting source for ${varName} to be in libsrc") + set( ${varDir} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" PARENT_SCOPE) + set( ${varCacheName} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" CACHE STRING "" FORCE ) + else() + message("ProdGSI/libsrc directory not pulled from repo. Either clone with recursive or specify location of library sources") + endif() +endfunction() + +function (findInc incName version incFile ) + cmake_policy(SET CMP0011 NEW) + cmake_policy(SET CMP0009 NEW) + STRING(COMPARE EQUAL ${incFile} "CRTMINC" USECRTMBASE ) + if(( USECRTMBASE ) AND ( CRTM_BASE )) + execute_process(COMMAND find ${CRTM_BASE} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + else() + if(crayComp) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/intel -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + else() + execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/cray -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + endif() + else() + execute_process(COMMAND find ${COREPATH}/${incName} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + endif() + if( NOT (INCFILES) ) + execute_process(COMMAND find ${COREPATH}/sorc -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + endif() + endif() + if( INCFILES ) + string(REGEX REPLACE "\n" ";" INCFILES ${INCFILES} ) + endif() + foreach( INC_FILE in ${INCFILES} ) + message("found ${INC_FILE}") + string(REGEX REPLACE "${incName}_module.mod" "" INCPATH ${INC_FILE} ) + set( ${incFile} ${INCPATH} PARENT_SCOPE ) + return() + endforeach() + file(GLOB_RECURSE INCFILES ${COREPATH}/${incName}_module.mod ) + list(LENGTH INCFILES numFiles) + if(numFiles EQUAL 1) + get_filename_component( INCPATH ${INCFILES} DIRECTORY ) + else() + foreach( INC_FILE in ${INCFILES} ) + get_filename_component( INCPATH ${INC_FILE} DIRECTORY ) + endforeach() + endif() + set( ${incFile} ${INCPATH} PARENT_SCOPE ) +endfunction() + +function (findOtherVersion rootPath srcName srcPath newVer ) + file(GLOB SRCDIRS ${${rootPath}}/${srcName}* ) + foreach( SRC_DIR in ${SRCDIRS} ) + string(REGEX MATCH ${srcName} MATCHFOUND ${SRC_DIR} ) + if( MATCHFOUND ) + set( ${srcPath} ${SRC_DIR} PARENT_SCOPE ) + string(REGEX MATCH "[0-9].[0-9].[0-9]" ALTVER ${SRC_DIR} ) + message("Found ${ALTVER} of ${srcName}. Proceeding with Alternative") + set( ${newVer} ${ALTVER} PARENT_SCOPE ) + return() + endif() + endforeach() +endfunction() diff --git a/cmake/Modules/findHelpers.cmake.orig b/cmake/Modules/findHelpers.cmake.orig new file mode 100644 index 000000000..2ea182c9d --- /dev/null +++ b/cmake/Modules/findHelpers.cmake.orig @@ -0,0 +1,69 @@ +function (findSrc varName version varDir ) + if(EXISTS ${CMAKE_SOURCE_DIR}/libsrc/${varName}) + message("setting source for ${varName} to be in libsrc") + set( ${varDir} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" PARENT_SCOPE) + set( ${varCacheName} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" CACHE STRING "" FORCE ) + else() + message("ProdGSI/libsrc directory not pulled from repo. Either clone with recursive or specify location of library sources") + endif() +endfunction() + +function (findInc incName version incFile ) + cmake_policy(SET CMP0011 NEW) + cmake_policy(SET CMP0009 NEW) + STRING(COMPARE EQUAL ${incFile} "CRTMINC" USECRTMBASE ) + if(( USECRTMBASE ) AND ( CRTM_BASE )) + execute_process(COMMAND find ${CRTM_BASE} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + else() + if(crayComp) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/intel -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + else() + execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/cray -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + endif() + else() + execute_process(COMMAND find ${COREPATH}/${incName} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + endif() + if( NOT (INCFILES) ) + execute_process(COMMAND find ${COREPATH}/sorc -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) + endif() + endif() + if( INCFILES ) + string(REGEX REPLACE "\n" ";" INCFILES ${INCFILES} ) + endif() + foreach( INC_FILE in ${INCFILES} ) +<<<<<<< HEAD + string(REGEX MATCH ${${version}} MATCHFOUND ${INC_FILE} ) + if( MATCHFOUND ) +======= +>>>>>>> debug-fix + message("found ${INC_FILE}") + string(REGEX REPLACE "${incName}_module.mod" "" INCPATH ${INC_FILE} ) + set( ${incFile} ${INCPATH} PARENT_SCOPE ) + return() + endforeach() + file(GLOB_RECURSE INCFILES ${COREPATH}/${incName}_module.mod ) + list(LENGTH INCFILES numFiles) + if(numFiles EQUAL 1) + get_filename_component( INCPATH ${INCFILES} DIRECTORY ) + else() + foreach( INC_FILE in ${INCFILES} ) + get_filename_component( INCPATH ${INC_FILE} DIRECTORY ) + endforeach() + endif() + set( ${incFile} ${INCPATH} PARENT_SCOPE ) +endfunction() + +function (findOtherVersion rootPath srcName srcPath newVer ) + file(GLOB SRCDIRS ${${rootPath}}/${srcName}* ) + foreach( SRC_DIR in ${SRCDIRS} ) + string(REGEX MATCH ${srcName} MATCHFOUND ${SRC_DIR} ) + if( MATCHFOUND ) + set( ${srcPath} ${SRC_DIR} PARENT_SCOPE ) + string(REGEX MATCH "[0-9].[0-9].[0-9]" ALTVER ${SRC_DIR} ) + message("Found ${ALTVER} of ${srcName}. Proceeding with Alternative") + set( ${newVer} ${ALTVER} PARENT_SCOPE ) + return() + endif() + endforeach() +endfunction() diff --git a/cmake/Modules/platforms/Cheyenne.cmake b/cmake/Modules/platforms/Cheyenne.cmake new file mode 100644 index 000000000..764a2bffa --- /dev/null +++ b/cmake/Modules/platforms/Cheyenne.cmake @@ -0,0 +1,24 @@ +macro (setCheyenne) + message("Setting paths for Cheyenne") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + + set(BUILD_CORELIBS "ON" ) + set(BUILD_UTIL "OFF" CACHE INTERNAL "" ) + set(BUILD_BUFR "ON" CACHE INTERNAL "") + set(BUILD_SFCIO "ON" CACHE INTERNAL "") + set(BUILD_SIGIO "ON" CACHE INTERNAL "") + set(BUILD_W3EMC "ON" CACHE INTERNAL "") + set(BUILD_W3NCO "ON" CACHE INTERNAL "") + set(BUILD_BACIO "ON" CACHE INTERNAL "") + set(BUILD_CRTM "ON" CACHE INTERNAL "") + set(BUILD_SP "ON" CACHE INTERNAL "") + set(BUILD_NEMSIO "ON" CACHE INTERNAL "") + set(ENV{MPI_HOME} $ENV{MPI_ROOT} ) +endmacro() + diff --git a/cmake/Modules/platforms/Discover.cmake b/cmake/Modules/platforms/Discover.cmake new file mode 100644 index 000000000..83bcd3742 --- /dev/null +++ b/cmake/Modules/platforms/Discover.cmake @@ -0,0 +1,21 @@ +macro (setDiscover) + message("Setting paths for Discover") + option(BUILD_CORELIBS "Build core libs from source" ON) + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) + option(HDF5_USE_STATIC_LIBRARIES "Use only static libraries for HDF5" OFF) + set(BUILD_NCDIAG_SERIAL FALSE) + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + set(host "Discover" CACHE INTERNAL "") + + if( ENV{BASEDIR} ) + set(BASEDIR $ENV{BASEDIR}/Linux CACHE INTERNAL "") + endif() + + set(ENV{MPI_HOME} $ENV{MPI_ROOT} ) + +endmacro() + diff --git a/cmake/Modules/platforms/Gaea.cmake b/cmake/Modules/platforms/Gaea.cmake new file mode 100644 index 000000000..d897400e6 --- /dev/null +++ b/cmake/Modules/platforms/Gaea.cmake @@ -0,0 +1,14 @@ +macro (setGaea) + + message("Setting flags and paths for Cray") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) + set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "HDF5_Static" ) + + set(HOST_FLAG "-xCORE-AVX2" CACHE INTERNAL "Host Flag") # for Haswell (C4) + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag" ) + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ -traceback ${HOST_FLAG} ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "") + set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ -traceback ${HOST_FLAG} ${MKL_FLAG} ${MPI3FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "") + set(GSI_LDFLAGS "${MKL_FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") + set(BUILD_CORELIBS "OFF" ) +endmacro() diff --git a/cmake/Modules/platforms/Generic.cmake b/cmake/Modules/platforms/Generic.cmake new file mode 100644 index 000000000..8945f43c3 --- /dev/null +++ b/cmake/Modules/platforms/Generic.cmake @@ -0,0 +1,16 @@ +macro (setGeneric) + message("Setting paths for Generic System") + option(BUILD_CORELIBS "Build core libs from source" ON) + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + if(EXISTS /jetmon) + set(HOST_FLAG "-axSSE4.2,AVX,CORE-AVX2" CACHE INTERNAL "Host Flag") + else() + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + endif() + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "${HOST_FLAG} -DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + option(HDF5_USE_STATIC_LIBRARIES "Use only static libraries for HDF5" OFF) + +endmacro() diff --git a/cmake/Modules/platforms/Generic.cmake.orig b/cmake/Modules/platforms/Generic.cmake.orig new file mode 100644 index 000000000..1adc85d4f --- /dev/null +++ b/cmake/Modules/platforms/Generic.cmake.orig @@ -0,0 +1,25 @@ +macro (setGeneric) + message("Setting paths for Generic System") +<<<<<<< HEAD +# option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) +# option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + option(BUILD_CORELIBS "Build core libs from source" ON) + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") +======= + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + if(EXISTS /jetmon) + set(HOST_FLAG "-axSSE4.2,AVX,CORE-AVX2" CACHE INTERNAL "Host Flag") + else() + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + endif() +>>>>>>> origin/master + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "${HOST_FLAG} -DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") +<<<<<<< HEAD + option(HDF5_USE_STATIC_LIBRARIES "Use only static libraries for HDF5" OFF) +======= +>>>>>>> origin/master + +endmacro() diff --git a/cmake/Modules/platforms/Jet.cmake b/cmake/Modules/platforms/Jet.cmake new file mode 100644 index 000000000..8c19dd06f --- /dev/null +++ b/cmake/Modules/platforms/Jet.cmake @@ -0,0 +1,10 @@ +macro (setJet) + message("Setting paths for Jet") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HOST_FLAG "-axSSE4.2,AVX,CORE-AVX2" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "${HOST_FLAG} -DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") +endmacro() + diff --git a/cmake/Modules/platforms/S4.cmake b/cmake/Modules/platforms/S4.cmake new file mode 100644 index 000000000..1eecb29fa --- /dev/null +++ b/cmake/Modules/platforms/S4.cmake @@ -0,0 +1,10 @@ +macro (setS4) + message("Setting paths for S4") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} ${HOST_FLAG}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + set(HDF5_USE_STATIC_LIBRARIES "OFF") +endmacro() diff --git a/cmake/Modules/platforms/Theia.cmake b/cmake/Modules/platforms/Theia.cmake new file mode 100644 index 000000000..58ac83260 --- /dev/null +++ b/cmake/Modules/platforms/Theia.cmake @@ -0,0 +1,55 @@ +macro (setTHEIA) + message("Setting paths for THEIA") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") + set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") + set(HDF5_USE_STATIC_LIBRARIES "OFF") + if( NOT DEFINED ENV{COREPATH} ) + set(COREPATH "/scratch3/NCEPDEV/nwprod/lib" ) + else() + set(COREPATH $ENV{COREPATH} ) + endif() + if( NOT DEFINED ENV{CRTM_INC} ) + set(CRTM_BASE "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm" ) + endif() + if( NOT DEFINED ENV{WRFPATH} ) + set(WRFPATH "/scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3" ) + else() + set(WRFPATH $ENV{WRFPATH} ) + endif() + + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "10.2.5" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.1" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.0.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.0.5" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() +endmacro() + diff --git a/cmake/Modules/platforms/WCOSS-C.cmake b/cmake/Modules/platforms/WCOSS-C.cmake new file mode 100644 index 000000000..1c9cf712c --- /dev/null +++ b/cmake/Modules/platforms/WCOSS-C.cmake @@ -0,0 +1,60 @@ +macro (setWCOSS_C) + + message("Setting flags and paths for Cray") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) + set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "HDF5_Static" ) + + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "" CACHE INTERNAL "MKL flag" ) + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "") + set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "") + set(GSI_LDFLAGS "${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") + if( NOT DEFINED ENV{COREPATH} ) + set(COREPATH "/gpfs/hps/nco/ops/nwprod/lib" ) + else() + set(COREPATH $ENV{COREPATH} ) + endif() + if( NOT DEFINED ENV{CRTM_INC} ) + set(CRTM_BASE "/gpfs/hps/nco/ops/nwprod/lib/crtm" ) + endif() + if( NOT DEFINED ENV{WRFPATH} ) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set(WRFPATH "/gpfs/hps/nco/ops/nwprod/wrf_shared.v1.1.0-intel" ) + else() + set(WRFPATH "/gpfs/hps/nco/ops/nwprod/wrf_shared.v1.1.0-cray" ) + endif() + else() + set(WRFPATH $ENV{WRFPATH} ) + endif() + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "11.0.1" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.2" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.0.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.2.0" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() +endmacro() diff --git a/cmake/Modules/platforms/WCOSS-D.cmake b/cmake/Modules/platforms/WCOSS-D.cmake new file mode 100644 index 000000000..a0858d2b7 --- /dev/null +++ b/cmake/Modules/platforms/WCOSS-D.cmake @@ -0,0 +1,21 @@ +macro (setWCOSS_D) + message("Setting paths for Dell") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "GSI Fortran Flags") + set(GSI_LDFLAGS "${OpenMP_Fortran_FLAGS} ${MKL_FLAG}" CACHE INTERNAL "") + set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "ENKF Fortran Flags") + + set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "" ) + if( NOT DEFINED ENV{COREPATH} ) + set(COREPATH "/gpfs/dell1/nco/ops/nwprod/lib" ) + else() + set(COREPATH $ENV{COREPATH} ) + endif() + if( NOT DEFINED ENV{CRTM_INC} ) + set(CRTM_BASE "/gpfs/dell1/nco/ops/nwprod/lib/crtm" ) + endif() +endmacro() diff --git a/cmake/Modules/platforms/WCOSS.cmake b/cmake/Modules/platforms/WCOSS.cmake new file mode 100644 index 000000000..81b129739 --- /dev/null +++ b/cmake/Modules/platforms/WCOSS.cmake @@ -0,0 +1,61 @@ +macro (setWCOSS) + message("Setting paths for WCOSS") + option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) + option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) + set(HDF5_USE_STATIC_LIBRARIES "OFF") + + #if ibmpe module is not loaded last, CMake tries to use intel mpi. Force use of ibmhpc + set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") + set( MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") + set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -traceback -O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") + set(ENKF_Platform_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${HOST_FLAG} " CACHE INTERNAL "") + + set(MPI_Fortran_COMPILER /opt/ibmhpc/pe13010/base/bin/mpif90 CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) + set(MPI_C_COMPILER /opt/ibmhpc/pe13010/base/bin/mpicc CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) + set(MPI_CXX_COMPILER /opt/ibmhpc/pe13010/base/bin/mpicxx CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) + + if( NOT DEFINED ENV{COREPATH} ) + set(COREPATH "/nwprod/lib" ) + else() + set(COREPATH $ENV{COREPATH} ) + endif() + if( NOT DEFINED ENV{CRTM_INC} ) + set(CRTM_BASE "/nwprod2/lib" ) + endif() + if( NOT DEFINED ENV{WRFPATH} ) + set(WRFPATH "/nwprod/sorc/wrf_shared.fd" ) + else() + set(WRFPATH $ENV{WRFPATH} ) + endif() + if( NOT DEFINED ENV{NETCDF_VER} ) + set(NETCDF_VER "3.6.3" ) + endif() + if( NOT DEFINED ENV{BACIO_VER} ) + set(BACIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{BUFR_VER} ) + set(BUFR_VER "10.2.5" ) + endif() + if( NOT DEFINED ENV{CRTM_VER} ) + set(CRTM_VER "2.2.3" ) + endif() + if( NOT DEFINED ENV{NEMSIO_VER} ) + set(NEMSIO_VER "2.2.1" ) + endif() + if( NOT DEFINED ENV{SFCIO_VER} ) + set(SFCIO_VER "1.0.0" ) + endif() + if( NOT DEFINED ENV{SIGIO_VER} ) + set(SIGIO_VER "2.0.1" ) + endif() + if( NOT DEFINED ENV{SP_VER} ) + set(SP_VER "2.0.2" ) + endif() + if( NOT DEFINED ENV{W3EMC_VER} ) + set(W3EMC_VER "2.0.5" ) + endif() + if( NOT DEFINED ENV{W3NCO_VER} ) + set(W3NCO_VER "2.0.6" ) + endif() + +endmacro() diff --git a/cmake/Modules/setCompilerFlags.cmake.orig b/cmake/Modules/setCompilerFlags.cmake.orig new file mode 100644 index 000000000..09c2b0a6d --- /dev/null +++ b/cmake/Modules/setCompilerFlags.cmake.orig @@ -0,0 +1,167 @@ +function (setIntel) + string(REPLACE "." ";" COMPILER_VERSION_LIST ${CMAKE_C_COMPILER_VERSION}) + list(GET COMPILER_VERSION_LIST 0 MAJOR_VERSION) + list(GET COMPILER_VERSION_LIST 1 MINOR_VERSION) + list(GET COMPILER_VERSION_LIST 2 PATCH_VERSION) + set(COMPILER_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" CACHE INTERNAL "Compiler Version") + message("Compiler version is ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") + message("Compiler version is ${COMPILER_VERSION}") + if(${MAJOR_VERSION} GREATER 15 ) + set( OMPFLAG "-qopenmp" CACHE INTERNAL "OpenMP flag") + else() + set( OMPFLAG "-openmp" CACHE INTERNAL "OpenMP flag") + endif() + if(( HOST-Tide ) OR ( HOST-Gyre )) + set( MPI3FLAG "" CACHE INTERNAL "" ) + else() + set( MPI3FLAG "-DMPI3" CACHE INTERNAL "" ) + endif() + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) + set( MKL_FLAG "-mkl" ) + set(EXTRA_LINKER_FLAGS ${MKL_FLAG} PARENT_SCOPE) + if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) + if(( HOST-Tide ) OR ( HOST-Gyre )) + set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -traceback -O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) + set(ENKF_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) + set(UTIL_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DWRF -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) + set (BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp " PARENT_SCOPE ) + set (BUFR_Fortran_FLAGS "-O2 -r8 -fp-model strict -traceback -xSSE2 -O3 -axCORE-AVX2 ${OMPFLAG} " PARENT_SCOPE ) + set (BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -O3 -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) + elseif( HOST-Luna OR HOST-Surge ) + set( MKL_FLAG "" ) + set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS} -O3" PARENT_SCOPE) +<<<<<<< HEAD + set(GSI_LDFLAGS "${OMPFLAG}" PARENT_SCOPE) + + set(ENKF_Fortran_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${MPI3FLAG} ${OMPFLAG} " PARENT_SCOPE) +======= + set(GSI_LDFLAGS "-liomp5" PARENT_SCOPE) + + set(ENKF_Fortran_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OMPFLAG} " PARENT_SCOPE) +>>>>>>> master + set(UTIL_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DWRF -D_REAL8_ ${OMPFLAG} " PARENT_SCOPE) + set (BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp " PARENT_SCOPE ) + set (BUFR_Fortran_FLAGS " -c -g -traceback -O3 -axCORE-AVX2 -r8 " PARENT_SCOPE ) + set (BUFR_C_FLAGS "-DSTATIC_ALLOCATION -DUNDERSCORE -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) + elseif ( HOST-Venus OR HOST-Mars ) + set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS} -O3" PARENT_SCOPE) + set(GSI_LDFLAGS "${OMPFLAG} ${MKL_FLAG}" PARENT_SCOPE) + + set(ENKF_Fortran_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OMPFLAG} " PARENT_SCOPE) + set(UTIL_Fortran_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DWRF -D_REAL8_ ${OMPFLAG} " PARENT_SCOPE) + set (BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp " PARENT_SCOPE ) + set (BUFR_Fortran_FLAGS " -c -g -traceback -O3 -axCORE-AVX2 -r8 " PARENT_SCOPE ) + set (BUFR_C_FLAGS "-DSTATIC_ALLOCATION -DUNDERSCORE -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) + else() + set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) + set(ENKF_Fortran_FLAGS "-O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OMPFLAG}" PARENT_SCOPE) + set(UTIL_Fortran_FLAGS "-O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DWRF -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) + set (BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp " PARENT_SCOPE ) + set (BUFR_Fortran_FLAGS "-O2 -r8 -fp-model strict -traceback -xSSE2 -O3 -axCORE-AVX2 ${OMPFLAG} " PARENT_SCOPE ) + set (BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -O3 -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) + endif() + + #Common release/production flags + set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) + set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" PARENT_SCOPE ) + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" PARENT_SCOPE ) + set (BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " PARENT_SCOPE ) + set (CRTM_Fortran_FLAGS " -O3 -convert big_endian -free -assume byterecl -fp-model source -traceback " PARENT_SCOPE ) + set (NEMSIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) + set (SFCIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) + set (SIGIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) + set (SP_Fortran_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OMPFLAG} " PARENT_SCOPE ) + set (SP_F77_FLAGS " -DLINUX -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OMPFLAG} " PARENT_SCOPE ) + set (W3EMC_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OMPFLAG} " PARENT_SCOPE ) + set (W3NCO_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OMPFLAG} " PARENT_SCOPE ) + set (W3NCO_C_FLAGS "-O0 -DUNDERSCORE -DLINUX -D__linux__ " PARENT_SCOPE ) + set (NDATE_Fortran_FLAGS "-fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" PARENT_SCOPE ) + set( NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" PARENT_SCOPE ) + else( ) #DEBUG flags + message("Building DEBUG version of GSI") + set( debug_suffix "_DBG" PARENT_SCOPE ) + if(( HOST-Tide ) OR ( HOST-Gyre )) + set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -mcmodel medium -shared-intel -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -convert big_endian -implicitnone -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) + set(ENKF_Fortran_FLAGS "-g -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -warn all -traceback -debug all -check all,noarg_temp_created -implicitnone -DGFS -D_REAL8_ ${MPI3FLAG} ${OMPFLAG}" PARENT_SCOPE) + set(UTIL_Fortran_FLAGS "-g -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -warn all -traceback -debug all -check all,noarg_temp_created -implicitnone -DWRF -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) + set (BACIO_Fortran_FLAGS "-g -free -assume nocc_omp " PARENT_SCOPE ) + else() + set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model strict -convert big_endian -assume byterecl -implicitnone -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) + set(ENKF_Fortran_FLAGS "-O0 -xHOST -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian -D_REAL8_ ${MPI3FLAG} ${OMPFLAG}" PARENT_SCOPE) + set(UTIL_Fortran_FLAGS "-O0 -xHOST -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) + set (BACIO_Fortran_FLAGS "-g -free -assume nocc_omp " PARENT_SCOPE ) + endif() + #Common debug flags + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" PARENT_SCOPE ) + set (BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " PARENT_SCOPE ) + set (BUFR_Fortran_FLAGS "-g -r8 -fp-model strict -traceback -xSSE2 -axCORE-AVX2 ${OMPFLAG} " PARENT_SCOPE ) + set (BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) + set (CRTM_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${OMPFLAG} " PARENT_SCOPE ) +# set(CRTM_Fortran_FLAGS "-O0 -fp-model strict -free -convert big_endian -assume byterecl -implicitnone -mcmodel medium -shared-intel -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) + set (SFCIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) + set (SIGIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) + set (SP_Fortran_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -i${intsize} -r8 -convert big_endian -DLINUX ${OMPFLAG} " PARENT_SCOPE ) + set (SP_F77_FLAGS " -g -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -DLINUX ${OMPFLAG} " PARENT_SCOPE ) + set (W3EMC_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OMPFLAG} " PARENT_SCOPE ) + set (NEMSIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) + set (W3NCO_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OMPFLAG} " PARENT_SCOPE ) + set (W3NCO_C_FLAGS "-O0 -g -DUNDERSCORE -DLINUX -D__linux__ " PARENT_SCOPE ) + set (NDATE_Fortran_FLAGS "-fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" PARENT_SCOPE) + set( NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" PARENT_SCOPE ) + set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O1 -g -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) + set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" PARENT_SCOPE ) + endif() +endfunction() + +function (setGNU) + message("Setting GNU Compiler Flags") + set(GSI_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" PARENT_SCOPE) + set(EXTRA_LINKER_FLAGS "-lgomp" PARENT_SCOPE) + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" PARENT_SCOPE ) + set(ENKF_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" PARENT_SCOPE) + set(UTIL_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" PARENT_SCOPE) + set(BUFR_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) + set(BUFR_Fortran_PP_FLAGS " -P " PARENT_SCOPE) + set(BUFR_C_FLAGS " -O3 -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) + set(BACIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) + set(CRTM_Fortran_FLAGS " -g -std=f2003 -fdollar-ok -O3 -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " PARENT_SCOPE) + set(NEMSIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) + set(SIGIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) + set(SFCIO_Fortran_FLAGS " -O3 -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) + set(SP_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -DLINUX" PARENT_SCOPE) + set(SP_F77_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -DLINUX" PARENT_SCOPE) + set(W3EMC_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) + set(W3NCO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ " PARENT_SCOPE) + set(W3NCO_C_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) + set(WRFLIB_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" PARENT_SCOPE) + set( NCDIAG_Fortran_FLAGS "-ffree-line-length-none" PARENT_SCOPE ) + set( NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" PARENT_SCOPE) +endfunction() + +function (setPGI) + message("Setting PGI Compiler Flags") + set(CMAKE_Fortran_FLAGS_RELEASE "") + set(Fortran_FLAGS "" PARENT_SCOPE) + set(GSI_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ -mp -Mfree" PARENT_SCOPE) + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" PARENT_SCOPE ) + set(ENKF_Fortran_FLAGS " -O3 -byteswapio -fast -DGFS -D_REAL8_ -mp" PARENT_SCOPE) + set(UTIL_Fortran_FLAGS " -O3 -byteswapio -fast -DWRF -D_REAL8_ -mp" PARENT_SCOPE) + + set(BUFR_Fortran_FLAGS "-O1 -byteswapio -D_REAL8_ -mp" PARENT_SCOPE) + set(BUFR_Fortran_PP_FLAGS " -P " PARENT_SCOPE) + set(BUFR_C_FLAGS " -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) + + set(BACIO_C_INCLUDES " -I/usr/include/malloc" PARENT_SCOPE) + set(BACIO_Fortran_FLAGS " -O3 -byteswapio -fast -D_REAL8_ -mp -Mfree" PARENT_SCOPE) + set(CRTM_Fortran_FLAGS " -O1 -byteswapio -module ../../include -Mfree " PARENT_SCOPE) + set(NEMSIO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -mp" PARENT_SCOPE) + set(SIGIO_Fortran_FLAGS " -O3 -Mfree -byteswapio -fast -D_REAL8_ -mp" PARENT_SCOPE) + set(SFCIO_Fortran_FLAGS " -O3 -byteswapio -Mfree -fast -D_REAL8_ -mp" PARENT_SCOPE) + set(SP_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -mp" PARENT_SCOPE) + set(SP_F77_FLAGS "-DLINUX -O1 -byteswapio -D_REAL8_ -mp" PARENT_SCOPE) + set(W3EMC_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ " PARENT_SCOPE) + set(W3NCO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ " PARENT_SCOPE) + set(W3NCO_C_FLAGS " -O1 -D_REAL8_ -mp" PARENT_SCOPE) + set(WRFLIB_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ -mp -Mfree" PARENT_SCOPE) +endfunction() diff --git a/cmake/Modules/setGNUFlags.cmake b/cmake/Modules/setGNUFlags.cmake new file mode 100644 index 000000000..c47f56eee --- /dev/null +++ b/cmake/Modules/setGNUFlags.cmake @@ -0,0 +1,62 @@ +function (setGNU) + set(COMPILER_TYPE "gnu" CACHE INTERNAL "Compiler brand") + message("Setting GNU Compiler Flags") + if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) + set(GSI_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ ${GSDCLOUDOPT} -fopenmp -ffree-line-length-0" CACHE INTERNAL "") + set(EXTRA_LINKER_FLAGS "-lgomp -lnetcdf -lnetcdff" CACHE INTERNAL "") + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) + set(ENKF_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(UTIL_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check" CACHE INTERNAL "") + set(BUFR_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") + set(BUFR_C_FLAGS " -O3 -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + set(BACIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(CRTM_Fortran_FLAGS " -g -std=f2003 -fdollar-ok -O3 -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " CACHE INTERNAL "") + set(NEMSIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SIGIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SFCIO_Fortran_FLAGS " -O3 -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SP_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_Fortran_4_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_F77_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_F77_4_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") + set(W3EMC_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(W3EMC_4_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") + set(W3NCO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ " CACHE INTERNAL "") + set(W3NCO_4_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") + set(W3NCO_C_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(WRFLIB_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" CACHE INTERNAL "") + set(NCDIAG_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "") + set(NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-O3 -fconvert=big-endian" CACHE INTERNAL "") + else( ) #DEBUG + set(GSI_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ ${GSDCLOUDOPT} -fopenmp -ffree-line-length-0" CACHE INTERNAL "") + set(EXTRA_LINKER_FLAGS "-lgomp -lnetcdf -lnetcdff" CACHE INTERNAL "") + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -fbacktrace -Dfunder" CACHE INTERNAL "" ) + set(ENKF_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(UTIL_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check" CACHE INTERNAL "") + set(BUFR_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") + set(BUFR_C_FLAGS " -g -fbacktrace -g -fbacktrace -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + set(BACIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(CRTM_Fortran_FLAGS " -g -fbacktrace -std=f2003 -fdollar-ok -g -fbacktrace -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " CACHE INTERNAL "") + set(NEMSIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SIGIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SFCIO_Fortran_FLAGS " -g -fbacktrace -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(SP_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_Fortran_4_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_F77_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") + set(SP_F77_4_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") + set(W3EMC_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(W3EMC_4_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") + set(W3NCO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ " CACHE INTERNAL "") + set(W3NCO_4_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") + set(W3NCO_C_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") + set(WRFLIB_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" CACHE INTERNAL "") + set(NCDIAG_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "") + set(NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -fbacktrace -Wl,-noinhibit-exec" CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-O3 -fconvert=big-endian" CACHE INTERNAL "") + endif( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) +endfunction() + diff --git a/cmake/Modules/setHOST.cmake b/cmake/Modules/setHOST.cmake new file mode 100644 index 000000000..357aa798c --- /dev/null +++ b/cmake/Modules/setHOST.cmake @@ -0,0 +1,96 @@ +macro( setHOST ) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Cheyenne.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Discover.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Generic.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Gaea.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Jet.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/S4.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Theia.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/WCOSS-C.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/WCOSS-D.cmake) + include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/WCOSS.cmake) + + site_name(HOSTNAME) + message("The hostname is ${HOSTNAME}" ) + string(REGEX MATCH "s4-" HOST-S4 ${HOSTNAME} ) + string(REGEX MATCH "gaea" HOST-Gaea ${HOSTNAME} ) + string(REGEX MATCH "tfe[0-9]" HOST-Theia ${HOSTNAME} ) + if(EXISTS /jetmon) + set(HOST-Jet "True" ) + endif() + string(REGEX MATCH "g[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) + if( HOST-WCOSS ) + message("host is WCOSS") + endif() + string(REGEX MATCH "g[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) + if( NOT HOST-WCOSS ) # don't overwrite if we are on gyre + string(REGEX MATCH "t[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) + endif() + string(REGEX MATCH "v[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) + if( NOT HOST-WCOSS_D )# don't overwrite if we are on venus + string(REGEX MATCH "m[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) + endif() + string(REGEX MATCH "llogin" HOST-WCOSS_C ${HOSTNAME} ) + if( NOT HOST-WCOSS_C )# don't overwrite if we are on luna + string(REGEX MATCH "slogin" HOST-WCOSS_C ${HOSTNAME} ) + endif() + string(REGEX MATCH "discover" HOST-Discover ${HOSTNAME} ) + string(REGEX MATCH "cheyenne" HOST-Cheyenne ${HOSTNAME} ) + message("done figuring out host--${HOSTNAME}") + if ( BUILD_CORELIBS ) + MESSAGE(STATUS "BUILD_CORELIBS manually-specified as ON") + set( host "GENERIC" ) + set( HOST-Generic "TRUE" ) + setGeneric() + elseif(HOST-Jet) + option(BUILD_CORELIBS "Build the Core libraries " ON) + set( host "Jet" ) + set( HOST-Jet "TRUE" ) + setJet() + elseif( HOST-S4 ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + set( host "S4" ) + set( HOST-S4 "TRUE" ) + setS4() + elseif( HOST-WCOSS ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + set( host "WCOSS" ) + set( HOST-WCOSS "TRUE" ) + setWCOSS() + elseif( HOST-Theia ) + set( host "Theia" ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + setTHEIA() + set( HOST-Theia "TRUE" ) + elseif( HOST-Gaea ) + set( host "Gaea" ) + option(BUILD_CORELIBS "Build the Core libraries " On) + setGaea() + set( HOST-Gaea "TRUE" ) + elseif( HOST-Cheyenne ) + option(BUILD_CORELIBS "Build the Core libraries " ON) + set( host "Cheyenne" ) + setCheyenne() + set( HOST-Cheyenne "TRUE" ) + elseif( HOST-WCOSS_C ) + set( host "WCOSS_C" ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + setWCOSS_C() + set( HOST-WCOSS_C "TRUE" ) + elseif( HOST-WCOSS_D ) + set( host "WCOSS_D" ) + option(BUILD_CORELIBS "Build the Core libraries " OFF) + setWCOSS_D() + set( HOST-WCOSS_D "TRUE" ) + elseif( HOST-Discover ) + set(host "Discover" ) + setDiscover() + set( HOST-Discover "TRUE" ) + else( ) + set( host "GENERIC" ) + option(BUILD_CORELIBS "Build the Core libraries " ON) + setGeneric() + set( HOST-Generic "TRUE" ) + endif() + message("Host is set to ${host}") +endmacro() diff --git a/cmake/Modules/setIntelFlags.cmake b/cmake/Modules/setIntelFlags.cmake new file mode 100644 index 000000000..bd968fc76 --- /dev/null +++ b/cmake/Modules/setIntelFlags.cmake @@ -0,0 +1,87 @@ +function(set_LIBRARY_UTIL_Intel) + set(BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp ${HOST_FLAG} " CACHE INTERNAL "" ) + set(BUFR_Fortran_FLAGS "-O2 -r8 -fp-model strict -traceback -O3 ${HOST_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(BUFR_C_FLAGS "-DSTATIC_ALLOCATION -DUNDERSCORE -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + set(BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " CACHE INTERNAL "" ) + set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") + set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" CACHE INTERNAL "" ) + set (CRTM_Fortran_FLAGS " -O3 -convert big_endian -free -assume byterecl -fp-model source -traceback ${HOST_FLAG}" CACHE INTERNAL "" ) + set (NEMSIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SFCIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SIGIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SP_Fortran_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SP_Fortran_4_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (SP_F77_FLAGS " -DLINUX -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3EMC_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3EMC_4_Fortran_FLAGS " -O3 -auto -assume nocc_omp -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3NCO_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3NCO_4_Fortran_FLAGS " -O3 -auto -assume nocc_omp -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set (W3NCO_C_FLAGS "-O0 -DUNDERSCORE -DLINUX -D__linux__ " CACHE INTERNAL "" ) + set (NDATE_Fortran_FLAGS "${HOST_FLAG} -fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" CACHE INTERNAL "" ) + set(NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" CACHE INTERNAL "" ) + set(UTIL_Fortran_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DWRF -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone" CACHE INTERNAL "") +endfunction(set_LIBRARY_UTIL_Intel) + +function(set_LIBRARY_UTIL_Debug_Intel) + set (BACIO_Fortran_FLAGS "-g -free -assume nocc_omp " CACHE INTERNAL "" ) + set(BUFR_Fortran_FLAGS " -c -g -traceback -O3 -axCORE-AVX2 -r8 " CACHE INTERNAL "" ) + set(BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -O3 -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + set(BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " CACHE INTERNAL "" ) + set(CRTM_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SFCIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SIGIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SP_Fortran_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -i${intsize} -r8 -convert big_endian -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SP_Fortran_4_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -convert big_endian -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(SP_F77_FLAGS " -g -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3EMC_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3EMC_4_Fortran_FLAGS " -g -auto -assume nocc_omp -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(NEMSIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3NCO_Fortran_FLAGS " -g -auto -assume nocc_omp -i -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3NCO_4_Fortran_FLAGS " -g -auto -assume nocc_omp -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) + set(W3NCO_C_FLAGS "-O0 -g -DUNDERSCORE -DLINUX -D__linux__ " CACHE INTERNAL "" ) + set(NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" CACHE INTERNAL "" ) + set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O1 -g -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") + set(NDATE_Fortran_FLAGS "${HOST_FLAG} -fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -Wl,-noinhibit-exec" CACHE INTERNAL "" ) + set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) + set(UTIL_Fortran_FLAGS "-O0 ${HOST_FLAG} -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS "-O0 -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian" CACHE INTERNAL "") +endfunction(set_LIBRARY_UTIL_Debug_Intel) + +function(set_GSI_ENKF_Intel) + #Common release/production flags + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" CACHE INTERNAL "" ) + set(GSI_Fortran_FLAGS "${GSI_Intel_Platform_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "Full GSI Fortran FLAGS" ) + set(ENKF_Fortran_FLAGS "${ENKF_Platform_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "Full ENKF Fortran FLAGS" ) + set(GSDCLOUD_Fortran_FLAGS "-O3 -convert big_endian" CACHE INTERNAL "") +endfunction(set_GSI_ENKF_Intel) + +function (set_GSI_ENKF_Debug_Intel) + set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -mcmodel medium -shared-intel -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") + set(ENKF_Fortran_FLAGS "-O0 ${HOST_FLAG} -warn all -implicitnone -traceback -g -debug all -check all,noarg_temp_created -fp-model strict -convert big_endian -assume byterecl -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -convert big_endian" CACHE INTERNAL "") + #Common debug flags + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) +endfunction (set_GSI_ENKF_Debug_Intel) + +function (setIntel) + string(REPLACE "." ";" COMPILER_VERSION_LIST ${CMAKE_C_COMPILER_VERSION}) + list(GET COMPILER_VERSION_LIST 0 MAJOR_VERSION) + list(GET COMPILER_VERSION_LIST 1 MINOR_VERSION) + list(GET COMPILER_VERSION_LIST 2 PATCH_VERSION) + set(COMPILER_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" CACHE INTERNAL "Compiler Version") + set(COMPILER_TYPE "intel" CACHE INTERNAL "Compiler brand") + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) + set(EXTRA_LINKER_FLAGS ${MKL_FLAG} CACHE INTERNAL "Extra Linker flags") + if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) + set_GSI_ENKF_Intel() + set_LIBRARY_UTIL_Intel() + else( ) #DEBUG flags + message("Building DEBUG version of GSI") + set( debug_suffix "_DBG" CACHE INTERNAL "" ) + set_GSI_ENKF_Debug_Intel() + set_LIBRARY_UTIL_Debug_Intel() + endif() +endfunction() + diff --git a/cmake/Modules/setPGIFlags.cmake b/cmake/Modules/setPGIFlags.cmake new file mode 100644 index 000000000..3e63ba4ce --- /dev/null +++ b/cmake/Modules/setPGIFlags.cmake @@ -0,0 +1,78 @@ +function (setPGI) + message("Setting PGI Compiler Flags") + set(COMPILER_TYPE "pgi" CACHE INTERNAL "Compiler brand") + if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) + set(CMAKE_Fortran_FLAGS_RELEASE "") + set(Fortran_FLAGS "" CACHE INTERNAL "") + set(GSI_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ ${GSDCLOUDOPT} -mp -Mfree" CACHE INTERNAL "") + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) + set(ENKF_Fortran_FLAGS " -O3 -byteswapio -fast -DGFS -D_REAL8_ -mp" CACHE INTERNAL "") + set(UTIL_Fortran_FLAGS " -O3 -byteswapio -fast -DWRF -D_REAL8_ -mp" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS " -O3 -byteswapio -fast" CACHE INTERNAL "") + + set(BUFR_Fortran_FLAGS "-O1 -byteswapio -D_REAL8_ -mp -r8" CACHE INTERNAL "") + set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") + set(BUFR_C_FLAGS " -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + + set(BACIO_C_INCLUDES " -I/usr/include/malloc" CACHE INTERNAL "") + set(BACIO_Fortran_FLAGS " -O3 -byteswapio -fast -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") + set(CRTM_Fortran_FLAGS " -O1 -byteswapio -module ../../include -Mfree " CACHE INTERNAL "") + set(NEMSIO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -mp" CACHE INTERNAL "") + set(SIGIO_Fortran_FLAGS " -O3 -Mfree -byteswapio -fast -D_REAL8_ -mp" CACHE INTERNAL "") + set(SFCIO_Fortran_FLAGS " -O3 -byteswapio -Mfree -fast -D_REAL8_ -mp" CACHE INTERNAL "") + set(SP_Fortran_FLAGS " -O1 -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") + set(SP_Fortran_4_FLAGS " -O1 -byteswapio -DLINUX -mp " CACHE INTERNAL "") + set(SP_F77_4_FLAGS "-DLINUX -O1 -byteswapio -DLINUX -mp " CACHE INTERNAL "") + set(SP_F77_FLAGS "-DLINUX -O1 -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") + set(W3EMC_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") + set(W3EMC_4_Fortran_FLAGS " -O1 -byteswapio " CACHE INTERNAL "") + set(W3NCO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") + set(W3NCO_4_Fortran_FLAGS " -O1 -byteswapio " CACHE INTERNAL "") + set(W3NCO_C_FLAGS " -O1 -D_REAL8_ -mp" CACHE INTERNAL "") + set(WRFLIB_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") + set(NDATE_Fortran_FLAGS "-DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 " CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-O3 -byteswapio" CACHE INTERNAL "") + + if ( ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 18.5 ) + set( NCDIAG_Fortran_FLAGS "-Mfree -DOLDPGI" CACHE INTERNAL "" ) + else() + set( NCDIAG_Fortran_FLAGS "-Mfree" CACHE INTERNAL "" ) + endif() + else() + set(Fortran_FLAGS "" CACHE INTERNAL "") + set(GSI_Fortran_FLAGS "-Minform=inform -g -traceback -byteswapio -D_REAL8_ ${GSDCLOUDOPT} -mp -Mfree" CACHE INTERNAL "") + set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -traceback -Dfunder" CACHE INTERNAL "" ) + set(ENKF_Fortran_FLAGS " -g -traceback -byteswapio -fast -DGFS -D_REAL8_ -mp" CACHE INTERNAL "") + set(UTIL_Fortran_FLAGS " -g -traceback -byteswapio -fast -DWRF -D_REAL8_ -mp" CACHE INTERNAL "") + set(UTIL_COM_Fortran_FLAGS " -g -traceback -byteswapio -fast" CACHE INTERNAL "") + + set(BUFR_Fortran_FLAGS "-g -traceback -byteswapio -D_REAL8_ -mp -r8" CACHE INTERNAL "") + set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") + set(BUFR_C_FLAGS " -g -traceback -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) + + set(BACIO_C_INCLUDES " -I/usr/include/malloc" CACHE INTERNAL "") + set(BACIO_Fortran_FLAGS " -g -traceback -byteswapio -fast -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") + set(CRTM_Fortran_FLAGS " -g -traceback -byteswapio -module ../../include -Mfree " CACHE INTERNAL "") + set(NEMSIO_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -mp" CACHE INTERNAL "") + set(SIGIO_Fortran_FLAGS " -g -traceback -Mfree -byteswapio -fast -D_REAL8_ -mp" CACHE INTERNAL "") + set(SFCIO_Fortran_FLAGS " -g -traceback -byteswapio -Mfree -fast -D_REAL8_ -mp" CACHE INTERNAL "") + set(SP_Fortran_FLAGS " -g -traceback -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") + set(SP_Fortran_4_FLAGS " -g -traceback -byteswapio -DLINUX -mp " CACHE INTERNAL "") + set(SP_F77_4_FLAGS "-DLINUX -g -traceback -byteswapio -DLINUX -mp " CACHE INTERNAL "") + set(SP_F77_FLAGS "-DLINUX -g -traceback -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") + set(W3EMC_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") + set(W3EMC_4_Fortran_FLAGS " -g -traceback -byteswapio " CACHE INTERNAL "") + set(W3NCO_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") + set(W3NCO_4_Fortran_FLAGS " -g -traceback -byteswapio " CACHE INTERNAL "") + set(W3NCO_C_FLAGS " -g -traceback -D_REAL8_ -mp" CACHE INTERNAL "") + set(WRFLIB_Fortran_FLAGS "-Minform=inform -g -traceback -byteswapio -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") + set(NDATE_Fortran_FLAGS "-DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -traceback " CACHE INTERNAL "") + set(GSDCLOUD_Fortran_FLAGS "-O3 -byteswapio" CACHE INTERNAL "") + + if ( ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 18.5 ) + set( NCDIAG_Fortran_FLAGS "-Mfree -DOLDPGI" CACHE INTERNAL "" ) + else() + set( NCDIAG_Fortran_FLAGS "-Mfree" CACHE INTERNAL "" ) + endif() + endif( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) +endfunction() diff --git a/cmake/Modules/setPlatformVariables.cmake b/cmake/Modules/setPlatformVariables.cmake new file mode 100644 index 000000000..31b271bf2 --- /dev/null +++ b/cmake/Modules/setPlatformVariables.cmake @@ -0,0 +1,10 @@ +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Jet.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS-C.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/S4.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Theia.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Gaea.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Cheyenne.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Discover.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS-D.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/platforms/Generic.cmake) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt new file mode 100644 index 000000000..4c5e46c2d --- /dev/null +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 2.6) + +set(EXENAME ncep_post ) +file(GLOB EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f ${CMAKE_CURRENT_SOURCE_DIR}/*.f90 ${CMAKE_CURRENT_SOURCE_DIR}/*.F) +file(GLOB EXE_C_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c) +list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) +list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) +if(IntelComp) + message("setting intel flags") + set(CMAKE_Fortran_8_FLAGS " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) + set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") +else() + message("unkown compiler!") + exit() +endif() + +set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) +add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) +set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) +set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) +set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS -qopenmp ) +message("hey, g2 inc is ${G2TMPL_INC}") +include_directories( ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_4_INC} ${NEMSIOINC} ${SFCIO_4_INC} ${W3EMC4INC} ${G2_INC4} ${G2TMPL_INC} ${GFSIO_INC} ${CRTM_INC} ) +target_link_libraries(${EXENAME} ${BACIO_LIBRARY} ${SP_4_LIBRARY} ${W3NCO_4_LIBRARY} ${SIGIO_4_LIBRARY} ${NEMSIO_LIBRARY} ${IP_4_LIBRARY} ${SFCIO_4_LIBRARY} ${W3EMC_4_LIBRARY} ${ZLIB} ${G2TMPL_LIBRARY} ${G2_4_LIBRARY} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIBRARY} ${CRTM_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIBRARY} ) + + +install(TARGETS ${EXENAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + diff --git a/sorc/ncep_post.fd/io_int_stubs.f b/sorc/ncep_post.fd/io_int_stubs.f new file mode 100755 index 000000000..f6dc98c30 --- /dev/null +++ b/sorc/ncep_post.fd/io_int_stubs.f @@ -0,0 +1,147 @@ +! Stubs version of wrf io spi subroutines +! +!--- get_dom_ti_real +SUBROUTINE ext_int_get_dom_ti_real ( DataHandle,Element, Data, Count, Outcount, Status ) + INTEGER , INTENT(IN) :: DataHandle + CHARACTER*(*) :: Element + REAL , INTENT(OUT) :: Data(*) + INTEGER , INTENT(IN) :: Count + INTEGER , INTENT(OUT) :: Outcount + INTEGER , INTENT(OUT) :: Status + +RETURN +END SUBROUTINE ext_int_get_dom_ti_real + + +SUBROUTINE ext_int_get_dom_ti_integer ( DataHandle,Element, Data, Count, Outcount, Status ) + +RETURN +END SUBROUTINE ext_int_get_dom_ti_integer + + +!--- get_dom_ti_char +SUBROUTINE ext_int_get_dom_ti_char ( DataHandle,Element, Data, Status ) + +RETURN +END SUBROUTINE ext_int_get_dom_ti_char + + +!--- get_var_info +SUBROUTINE ext_int_get_var_info ( DataHandle , VarName , NDim , MemoryOrder , Stagger , & + DomainStart , DomainEnd , WrfType, Status ) + +RETURN +END SUBROUTINE ext_int_get_var_info + + +!--- read_field +SUBROUTINE ext_int_read_field ( DataHandle , DateStr , VarName , Field , FieldType , Comm , IOComm, & + DomainDesc , MemoryOrder , Stagger , DimNames , & + DomainStart , DomainEnd , & + MemoryStart , MemoryEnd , & + PatchStart , PatchEnd , & + Status ) + RETURN + +END SUBROUTINE ext_int_read_field + + +!--- close +SUBROUTINE ext_int_ioclose ( DataHandle, Status ) + + RETURN +END SUBROUTINE ext_int_ioclose + + +!--- initialize +SUBROUTINE ext_int_ioinit( SysDepInfo, Status ) + +END SUBROUTINE ext_int_ioinit + + + +!--- open_for_read +SUBROUTINE ext_int_open_for_read ( FileName , Comm_compute, Comm_io, SysDepInfo, & + DataHandle , Status ) + + RETURN +END SUBROUTINE ext_int_open_for_read + + + +SUBROUTINE int_get_ti_header_c ( hdrbuf, hdrbufsize, n, itypesize, typesize, & + DataHandle, Data, Count, code ) + +RETURN +END SUBROUTINE int_get_ti_header_c + + +! NETCDF STUBS +SUBROUTINE ext_ncd_ioinit(SysDepInfo, Status) + +RETURN +END SUBROUTINE ext_ncd_ioinit + + +subroutine ext_ncd_open_for_read(DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status) + +RETURN +END subroutine ext_ncd_open_for_read + + +subroutine ext_ncd_get_dom_ti_integer(DataHandle,Element,Data,Count,OutCount,Status) + +RETURN +END subroutine ext_ncd_get_dom_ti_integer + + +subroutine ext_ncd_ioclose(DataHandle, Status) + + return +end subroutine ext_ncd_ioclose + + +subroutine ext_ncd_get_dom_ti_char(DataHandle,Element,Data,Status) + + return +end subroutine ext_ncd_get_dom_ti_char + + +subroutine ext_ncd_get_dom_ti_real(DataHandle,Element,Data,Count,Status) + + return +end subroutine ext_ncd_get_dom_ti_real + + +subroutine ext_ncd_get_var_info(DataHandle,Name,NDim,MemoryOrder, & + Stagger,DomainStart,DomainEnd,WrfType,Status) + + return +end subroutine ext_ncd_get_var_info + + +subroutine ext_ncd_read_field(DataHandle,DateStr,Var,Field,FieldType,Comm, & + IOComm, DomainDesc, MemoryOrdIn, Stagger, DimNames, & + DomainStart,DomainEnd,MemoryStart,MemoryEnd,PatchStart,PatchEnd,Status) + + return +end subroutine ext_ncd_read_field + + +subroutine wrf_error_fatal(massage) + +stop +end subroutine wrf_error_fatal + + +subroutine int_gen_ti_header_c ( hdrbuf, hdrbufsize, itypesize, typesize, & + DataHandle, Data, Count, code ) + RETURN +END SUBROUTINE int_gen_ti_header_c + + + + + + + From 85d6cba83d931e973db184ff15bfbcae691c6613 Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Thu, 10 Oct 2019 17:29:37 +0000 Subject: [PATCH 02/85] updated for umbrella build --- .gitmodules | 3 + CMakeLists.txt | 2 + cmake | 1 + cmake/Modules/FindBACIO.cmake | 40 - cmake/Modules/FindBACIO.cmake.orig | 63 - cmake/Modules/FindBUFR.cmake | 44 - cmake/Modules/FindBaselibs.cmake | 70 - cmake/Modules/FindCRTM.cmake | 41 - cmake/Modules/FindG2.cmake | 45 - cmake/Modules/FindG2C.cmake | 33 - cmake/Modules/FindG2TMPL.cmake | 41 - cmake/Modules/FindGEMPAK.cmake | 7 - cmake/Modules/FindGFSIO.cmake | 41 - cmake/Modules/FindGSICONTROL.cmake | 54 - cmake/Modules/FindHDF5.cmake | 25 - cmake/Modules/FindIP.cmake | 46 - cmake/Modules/FindMPI.cmake | 18 - cmake/Modules/FindNDATE.cmake | 13 - cmake/Modules/FindNEMSIO.cmake | 41 - cmake/Modules/FindNetCDF.cmake | 145 -- cmake/Modules/FindSFCIO.cmake | 42 - cmake/Modules/FindSIGIO.cmake | 42 - cmake/Modules/FindSP.cmake | 43 - cmake/Modules/FindW3EMC.cmake | 49 - cmake/Modules/FindW3NCO.cmake | 44 - cmake/Modules/FindWRF.cmake | 36 - .../NewCMake/CMakeParseArguments.cmake | 11 - cmake/Modules/NewCMake/FindHDF5.cmake | 934 ---------- cmake/Modules/NewCMake/FindMPI.cmake | 1514 ----------------- .../NewCMake/FindMPI/fortranparam_mpi.f90.in | 4 - cmake/Modules/NewCMake/FindMPI/libver_mpi.c | 19 - .../NewCMake/FindMPI/libver_mpi.f90.in | 7 - cmake/Modules/NewCMake/FindMPI/mpiver.f90.in | 10 - cmake/Modules/NewCMake/FindMPI/test_mpi.c | 37 - .../Modules/NewCMake/FindMPI/test_mpi.f90.in | 6 - .../FindPackageHandleStandardArgs.cmake | 386 ----- .../Modules/NewCMake/FindPackageMessage.cmake | 47 - .../SelectLibraryConfigurations.cmake | 70 - .../Testing/Temporary/CTestCostData.txt | 1 - cmake/Modules/Testing/Temporary/LastTest.log | 3 - cmake/Modules/comp_src.pl | 15 - cmake/Modules/findHelpers.cmake | 65 - cmake/Modules/findHelpers.cmake.orig | 69 - cmake/Modules/platforms/Cheyenne.cmake | 24 - cmake/Modules/platforms/Discover.cmake | 21 - cmake/Modules/platforms/Gaea.cmake | 14 - cmake/Modules/platforms/Generic.cmake | 16 - cmake/Modules/platforms/Generic.cmake.orig | 25 - cmake/Modules/platforms/Jet.cmake | 10 - cmake/Modules/platforms/S4.cmake | 10 - cmake/Modules/platforms/Theia.cmake | 55 - cmake/Modules/platforms/WCOSS-C.cmake | 60 - cmake/Modules/platforms/WCOSS-D.cmake | 21 - cmake/Modules/platforms/WCOSS.cmake | 61 - cmake/Modules/setCompilerFlags.cmake.orig | 167 -- cmake/Modules/setGNUFlags.cmake | 62 - cmake/Modules/setHOST.cmake | 96 -- cmake/Modules/setIntelFlags.cmake | 87 - cmake/Modules/setPGIFlags.cmake | 78 - cmake/Modules/setPlatformVariables.cmake | 10 - sorc/ncep_post.fd/CMakeLists.txt | 6 +- 61 files changed, 9 insertions(+), 5041 deletions(-) create mode 100644 .gitmodules create mode 160000 cmake delete mode 100644 cmake/Modules/FindBACIO.cmake delete mode 100644 cmake/Modules/FindBACIO.cmake.orig delete mode 100644 cmake/Modules/FindBUFR.cmake delete mode 100644 cmake/Modules/FindBaselibs.cmake delete mode 100644 cmake/Modules/FindCRTM.cmake delete mode 100644 cmake/Modules/FindG2.cmake delete mode 100644 cmake/Modules/FindG2C.cmake delete mode 100644 cmake/Modules/FindG2TMPL.cmake delete mode 100644 cmake/Modules/FindGEMPAK.cmake delete mode 100644 cmake/Modules/FindGFSIO.cmake delete mode 100644 cmake/Modules/FindGSICONTROL.cmake delete mode 100644 cmake/Modules/FindHDF5.cmake delete mode 100644 cmake/Modules/FindIP.cmake delete mode 100644 cmake/Modules/FindMPI.cmake delete mode 100644 cmake/Modules/FindNDATE.cmake delete mode 100644 cmake/Modules/FindNEMSIO.cmake delete mode 100644 cmake/Modules/FindNetCDF.cmake delete mode 100644 cmake/Modules/FindSFCIO.cmake delete mode 100644 cmake/Modules/FindSIGIO.cmake delete mode 100644 cmake/Modules/FindSP.cmake delete mode 100644 cmake/Modules/FindW3EMC.cmake delete mode 100644 cmake/Modules/FindW3NCO.cmake delete mode 100644 cmake/Modules/FindWRF.cmake delete mode 100644 cmake/Modules/NewCMake/CMakeParseArguments.cmake delete mode 100644 cmake/Modules/NewCMake/FindHDF5.cmake delete mode 100644 cmake/Modules/NewCMake/FindMPI.cmake delete mode 100644 cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in delete mode 100644 cmake/Modules/NewCMake/FindMPI/libver_mpi.c delete mode 100644 cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in delete mode 100644 cmake/Modules/NewCMake/FindMPI/mpiver.f90.in delete mode 100644 cmake/Modules/NewCMake/FindMPI/test_mpi.c delete mode 100644 cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in delete mode 100644 cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake delete mode 100644 cmake/Modules/NewCMake/FindPackageMessage.cmake delete mode 100644 cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake delete mode 100644 cmake/Modules/Testing/Temporary/CTestCostData.txt delete mode 100644 cmake/Modules/Testing/Temporary/LastTest.log delete mode 100755 cmake/Modules/comp_src.pl delete mode 100644 cmake/Modules/findHelpers.cmake delete mode 100644 cmake/Modules/findHelpers.cmake.orig delete mode 100644 cmake/Modules/platforms/Cheyenne.cmake delete mode 100644 cmake/Modules/platforms/Discover.cmake delete mode 100644 cmake/Modules/platforms/Gaea.cmake delete mode 100644 cmake/Modules/platforms/Generic.cmake delete mode 100644 cmake/Modules/platforms/Generic.cmake.orig delete mode 100644 cmake/Modules/platforms/Jet.cmake delete mode 100644 cmake/Modules/platforms/S4.cmake delete mode 100644 cmake/Modules/platforms/Theia.cmake delete mode 100644 cmake/Modules/platforms/WCOSS-C.cmake delete mode 100644 cmake/Modules/platforms/WCOSS-D.cmake delete mode 100644 cmake/Modules/platforms/WCOSS.cmake delete mode 100644 cmake/Modules/setCompilerFlags.cmake.orig delete mode 100644 cmake/Modules/setGNUFlags.cmake delete mode 100644 cmake/Modules/setHOST.cmake delete mode 100644 cmake/Modules/setIntelFlags.cmake delete mode 100644 cmake/Modules/setPGIFlags.cmake delete mode 100644 cmake/Modules/setPlatformVariables.cmake diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..dffa9cbe3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cmake"] + path = cmake + url = git@github.com:NOAA-EMC/CMakeModules diff --git a/CMakeLists.txt b/CMakeLists.txt index a32bbd683..1f179e088 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,4 +59,6 @@ find_package( W3EMC ) find_package( CRTM ) find_package( NetCDF ) +include_directories(${CMAKE_INSTALL_PREFIX}/include_d) + add_subdirectory(sorc/ncep_post.fd) diff --git a/cmake b/cmake new file mode 160000 index 000000000..f06f9f5fe --- /dev/null +++ b/cmake @@ -0,0 +1 @@ +Subproject commit f06f9f5fea223482f66b788778966041fd83bbce diff --git a/cmake/Modules/FindBACIO.cmake b/cmake/Modules/FindBACIO.cmake deleted file mode 100644 index 20bcdfad2..000000000 --- a/cmake/Modules/FindBACIO.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# This module looks for environment variables detailing where BACIO lib is -# If variables are not set, BACIO will be built from external source -include(ExternalProject) -if(DEFINED ENV{BACIO_LIB4} ) - set(BACIO_LIBRARY $ENV{BACIO_LIB4} CACHE STRING "BACIO Library Location" ) - set(BACIO_VER $ENV{BACIO_VER} CACHE STRING "BACIO Version") - set(BACIO_8_LIBRARY $ENV{BACIO_LIBd} CACHE STRING "BACIO_8 Library Location") - set(BACIO_d_LIBRARY $ENV{BACIO_LIBd} CACHE STRING "BACIO_8 Library Location") -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-bacio - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-bacio - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-bacio - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-bacio OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("bacio version is ${LIBVERSION}") - set( BACIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libbacio_${LIBVERSION}_4.a ) - set( BACIO_8_LIBRARY ${PROJECT_BINARY_DIR}/lib/libbacio_${LIBVERSION}_4.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${BACIO_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-bacio ) - else() - set( CORE_BUILT ${BACIO_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-bacio ) - endif() - - set( BACIO_LIBRARY_PATH ${BACIO_LIBRARY} CACHE STRING "BACIO Library Location" ) -endif() diff --git a/cmake/Modules/FindBACIO.cmake.orig b/cmake/Modules/FindBACIO.cmake.orig deleted file mode 100644 index c09df72a1..000000000 --- a/cmake/Modules/FindBACIO.cmake.orig +++ /dev/null @@ -1,63 +0,0 @@ -# This module looks for environment variables detailing where BACIO lib is -# If variables are not set, BACIO will be built from external source -include(ExternalProject) -if((NOT BUILD_BACIO ) AND (DEFINED ENV{BACIO_LIB4})) - set(BACIO_LIBRARY $ENV{BACIO_LIB4} ) -<<<<<<< HEAD - else() - find_library( BACIO_LIBRARY - NAMES libbacio.a libbacio_4.a libbacio_v${BACIO_VER}_4.a - HINTS $ENV{COREPATH}/lib /usr/local/jcsda/nwprod_gdas_2014/lib - ${COREPATH}/bacio/v${BACIO_VER} - ${COREPATH}/bacio/v${BACIO_VER}/intel - ${COREPATH}/bacio/v${BACIO_VER}/ips/${COMPILER_VERSION} - PATH_SUFFIXES - lib - ${NO_DEFAULT_PATH} - ) - message("Found BACIO library ${BACIO_LIBRARY}") - endif() - set( bacio ${BACIO_LIBRARY}) -endif() -if( NOT BACIO_LIBRARY ) # didn't find the library, so build it from source - message("Could not find BACIO library, so building from libsrc") - if( DEFINED ENV{BACIO_SRC} ) - set( BACIO_DIR $ENV{BACIO_SRC} CACHE STRING "BACIO Source Directory" ) -======= - if( CORE_LIBRARIES ) - list( APPEND CORE_LIBRARIES ${BACIO_LIBRARY} ) ->>>>>>> debug-fix - else() - set( CORE_LIBRARIES ${BACIO_LIBRARY} ) - endif() -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-bacio - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-bacio - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-bacio - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-bacio OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("bacio version is ${LIBVERSION}") - set( BACIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libbacio_${LIBVERSION}_4.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${BACIO_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-bacio ) - else() - set( CORE_BUILT ${BACIO_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-bacio ) - endif() -endif( ) - -set( BACIO_LIBRARY_PATH ${BACIO_LIBRARY} CACHE STRING "BACIO Library Location" ) - diff --git a/cmake/Modules/FindBUFR.cmake b/cmake/Modules/FindBUFR.cmake deleted file mode 100644 index 7f92204f9..000000000 --- a/cmake/Modules/FindBUFR.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# This module looks for environment variables detailing where BUFR lib is -# If variables are not set, BUFR will be built from external source -include(ExternalProject) -if(DEFINED ENV{BUFR_LIB4} ) - set(BUFR_LIBRARY $ENV{BUFR_LIBd} CACHE STRING "BUFR Library Location" ) - set(BUFR_VER $ENV{BUFR_VER} CACHE STRING "BUFR Version") - set(BUFR_8_LIBRARY $ENV{BUFR_LIB8} CACHE STRING "BUFR_8 Library Location") - set(BUFR_4_LIBRARY $ENV{BUFR_LIB4} CACHE STRING "BUFR_4 Library Location") - set(BUFR_4DA_LIBRARY $ENV{BUFR_LIB4_DA} CACHE STRING "BUFR_DA_4 Library Location") -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-bufr - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-bufr - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - -DGSIBUILD=ON - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-bufr - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-bufr OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("bufr version is ${LIBVERSION}") - set( BUFR_LIBRARY ${PROJECT_BINARY_DIR}/lib/libbufr_${LIBVERSION}_d.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${BUFR_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-bufr ) - else() - set( CORE_BUILT ${BUFR_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-bufr ) - endif() -endif() - -set( BUFR_LIBRARY_PATH ${BUFR_LIBRARY} CACHE STRING "BUFR Library Location" ) -set( BUFR_4_LIBRARY_PATH ${BUFR_4_LIBRARY} CACHE STRING "BUFR Library Location" ) -set( BUFR_8_LIBRARY_PATH ${BUFR_8_LIBRARY} CACHE STRING "BUFR Library Location" ) - diff --git a/cmake/Modules/FindBaselibs.cmake b/cmake/Modules/FindBaselibs.cmake deleted file mode 100644 index 86a377641..000000000 --- a/cmake/Modules/FindBaselibs.cmake +++ /dev/null @@ -1,70 +0,0 @@ -if (NOT DEFINED ENV{BASEDIR}) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" ) - string(REGEX MATCH "mpt" MPT ${MPI_Fortran_INCLUDE_PATH}) - string(REGEX MATCH "impi" IMPI ${MPI_Fortran_INCLUDE_PATH}) - message("REGEX returns ${MPT} ") - if( MPT MATCHES "mpt" ) - message("setting mpt paths ") - set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_2/x86_64-unknown-linux-gnu/ifort_15.0.2.164-mpt_2.14/Linux") - elseif( IMPI MATCHES "impi" ) - set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_2/x86_64-unknown-linux-gnu/ifort_16.0.3.210-intelmpi_5.1.3.210/Linux") - else() - message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") - endif() - message("compiler version is ${COMPILER_VERSION}") - endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU*" ) - string(REGEX MATCH "openmpi" OPENMPI ${MPI_Fortran_INCLUDE_PATH}) - message("REGEX returns ${OPENMPI} ") - if( OPENMPI MATCHES "openmpi" ) - message("setting openmpi paths ") - set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-4_0_8/x86_64-unknown-linux-gnu/gfortran_7.2.0-openmpi_3.0.0/Linux") - else() - message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") - endif() - message("compiler version is ${COMPILER_VERSION}") - endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "pgc*" ) - string(REGEX MATCH "openmpi" OPENMPI ${MPI_Fortran_INCLUDE_PATH}) - if( OPENMPI MATCHES "openmpi" ) - set(BASEDIR "/discover/swdev/mathomp4/Baselibs/GMAO-Baselibs-5_0_1/x86_64-unknown-linux-gnu/pgfortran_16.5-openmpi_1.10.3/Linux") - else() - message (FATAL_ERROR "ERROR: Could not find matching BASELIBS Must specify a value for BASEDIR with cmake ... -DBASEDIR=.") - endif() - message("compiler version is ${COMPILER_VERSION}") - endif() -else() - set(BASEDIR $ENV{BASEDIR}) -endif () -if (ESMA_SDF) - message (FATAL_ERROR "ERROR: -hdf option was thought to be obsolete when CMake was crafted.") -endif () - -link_directories (${BASEDIR}/lib) - -#------------------------------------------------------------------ -# netcdf -# The following command provides the list of libraries that netcdf -# uses. Unfortunately it also includes the library path and "-l" -# prefixes, which CMake handles in a different manner. So we need so -# strip off that item from the list -execute_process ( - COMMAND ${BASEDIR}/bin/nf-config --flibs - OUTPUT_VARIABLE LIB_NETCDF - ) - -string(REGEX MATCHALL " -l[^ ]*" _full_libs "${LIB_NETCDF}") -set (NETCDF_LIBRARIES CACHE INTERNAL "netcdf libs" ) -set (NETCDF_INCLUDES CACHE INTERNAL "netcdf includes" ) -foreach (lib ${_full_libs}) - string (REPLACE "-l" "" _tmp ${lib}) - string (STRIP ${_tmp} _tmp) - list (APPEND NETCDF_LIBRARIES ${_tmp}) -endforeach() -#------------------------------------------------------------------ - -list(APPEND NETCDF_INCLUDES ${BASEDIR}/include/netcdf) -list(APPEND NETCDF_INCLUDES ${BASEDIR}/include/hdf5) - -message(STATUS "NETCDF_INCLUDES: ${NETCDF_INCLUDES}") -message(STATUS "NETCDF_LIBRARIES: ${NETCDF_LIBRARIES}") diff --git a/cmake/Modules/FindCRTM.cmake b/cmake/Modules/FindCRTM.cmake deleted file mode 100644 index c9e685134..000000000 --- a/cmake/Modules/FindCRTM.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# This module looks for environment variables detailing where CRTM lib is -# If variables are not set, CRTM will be built from external source -include(ExternalProject) -if(DEFINED ENV{CRTM_LIB} ) - message("HEY!! setting CRTM library via environment variable") - set(CRTM_LIBRARY $ENV{CRTM_LIB} CACHE STRING "CRTM Library Location" ) - set(CRTM_INC $ENV{CRTM_INC} CACHE STRING "CRTM Include Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-crtm - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-crtm - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-crtm - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-crtm OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("crtm version is ${LIBVERSION}") - set( CRTM_LIBRARY ${PROJECT_BINARY_DIR}/lib/libcrtm_${LIBVERSION}_d.a ) - set( CRTM_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libcrtm_${LIBVERSION}_4.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${CRTM_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-crtm ) - else() - set( CORE_BUILT ${CRTM_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-crtm ) - endif() - -endif() - -set( CRTM_LIBRARY_PATH ${CRTM_LIBRARY} CACHE STRING "CRTM Library Location" ) -set( CRTM_INCLUDE_PATH ${CRTM_INC} CACHE STRING "CRTM Include Location" ) diff --git a/cmake/Modules/FindG2.cmake b/cmake/Modules/FindG2.cmake deleted file mode 100644 index c7087fe87..000000000 --- a/cmake/Modules/FindG2.cmake +++ /dev/null @@ -1,45 +0,0 @@ -# This module looks for environment variables detailing where G2 lib is -# If variables are not set, G2 will be built from external source -include(ExternalProject) -if(DEFINED ENV{G2_DIR} ) - message("HEY!! setting G2 library via environment variable") - set(G2_LIBRARY $ENV{G2_LIBd} CACHE STRING "G2 Library Location" ) - set(G2_4_LIBRARY $ENV{G2_LIB4} CACHE STRING "G2_4 Library Location" ) - set(G2_INC4 $ENV{G2_INC4} CACHE STRING "G2_4 Include Location" ) - set(G2_INCd $ENV{G2_INCd} CACHE STRING "G2_d Include Location" ) - set(G2_LIBRARY_PATH ${G2_LIBRARY} CACHE STRING "G2 Library Location" ) - set(G2_4_LIBRARY_PATH ${G2_4_LIBRARY} CACHE STRING "G2_4 Library Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-g2 - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-g2 - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2 - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2 OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("g2 version is ${LIBVERSION}") - set( G2_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2_${LIBVERSION}_d.a ) - set( G2_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2_${LIBVERSION}_4.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${G2_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-g2 ) - else() - set( CORE_BUILT ${G2_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-g2 ) - endif() - - set( G2_LIBRARY_PATH ${G2_LIBRARY} CACHE STRING "G2 Library Location" ) - set( G2_4_LIBRARY_PATH ${G2_4_LIBRARY} CACHE STRING "G2_4 Library Location" ) - -endif() diff --git a/cmake/Modules/FindG2C.cmake b/cmake/Modules/FindG2C.cmake deleted file mode 100644 index 70a91e678..000000000 --- a/cmake/Modules/FindG2C.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# This module looks for environment variables detailing where G2 lib is -# If variables are not set, G2 will be built from external source -include(ExternalProject) -set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) -ExternalProject_Add(NCEPLIBS-g2c - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-g2c - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2c - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install -) -execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2c OUTPUT_VARIABLE LIBVERSION) -string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) -string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) -string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) -message("g2c version is ${LIBVERSION}") -set( G2_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2c_${LIBVERSION}.a ) -if( CORE_BUILT ) - list( APPEND CORE_BUILT ${G2_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-g2c ) -else() - set( CORE_BUILT ${G2_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-g2c ) -endif() - -set( G2_LIBRARY_PATH ${G2_LIBRARY} CACHE STRING "G2 Library Location" ) - diff --git a/cmake/Modules/FindG2TMPL.cmake b/cmake/Modules/FindG2TMPL.cmake deleted file mode 100644 index b994d764e..000000000 --- a/cmake/Modules/FindG2TMPL.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# This module looks for environment variables detailing where G2TMPL lib is -# If variables are not set, G2TMPL will be built from external source -include(ExternalProject) -if(DEFINED ENV{G2TMPL_DIR} ) - message("HEY!! setting G2TMPL library via environment variable") - set(G2TMPL_LIBRARY $ENV{G2TMPL_LIBd} CACHE STRING "G2TMPL Library Location" ) - set(G2TMPL_INC $ENV{G2TMPL_INCd} CACHE STRING "G2TMPL_d Include Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-g2tmpl - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-g2tmpl - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2tmpl - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-g2tmpl OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("g2tmpl version is ${LIBVERSION}") - set( G2TMPL_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2tmpl_${LIBVERSION}_d.a ) - set( G2TMPL_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libg2tmpl_${LIBVERSION}_4.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${G2TMPL_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-g2tmpl ) - else() - set( CORE_BUILT ${G2TMPL_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-g2tmpl ) - endif() - - set( G2TMPL_LIBRARY_PATH ${G2TMPL_LIBRARY} CACHE STRING "G2TMPL Library Location" ) - set( G2TMPL_INCLUDE_PATH ${G2TMPL_INC} CACHE STRING "G2TMPL Include Location" ) - -endif() diff --git a/cmake/Modules/FindGEMPAK.cmake b/cmake/Modules/FindGEMPAK.cmake deleted file mode 100644 index fc7f8c127..000000000 --- a/cmake/Modules/FindGEMPAK.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# - Find GEMPAK -if(DEFINED ENV{GEMPAK}) - set(GEMINC $ENV{GEMPAK}/include CACHE STRING "GEMPAK Include Path" ) - set(OS_INC $ENV{OS_INC} CACHE STRING "GEMPAK OS Include Path" ) -else () - message(FATAL_ERROR "Could not find GEMPAK module") -endif() diff --git a/cmake/Modules/FindGFSIO.cmake b/cmake/Modules/FindGFSIO.cmake deleted file mode 100644 index 47960715d..000000000 --- a/cmake/Modules/FindGFSIO.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# This module looks for environment variables detailing where GFSIO lib is -# If variables are not set, GFSIO will be built from external source -include(ExternalProject) -if(DEFINED ENV{GFSIO_DIR} ) - message("HEY!! setting GFSIO library via environment variable") - set(GFSIO_LIBRARY $ENV{GFSIO_LIB4} CACHE STRING "GFSIO Library Location" ) - set(GFSIO_INC $ENV{GFSIO_INC4} CACHE STRING "GFSIO_4 Include Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-gfsio - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-gfsio - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-gfsio - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-gfsio OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("gfsio version is ${LIBVERSION}") - set( GFSIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libgfsio_${LIBVERSION}_d.a ) - set( GFSIO_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libgfsio_${LIBVERSION}_4.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${GFSIO_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-gfsio ) - else() - set( CORE_BUILT ${GFSIO_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-gfsio ) - endif() - - set( GFSIO_LIBRARY_PATH ${GFSIO_LIBRARY} CACHE STRING "GFSIO Library Location" ) - set( GFSIO_INCLUDE_PATH ${GFSIO_INC} CACHE STRING "GFSIO Include Location" ) - -endif() diff --git a/cmake/Modules/FindGSICONTROL.cmake b/cmake/Modules/FindGSICONTROL.cmake deleted file mode 100644 index 8b5ced537..000000000 --- a/cmake/Modules/FindGSICONTROL.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# - Find the Control version of GSI to use for regression testing - -set( NO_DEFAULT_PATH ) -message("Control path is ${CONTROLPATH}") -find_file( CONTROL_EXE - NAMES gsi.x global_gsi ${GSIEXEC} - HINTS - ${CONTROLPATH} - ${CONTROLPATH}/bin - ${CONTROLPATH}/exec - $ENV{CONTROLPATH} - $ENV{CONTROLPATH}/bin - $ENV{CONTROLPATH}/exec - $ENV{CONTROLPATH}/src - ${CMAKE_SOURCE_DIR}/../trunk/src - ${CMAKE_SOURCE_DIR}/../../trunk/src - ${PROJECT_BINARY_DIR}/../build-trunk/bin - /da/save/Michael.Lueken/svn1/build/bin - /da/save/Michael.Lueken/svn1/src - /gpfs/dell2/emc/modeling/noscrub/Michael.Lueken/svn1/build/bin - /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/build/bin - /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/src - /scratch4/NCEPDEV/da/save/Michael.Lueken/svn1_old/build/bin - /scratch4/NCEPDEV/da/save/Michael.Lueken/svn1/src - - ${NO_DEFAULT_PATH}) - -set( GSICONTROL ${CONTROL_EXE} CACHE STRING "GSI control executable for regression testing" FORCE ) - -find_file( ENKF_CONTROL_EXE - NAMES enkf_gfs.x global_enkf ${ENKFEXEC} - HINTS - ${CONTROLPATH} - ${CONTROLPATH}/bin - ${CONTROLPATH}/exec - $ENV{CONTROLPATH} - $ENV{CONTROLPATH}/bin - $ENV{CONTROLPATH}/exec - ${CMAKE_SOURCE_DIR}/../trunk/src/enkf - ${PROJECT_BINARY_DIR}/../build-trunk/bin - $ENV{CONTROLPATH}/enkf - $ENV{CONTROLPATH}/src/enkf - /da/save/Michael.Lueken/svn1/build/bin - /da/save/Michael.Lueken/svn1/src/enkf - /gpfs/dell2/emc/modeling/noscrub/Michael.Lueken/svn1/build/bin - /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/build/bin - /gpfs/hps3/emc/da/noscrub/Michael.Lueken/svn1/src/enkf - /scratch4/NCEPDEV/da/save/Michael.Lueken/svn1_old/build/bin - /scratch4/NCEPDEV/da/save/Michael.Lueken/svn1/src/enkf - - ${NO_DEFAULT_PATH}) - -set( ENKFCONTROL ${ENKF_CONTROL_EXE} CACHE STRING "ENKF control executable for regression testing" FORCE ) - diff --git a/cmake/Modules/FindHDF5.cmake b/cmake/Modules/FindHDF5.cmake deleted file mode 100644 index 15525f96e..000000000 --- a/cmake/Modules/FindHDF5.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# This extends CMake's FindHDF5.cmake to add support to include MPI include -# paths and libraries in the HDF5 ones if HDF5_IS_PARALLEL is ON -# (BUG #0014363). - -# include the default FindHDF5.cmake. -#if(CMAKE_VERSION VERSION_LESS 3.6.1) -if(CMAKE_VERSION VERSION_GREATER 3.0 ) - include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindHDF5.cmake) -else() - include(${CMAKE_ROOT}/Modules/FindHDF5.cmake) -endif() -#endif() - -if(HDF5_FOUND AND (HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)) -# include(vtkMPI) - if(MPI_C_INCLUDE_PATH) - list(APPEND HDF5_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH}) - endif() - if(MPI_C_LIBRARIES) - list(APPEND HDF5_LIBRARIES ${MPI_C_LIBRARIES}) - endif() - if(MPI_CXX_LIBRARIES) - list(APPEND HDF5_LIBRARIES ${MPI_CXX_LIBRARIES}) - endif() -endif() diff --git a/cmake/Modules/FindIP.cmake b/cmake/Modules/FindIP.cmake deleted file mode 100644 index 3f4a991a5..000000000 --- a/cmake/Modules/FindIP.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# This module looks for environment variables detailing where IP lib is -# If variables are not set, IP will be built from external source - -include(ExternalProject) -if(DEFINED ENV{IP_LIBd} ) - message("HEY!! setting IP library via environment variable") - set(IP_LIBRARY $ENV{IP_LIBd} CACHE STRING "IP Library Location" ) - set(IP_4_LIBRARY $ENV{IP_LIB4} CACHE STRING "IP_4 Library Location" ) - set(IP_8_LIBRARY $ENV{IP_LIB4} CACHE STRING "IP_8 Library Location" ) - set(IP_INC4 $ENV{IP_INC4} CACHE STRING "IP_4 Include Location" ) - set(IP_INC8 $ENV{IP_INC8} CACHE STRING "IP_8 Include Location" ) - set(IP_INCd $ENV{IP_INCd} CACHE STRING "IP_8 Include Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-ip - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-ip - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-ip - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-ip OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("ip version is ${LIBVERSION}") - set( IP_LIBRARY ${PROJECT_BINARY_DIR}/lib/libip_${LIBVERSION}_d.a ) - set( IP_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libip_${LIBVERSION}_4.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${IP_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-ip ) - else() - set( CORE_BUILT ${IP_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-ip ) - endif() -endif() - -set( IP_LIBRARY_PATH ${IP_LIBRARY} CACHE STRING "IP Library Location" ) -set( IP_4_LIBRARY_PATH ${IP_4_LIBRARY} CACHE STRING "IP_4 Library Location" ) - diff --git a/cmake/Modules/FindMPI.cmake b/cmake/Modules/FindMPI.cmake deleted file mode 100644 index 8e0a0c95b..000000000 --- a/cmake/Modules/FindMPI.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# This extends CMake's FindHDF5.cmake to add support to include MPI include -# paths and libraries in the HDF5 ones if HDF5_IS_PARALLEL is ON -# (BUG #0014363). - -# include the default FindMPI.cmake. -if(CMAKE_VERSION VERSION_LESS 3.1) - include(${CMAKE_ROOT}/Modules/FindMPI.cmake) -elseif(CMAKE_VERSION VERSION_LESS 3.6) - message("Using new FindMPI") - include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindMPI.cmake) -# set(MPI_Fortran_INCLUDE_DIRS ${MPI_Fortran_INCLUDE_PATH} CACHE INTERNAL "Deprecated Variable Name") -else() - message("Using installed FindMPI") - include(${CMAKE_ROOT}/Modules/FindMPI.cmake) -# set(MPI_Fortran_INCLUDE_DIRS ${MPI_Fortran_INCLUDE_PATH} CACHE INTERNAL "Deprecated Variable Name") - message("include dirs are ${MPI_Fortran_INCLUDE_DIRS}") - message("include PATH ${MPI_Fortran_INCLUDE_PATH}") -endif() diff --git a/cmake/Modules/FindNDATE.cmake b/cmake/Modules/FindNDATE.cmake deleted file mode 100644 index 44bf4f1cd..000000000 --- a/cmake/Modules/FindNDATE.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# - Find the NDATE utility or build it - -set( NO_DEFAULT_PATH ) -if(DEFINED ENV{NDATE}) - set(NDATE $ENV{NDATE} ) -else() - find_file( NDATE - NAMES ndate.x ndate - HINTS - /nwprod/util/exec - $ENV{NWPROD}/util/exec - ${NO_DEFAULT_PATH}) -endif() diff --git a/cmake/Modules/FindNEMSIO.cmake b/cmake/Modules/FindNEMSIO.cmake deleted file mode 100644 index c202b8b9c..000000000 --- a/cmake/Modules/FindNEMSIO.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# This module looks for environment variables detailing where NEMSIO lib is -# If variables are not set, NEMSIO will be built from external source -include(ExternalProject) -if(DEFINED ENV{NEMSIO_LIB} ) - message("HEY!! setting NEMSIO library via environment variable") - set(NEMSIO_LIBRARY $ENV{NEMSIO_LIB} CACHE STRING "IP Library Location" ) - set(NEMSIOINC $ENV{NEMSIO_INC} CACHE STRING "NEMSIO_4 Include Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-nemsio - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-nemsio - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-nemsio - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-nemsio OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("nemsio version is ${LIBVERSION}") - set( NEMSIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libnemsio_${LIBVERSION}.a ) - set( NEMSIOINC ${PROJECT_BINARY_DIR}/include ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${NEMSIO_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-nemsio) - else() - set( CORE_BUILT ${NEMSIO_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-nemsio) - endif() -endif() - -set( NEMSIO_LIBRARY_PATH ${NEMSIO_LIBRARY} CACHE STRING "NEMSIO Library Location" ) -set( NEMSIO_INCLUDE_PATH ${NEMSIOINC} CACHE STRING "NEMSIO Include Location" ) - diff --git a/cmake/Modules/FindNetCDF.cmake b/cmake/Modules/FindNetCDF.cmake deleted file mode 100644 index cf095d53b..000000000 --- a/cmake/Modules/FindNetCDF.cmake +++ /dev/null @@ -1,145 +0,0 @@ -# - Find NetCDF -# Find the native NetCDF includes and library -# -# NETCDF_INCLUDES - where to find netcdf.h, etc -# NETCDF_LIBRARIES - Link these libraries when using NetCDF -# NETCDF_FOUND - True if NetCDF found including required interfaces (see below) -# -# Your package can require certain interfaces to be FOUND by setting these -# -# NETCDF_CXX - require the C++ interface and link the C++ library -# NETCDF_F77 - require the F77 interface and link the fortran library -# NETCDF_F90 - require the F90 interface and link the fortran library -# -# The following are not for general use and are included in -# NETCDF_LIBRARIES if the corresponding option above is set. -# -# NETCDF_LIBRARIES_C - Just the C interface -# NETCDF_LIBRARIES_CXX - C++ interface, if available -# NETCDF_LIBRARIES_F77 - Fortran 77 interface, if available -# NETCDF_LIBRARIES_F90 - Fortran 90 interface, if available -# -# Normal usage would be: -# set (NETCDF_F90 "YES") -# find_package (NetCDF REQUIRED) -# target_link_libraries (uses_f90_interface ${NETCDF_LIBRARIES}) -# target_link_libraries (only_uses_c_interface ${NETCDF_LIBRARIES_C}) - - -set(NETCDF_DIR $ENV{NETCDF}) - -if (NETCDF_INCLUDES AND NETCDF_LIBRARIES) - # Already in cache, be silent - set (NETCDF_FIND_QUIETLY TRUE) -endif (NETCDF_INCLUDES AND NETCDF_LIBRARIES) - -if(DEFINED ENV{NETCDF4}) - set(NETCDF_DIR $ENV{NETCDF4}) -elseif(DEFINED ENV{NETCDF_DIR}) - set(NETCDF_DIR $ENV{NETCDF_DIR}) -elseif(DEFINED ENV{NETCDF_HOME}) - set(NETCDF_DIR $ENV{NETCDF_HOME}) -elseif( DEFINED ENV{NETCDF} ) - set(NETCDF_DIR $ENV{NETCDF}) -elseif(DEFINED ENV{SSEC_NETCDF4_DIR}) - set(NETCDF_DIR $ENV{SSEC_NETCDF4_DIR}) -elseif(DEFINED ENV{SSEC_NETCDF_DIR}) - set(NETCDF_DIR $ENV{SSEC_NETCDF_DIR}) -endif() -if(DEFINED ENV{NETCDF_FORTRAN}) - set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN}) -elseif(DEFINED ENV{NETCDF_FORTRAN_DIR}) - set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN_DIR}) -endif() -find_path (NETCDF_INCLUDES netcdf.h - HINTS ${NETCDF_DIR}/include $ENV{SSEC_NETCDF_DIR}/include ) - -find_program (NETCDF_META netcdf_meta.h - HINTS ${NETCDF_INCLUDES} ${CMAKE_INSTALL_PREFIX} - ) -if (NETCDF_META) - file (STRINGS ${NETCDF_META} NETCDF_VERSION REGEX "define NC_VERSION_MAJOR") - string (REGEX REPLACE "#define NC_VERSION_MAJOR " "" NETCDF_VERSION ${NETCDF_VERSION}) - string (REGEX REPLACE "\\/\\*\\!< netcdf-c major version. \\*\\/" "" NETCDF_VERSION ${NETCDF_VERSION}) - string (REGEX REPLACE " " "" NETCDF_VERSION ${NETCDF_VERSION} ) - if(${NETCDF_VERSION} GREATER "3") - set(NETCDF_F90 "YES") - endif() -endif (NETCDF_META) - -find_library (NETCDF_flib - names libnetcdff.a netcdff.a libnetcdff.so netcdff.so - HINTS - ${NETCDF_DIR}/lib - ${NETCDF_FORTRAN_DIR}/lib - ${NETCDF_FORTRAN}/lib - ${NETCDF_FORTRAN_ROOT}/lib -) - -if (NETCDF_flib) - set(NETCDF_F90 "YES") - -endif() -find_library (NETCDF_LIBRARIES_C - NAMES netcdf - HINTS ${NETCDF_DIR}/lib ) -mark_as_advanced(NETCDF_LIBRARIES_C) - -if("${NETCDF_DIR}" STREQUAL "") - message(FATAL_ERROR " - Cannot find NETCDF!!!! - - ") -endif() -find_file (NETCDF_NCDUMP - NAMES ncdump - HINTS ${NETCDF_DIR}/bin ) -mark_as_advanced(NETCDF_NCDUMP) -execute_process(COMMAND ${NETCDF_NCDUMP} - ERROR_VARIABLE NCDUMP_INFO) -string(FIND "${NCDUMP_INFO}" "version" VERSION_LOC REVERSE) -math(EXPR VERSION_LOC "${VERSION_LOC} + 9") -string(SUBSTRING "${NCDUMP_INFO}" ${VERSION_LOC} 1 NETCDF_MAJOR_VERSION) -if (${NETCDF_MAJOR_VERSION} LESS 4) - message(FATAL_ERROR " - Current NETCDF is ${NETCDF_DIR} - !!!! NETCDF version 4.0 and above is required !!!! - - ") -endif() - -set (NetCDF_has_interfaces "YES") # will be set to NO if we're missing any interfaces -set (NetCDF_libs ${NETCDF_LIBRARIES_C} ${NETCDF_LIBRARIES_Fortran}) -message("netcdf_libs is ${NetCDF_libs}") -get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARIES_C}" PATH) - -macro (NetCDF_check_interface lang header libs) - if (NETCDF_${lang}) - find_path (NETCDF_INCLUDES_${lang} NAMES ${header} - HINTS ${NETCDF_INCLUDES} ${NETCDF_FORTRAN}/include NO_DEFAULT_PATH) - find_library (NETCDF_LIBRARIES_${lang} NAMES ${libs} - HINTS ${NetCDF_lib_dirs} ${NETCDF_FORTRAN}/lib NO_DEFAULT_PATH) - mark_as_advanced (NETCDF_INCLUDES_${lang} NETCDF_LIBRARIES_${lang}) - if (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) - list (INSERT NetCDF_libs 0 ${NETCDF_LIBRARIES_${lang}}) # prepend so that -lnetcdf is last - else (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) - set (NetCDF_has_interfaces "NO") - message (STATUS "Failed to find NetCDF interface for ${lang}") - endif (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) - endif (NETCDF_${lang}) -endmacro (NetCDF_check_interface) - -NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++) -NetCDF_check_interface (F77 netcdf.inc netcdff) -NetCDF_check_interface (F90 netcdf.mod netcdff) -if( NETCDF_LIBRARIES_F90 ) - set( NETCDF4 "YES" ) -endif() - -set (NETCDF_LIBRARIES "${NetCDF_libs}" CACHE STRING "All NetCDF libraries required for interface level") -# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if -# all listed variables are TRUE -include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (NetCDF DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDES NetCDF_has_interfaces) - -mark_as_advanced (NETCDF_LIBRARIES NETCDF_INCLUDES) diff --git a/cmake/Modules/FindSFCIO.cmake b/cmake/Modules/FindSFCIO.cmake deleted file mode 100644 index e31d45b9d..000000000 --- a/cmake/Modules/FindSFCIO.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# This module looks for environment variables detailing where SFCIO lib is -# If variables are not set, SFCIO will be built from external source -include(ExternalProject) -if(DEFINED ENV{SFCIO_DIR} ) - message("HEY!! setting SFCIO library via environment variable") - set(SFCIO_LIBRARY $ENV{SFCIO_LIB} CACHE STRING "SP Library Location" ) - set(SFCIO_4_LIBRARY $ENV{SFCIO_LIB4} CACHE STRING "SFCIO4 Library Location" ) - set(SFCIO_INC $ENV{SFCIO_INC} CACHE STRING "SFCIO d Include Location" ) - set(SFCIO_4_INC $ENV{SFCIO_INC4} CACHE STRING "SFCIO4 Include Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-sfcio - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-sfcio - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-sfcio - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-sfcio OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("sfcio version is ${LIBVERSION}") - set( SFCIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libsfcio_${LIBVERSION}.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${SFCIO_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-sfcio ) - else() - set( CORE_BUILT ${SFCIO_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-sfcio ) - endif() -endif() - -set( SFCIO_LIBRARY_PATH ${SFCIO_LIBRARY} CACHE STRING "SFCIO Library Location" ) -set( SFCIO_INCLUDE_PATH ${SFCIO_LIBRARY} CACHE STRING "SFCIO Include Location" ) - diff --git a/cmake/Modules/FindSIGIO.cmake b/cmake/Modules/FindSIGIO.cmake deleted file mode 100644 index 7a5ed6db9..000000000 --- a/cmake/Modules/FindSIGIO.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# This module looks for environment variables detailing where SIGIO lib is -# If variables are not set, SIGIO will be built from external source -include(ExternalProject) -if(DEFINED ENV{SIGIO_DIR} ) - message("HEY!! setting SIGIO library via environment variable") - set(SIGIO_LIBRARY $ENV{SIGIO_LIB} CACHE STRING "SP Library Location" ) - set(SIGIO_4_LIBRARY $ENV{SIGIO_LIB4} CACHE STRING "SIGIO4 Library Location" ) - set(SIGIO_INC $ENV{SIGIO_INC} CACHE STRING "SIGIO d Include Location" ) - set(SIGIO_4_INC $ENV{SIGIO_INC4} CACHE STRING "SIGIO4 Include Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-sigio - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-sigio - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-sigio - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-sigio OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("sigio version is ${LIBVERSION}") - set( SIGIO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libsigio_${LIBVERSION}.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${SIGIO_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-sigio ) - else() - set( CORE_BUILT ${SIGIO_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-sigio ) - endif() - -endif() -set( SIGIO_LIBRARY_PATH ${SIGIO_LIBRARY} CACHE STRING "SIGIO Library Location" ) -set( SIGIO_INCLUDE_PATH ${SIGIO_LIBRARY} CACHE STRING "SIGIO include Location" ) - diff --git a/cmake/Modules/FindSP.cmake b/cmake/Modules/FindSP.cmake deleted file mode 100644 index 3101d6464..000000000 --- a/cmake/Modules/FindSP.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# This module looks for environment variables detailing where SP lib is -# If variables are not set, SP will be built from external source - -include(ExternalProject) -if(DEFINED ENV{SP_LIBd} ) - message("HEY!! setting SP library via environment variable") - set(SP_LIBRARY $ENV{SP_LIBd} CACHE STRING "SP Library Location" ) - set(SP_4_LIBRARY $ENV{SP_LIB4} CACHE STRING "SP_4 Library Location" ) - set(SP_8_LIBRARY $ENV{SP_LIB4} CACHE STRING "SP_8 Library Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-sp - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-sp - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-sp - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-sp OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("sp version is ${LIBVERSION}") - set( SP_LIBRARY ${PROJECT_BINARY_DIR}/lib/libsp_${LIBVERSION}_d.a ) - set( SP_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libsp_${LIBVERSION}_4.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${SP_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-sp ) - else() - set( CORE_BUILT ${SP_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-sp ) - endif() -endif() - -set( SP_LIBRARY_PATH ${SP_LIBRARY} CACHE STRING "SP Library Location" ) -set( SP_4_LIBRARY_PATH ${SP_4_LIBRARY} CACHE STRING "SP_4 Library Location" ) - diff --git a/cmake/Modules/FindW3EMC.cmake b/cmake/Modules/FindW3EMC.cmake deleted file mode 100644 index 0f3b828a4..000000000 --- a/cmake/Modules/FindW3EMC.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# This module looks for environment variables detailing where W3EMC lib is -# If variables are not set, W3EMC will be built from external source -include(ExternalProject) -if(DEFINED ENV{W3EMC_LIBd} ) - message("HEY!! setting W3EMC library via environment variable") - set(W3EMC_LIBRARY $ENV{W3EMC_LIBd} CACHE STRING "SP Library Location" ) - set(W3EMC_4_LIBRARY $ENV{W3EMC_LIB4} CACHE STRING "W3EMC4 Library Location" ) - set(W3EMCINC $ENV{W3EMC_INC} CACHE STRING "W3EMC d Include Location" ) - set(W3EMC4INC $ENV{W3EMC_INC4} CACHE STRING "W3EMC4 Include Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - ExternalProject_Add(NCEPLIBS-w3emc - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-w3emc - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DEXTRA_INCLUDE=${PROJECT_BINARY_DIR}/include - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${PROJECT_SOURCE_DIR}/NCEPLIBS-w3emc - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - add_dependencies(NCEPLIBS-w3emc NCEPLIBS-sigio) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/NCEPLIBS-w3emc OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("w3emc version is ${LIBVERSION}") - set( W3EMC_LIBRARY ${PROJECT_BINARY_DIR}/lib/libw3emc_${LIBVERSION}_d.a ) - set( W3EMC_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libw3emc_${LIBVERSION}_4.a ) - set(W3EMCINC ${PROJECT_BINARY_DIR}/include ) - set(W3EMC4INC ${PROJECT_BINARY_DIR}/include_4 ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${W3EMC_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-w3emc ) - else() - set( CORE_BUILT ${W3EMC_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-w3emc ) - endif() -endif() - -set( W3EMC_LIBRARY_PATH ${W3EMC_LIBRARY} CACHE STRING "W3EMC Library Location" ) -set( W3EMC_4_LIBRARY_PATH ${W3EMC_4_LIBRARY} CACHE STRING "W3EMC_4 Library Location" ) -set( W3EMC_INCLUDE_PATH ${W3EMCINC} CACHE STRING "W3EMC Include Location" ) -set( W3EMC_INCLUDE_4_PATH ${W3EMC4INC} CACHE STRING "W3EMC_4 Include Location" ) - diff --git a/cmake/Modules/FindW3NCO.cmake b/cmake/Modules/FindW3NCO.cmake deleted file mode 100644 index f20149df7..000000000 --- a/cmake/Modules/FindW3NCO.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# This module looks for environment variables detailing where W3NCO lib is -# If variables are not set, W3NCO will be built from external source -include(ExternalProject) -if(DEFINED ENV{W3NCO_LIB4} ) - set(W3NCO_LIBRARY $ENV{W3NCO_LIBd} CACHE STRING "W3NCO Library Location" ) - set(W3NCO_4_LIBRARY $ENV{W3NCO_LIB4} CACHE STRING "W3NCO_4 Library Location" ) - set(W3NCO_8_LIBRARY $ENV{W3NCO_LIB8} CACHE STRING "W3NCO_4 Library Location" ) -else() - set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) - set(SRC_DIR ${PROJECT_SOURCE_DIR}/../NCEPLIBS-w3nco) - ExternalProject_Add(NCEPLIBS-w3nco - PREFIX ${PROJECT_BINARY_DIR}/NCEPLIBS-w3nco - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - -DCMAKE_BUILD_TYPE=RELEASE - SOURCE_DIR ${SRC_DIR} - INSTALL_DIR ${CMAKE_INSTALL_PREFIX} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - execute_process(COMMAND grep "set(VERSION" CMakeLists.txt WORKING_DIRECTORY ${SRC_DIR} OUTPUT_VARIABLE LIBVERSION) - string(REPLACE "set(VERSION " "" LIBVERSION ${LIBVERSION}) - string(REPLACE ")" "" LIBVERSION ${LIBVERSION}) - string(REPLACE "\n" "" LIBVERSION ${LIBVERSION}) - message("w3nco version is ${LIBVERSION}") - set( W3NCO_LIBRARY ${PROJECT_BINARY_DIR}/lib/libw3nco_${LIBVERSION}_d.a ) - set( W3NCO_4_LIBRARY ${PROJECT_BINARY_DIR}/lib/libw3nco_${LIBVERSION}_4.a ) - if( CORE_BUILT ) - list( APPEND CORE_BUILT ${W3NCO_LIBRARY} ) - list( APPEND EXT_BUILT NCEPLIBS-w3nco ) - else() - set( CORE_BUILT ${W3NCO_LIBRARY} ) - set( EXT_BUILT NCEPLIBS-w3nco ) - endif() - -endif() -set( W3NCO_LIBRARY_PATH ${W3NCO_LIBRARY} CACHE STRING "W3NCO Library Location" ) -set( W3NCO_4_LIBRARY_PATH ${W3NCO_4_LIBRARY} CACHE STRING "W3NCO_4 Library Location" ) -set( W3NCO_8_LIBRARY_PATH ${W3NCO_8_LIBRARY} CACHE STRING "W3NCO_4 Library Location" ) - - diff --git a/cmake/Modules/FindWRF.cmake b/cmake/Modules/FindWRF.cmake deleted file mode 100644 index 43faf4664..000000000 --- a/cmake/Modules/FindWRF.cmake +++ /dev/null @@ -1,36 +0,0 @@ -# - Find the WRF modules - -set( NO_DEFAULT_PATH ) -find_library( IOINT_LIB - NAMES libwrfio_int.a - HINTS - ${WRFPATH}/external/io_int - $ENV{WRFPATH}/external/io_int - /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_int - /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/external/io_int - ${NO_DEFAULT_PATH}) - -find_library( WRFNETCDF_LIB - NAMES libwrfio_nf.a - HINTS - ${WRFPATH}/external/io_netcdf /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_netcdf - $ENV{WRFPATH}/external/io_netcdf /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/external/io_netcdf - /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/external/io_netcdf - ${NO_DEFAULT_PATH}) -find_file( FRAMEPACK - NAMES pack_utils.o - HINTS - ${WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame - $ENV{WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame - /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/frame - ${NO_DEFAULT_PATH}) -find_file( FRAMEMODULE - NAMES module_machine.o - HINTS - ${WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame - $ENV{WRFPATH}/frame /usr/local/jcsda/nwprod_gdas_2014/lib/sorc/nam_nmm_real_fcst.fd/frame - /scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3/frame - ${NO_DEFAULT_PATH}) - -set( WRF_LIBRARIES ${IOINT_LIB} ${WRFNETCDF_LIB} ${FRAMEPACK} ${FRAMEMODULE} ) - diff --git a/cmake/Modules/NewCMake/CMakeParseArguments.cmake b/cmake/Modules/NewCMake/CMakeParseArguments.cmake deleted file mode 100644 index 7ee2bbace..000000000 --- a/cmake/Modules/NewCMake/CMakeParseArguments.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CMakeParseArguments -# ------------------- -# -# This module once implemented the :command:`cmake_parse_arguments` command -# that is now implemented natively by CMake. It is now an empty placeholder -# for compatibility with projects that include it to get the command from -# CMake 3.4 and lower. diff --git a/cmake/Modules/NewCMake/FindHDF5.cmake b/cmake/Modules/NewCMake/FindHDF5.cmake deleted file mode 100644 index fd8891cf2..000000000 --- a/cmake/Modules/NewCMake/FindHDF5.cmake +++ /dev/null @@ -1,934 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindHDF5 -# -------- -# -# Find HDF5, a library for reading and writing self describing array data. -# -# -# -# This module invokes the HDF5 wrapper compiler that should be installed -# alongside HDF5. Depending upon the HDF5 Configuration, the wrapper -# compiler is called either h5cc or h5pcc. If this succeeds, the module -# will then call the compiler with the -show argument to see what flags -# are used when compiling an HDF5 client application. -# -# The module will optionally accept the COMPONENTS argument. If no -# COMPONENTS are specified, then the find module will default to finding -# only the HDF5 C library. If one or more COMPONENTS are specified, the -# module will attempt to find the language bindings for the specified -# components. The only valid components are C, CXX, Fortran, HL, and -# Fortran_HL. If the COMPONENTS argument is not given, the module will -# attempt to find only the C bindings. -# -# This module will read the variable -# HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a -# static link to a dynamic link for HDF5 and all of it's dependencies. -# To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES -# variable is set before the call to find_package. -# -# To provide the module with a hint about where to find your HDF5 -# installation, you can set the environment variable HDF5_ROOT. The -# Find module will then look in this path when searching for HDF5 -# executables, paths, and libraries. -# -# Both the serial and parallel HDF5 wrappers are considered and the first -# directory to contain either one will be used. In the event that both appear -# in the same directory the serial version is preferentially selected. This -# behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to -# true. -# -# In addition to finding the includes and libraries required to compile -# an HDF5 client application, this module also makes an effort to find -# tools that come with the HDF5 distribution that may be useful for -# regression testing. -# -# This module will define the following variables: -# -# :: -# -# HDF5_FOUND - true if HDF5 was found on the system -# HDF5_VERSION - HDF5 version in format Major.Minor.Release -# HDF5_INCLUDE_DIRS - Location of the hdf5 includes -# HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated) -# HDF5_DEFINITIONS - Required compiler definitions for HDF5 -# HDF5_LIBRARIES - Required libraries for all requested bindings -# HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API for all -# bindings, if the HL component is enabled -# -# Available components are: C CXX Fortran and HL. For each enabled language -# binding, a corresponding HDF5_${LANG}_LIBRARIES variable, and potentially -# HDF5_${LANG}_DEFINITIONS, will be defined. -# If the HL component is enabled, then an HDF5_${LANG}_HL_LIBRARIES will -# also be defined. With all components enabled, the following variables will be defined: -# -# :: -# -# HDF5_C_DEFINITIONS -- Required compiler definitions for HDF5 C bindings -# HDF5_CXX_DEFINITIONS -- Required compiler definitions for HDF5 C++ bindings -# HDF5_Fortran_DEFINITIONS -- Required compiler definitions for HDF5 Fortran bindings -# HDF5_C_INCLUDE_DIRS -- Required include directories for HDF5 C bindings -# HDF5_CXX_INCLUDE_DIRS -- Required include directories for HDF5 C++ bindings -# HDF5_Fortran_INCLUDE_DIRS -- Required include directories for HDF5 Fortran bindings -# HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings -# HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings -# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings -# HDF5_C_HL_LIBRARIES - Required libraries for the high level C bindings -# HDF5_CXX_HL_LIBRARIES - Required libraries for the high level C++ bindings -# HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran -# bindings. -# -# HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support -# HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler -# HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler -# HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler -# HDF5_C_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C compiler -# which is also the HDF5 wrapper -# HDF5_CXX_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C++ -# compiler which is also -# the HDF5 wrapper -# HDF5_Fortran_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary -# Fortran compiler which -# is also the HDF5 wrapper -# HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool -# -# The following variable can be set to guide the search for HDF5 libraries and includes: -# -# ``HDF5_ROOT`` -# Specify the path to the HDF5 installation to use. -# -# ``HDF5_FIND_DEBUG`` -# Set to a true value to get some extra debugging output. -# -# ``HDF5_NO_FIND_PACKAGE_CONFIG_FILE`` -# Set to a true value to skip trying to find ``hdf5-config.cmake``. - -# This module is maintained by Will Dicharry . - -include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - -# List of the valid HDF5 components -set(HDF5_VALID_LANGUAGE_BINDINGS C CXX Fortran) - -# Validate the list of find components. -if(NOT HDF5_FIND_COMPONENTS) - set(HDF5_LANGUAGE_BINDINGS "C") -else() - set(HDF5_LANGUAGE_BINDINGS) - # add the extra specified components, ensuring that they are valid. - set(FIND_HL OFF) - foreach(component IN LISTS HDF5_FIND_COMPONENTS) - list(FIND HDF5_VALID_LANGUAGE_BINDINGS ${component} component_location) - if(NOT component_location EQUAL -1) - list(APPEND HDF5_LANGUAGE_BINDINGS ${component}) - elseif(component STREQUAL "HL") - set(FIND_HL ON) - elseif(component STREQUAL "Fortran_HL") # only for compatibility - list(APPEND HDF5_LANGUAGE_BINDINGS Fortran) - set(FIND_HL ON) - set(HDF5_FIND_REQUIRED_Fortran_HL False) - set(HDF5_FIND_REQUIRED_Fortran True) - set(HDF5_FIND_REQUIRED_HL True) - else() - message(FATAL_ERROR "${component} is not a valid HDF5 component.") - endif() - endforeach() - if(NOT HDF5_LANGUAGE_BINDINGS) - get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) - foreach(__lang IN LISTS __langs) - if(__lang MATCHES "^(C|CXX|Fortran)$") - list(APPEND HDF5_LANGUAGE_BINDINGS ${__lang}) - endif() - endforeach() - endif() - list(REMOVE_ITEM HDF5_FIND_COMPONENTS Fortran_HL) # replaced by Fortran and HL - list(REMOVE_DUPLICATES HDF5_LANGUAGE_BINDINGS) -endif() - -# Determine whether to search for serial or parallel executable first -if(HDF5_PREFER_PARALLEL) - set(HDF5_C_COMPILER_NAMES h5pcc h5cc) - set(HDF5_CXX_COMPILER_NAMES h5pc++ h5c++) - set(HDF5_Fortran_COMPILER_NAMES h5pfc h5fc) -else() - set(HDF5_C_COMPILER_NAMES h5cc h5pcc) - set(HDF5_CXX_COMPILER_NAMES h5c++ h5pc++) - set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc) -endif() - -# We may have picked up some duplicates in various lists during the above -# process for the language bindings (both the C and C++ bindings depend on -# libz for example). Remove the duplicates. It appears that the default -# CMake behavior is to remove duplicates from the end of a list. However, -# for link lines, this is incorrect since unresolved symbols are searched -# for down the link line. Therefore, we reverse the list, remove the -# duplicates, and then reverse it again to get the duplicates removed from -# the beginning. -macro(_HDF5_remove_duplicates_from_beginning _list_name) - if(${_list_name}) - list(REVERSE ${_list_name}) - list(REMOVE_DUPLICATES ${_list_name}) - list(REVERSE ${_list_name}) - endif() -endmacro() - - -# Test first if the current compilers automatically wrap HDF5 - -function(_HDF5_test_regular_compiler_C success version is_parallel) - set(scratch_directory - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) - if(NOT ${success} OR - NOT EXISTS ${scratch_directory}/compiler_has_h5_c) - set(test_file ${scratch_directory}/cmake_hdf5_test.c) - file(WRITE ${test_file} - "#include \n" - "#include \n" - "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" - "#ifdef H5_HAVE_PARALLEL\n" - "const char* info_parallel = \"INFO\" \":\" \"PARALLEL\";\n" - "#endif\n" - "int main(int argc, char **argv) {\n" - " int require = 0;\n" - " require += info_ver[argc];\n" - "#ifdef H5_HAVE_PARALLEL\n" - " require += info_parallel[argc];\n" - "#endif\n" - " hid_t fid;\n" - " fid = H5Fcreate(\"foo.h5\",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);\n" - " return 0;\n" - "}") - try_compile(${success} ${scratch_directory} ${test_file} - COPY_FILE ${scratch_directory}/compiler_has_h5_c - ) - endif() - if(${success}) - file(STRINGS ${scratch_directory}/compiler_has_h5_c INFO_STRINGS - REGEX "^INFO:" - ) - string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?" - INFO_VER "${INFO_STRINGS}" - ) - set(${version} ${CMAKE_MATCH_1}) - if(CMAKE_MATCH_3) - set(${version} ${HDF5_C_VERSION}.${CMAKE_MATCH_3}) - endif() - set(${version} ${${version}} PARENT_SCOPE) - - if(INFO_STRINGS MATCHES "INFO:PARALLEL") - set(${is_parallel} TRUE PARENT_SCOPE) - else() - set(${is_parallel} FALSE PARENT_SCOPE) - endif() - endif() -endfunction() - -function(_HDF5_test_regular_compiler_CXX success version is_parallel) - set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) - if(NOT ${success} OR - NOT EXISTS ${scratch_directory}/compiler_has_h5_cxx) - set(test_file ${scratch_directory}/cmake_hdf5_test.cxx) - file(WRITE ${test_file} - "#include \n" - "#ifndef H5_NO_NAMESPACE\n" - "using namespace H5;\n" - "#endif\n" - "const char* info_ver = \"INFO\" \":\" H5_VERSION;\n" - "#ifdef H5_HAVE_PARALLEL\n" - "const char* info_parallel = \"INFO\" \":\" \"PARALLEL\";\n" - "#endif\n" - "int main(int argc, char **argv) {\n" - " int require = 0;\n" - " require += info_ver[argc];\n" - "#ifdef H5_HAVE_PARALLEL\n" - " require += info_parallel[argc];\n" - "#endif\n" - " H5File file(\"foo.h5\", H5F_ACC_TRUNC);\n" - " return 0;\n" - "}") - try_compile(${success} ${scratch_directory} ${test_file} - COPY_FILE ${scratch_directory}/compiler_has_h5_cxx - ) - endif() - if(${success}) - file(STRINGS ${scratch_directory}/compiler_has_h5_cxx INFO_STRINGS - REGEX "^INFO:" - ) - string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?" - INFO_VER "${INFO_STRINGS}" - ) - set(${version} ${CMAKE_MATCH_1}) - if(CMAKE_MATCH_3) - set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3}) - endif() - set(${version} ${${version}} PARENT_SCOPE) - - if(INFO_STRINGS MATCHES "INFO:PARALLEL") - set(${is_parallel} TRUE PARENT_SCOPE) - else() - set(${is_parallel} FALSE PARENT_SCOPE) - endif() - endif() -endfunction() - -function(_HDF5_test_regular_compiler_Fortran success is_parallel) - if(NOT ${success}) - set(scratch_directory - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) - set(test_file ${scratch_directory}/cmake_hdf5_test.f90) - file(WRITE ${test_file} - "program hdf5_hello\n" - " use hdf5\n" - " use h5lt\n" - " use h5ds\n" - " integer error\n" - " call h5open_f(error)\n" - " call h5close_f(error)\n" - "end\n") - try_compile(${success} ${scratch_directory} ${test_file}) - if(${success}) - execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig - OUTPUT_VARIABLE config_output - ERROR_VARIABLE config_error - RESULT_VARIABLE config_result - ) - if(config_output MATCHES "Parallel HDF5: yes") - set(${is_parallel} TRUE PARENT_SCOPE) - else() - set(${is_parallel} FALSE PARENT_SCOPE) - endif() - endif() - endif() -endfunction() - -# Invoke the HDF5 wrapper compiler. The compiler return value is stored to the -# return_value argument, the text output is stored to the output variable. -macro( _HDF5_invoke_compiler language output return_value version is_parallel) - set(${version}) - if(HDF5_USE_STATIC_LIBRARIES) - set(lib_type_args -noshlib) - else() - set(lib_type_args -shlib) - endif() - set(scratch_dir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) - if("${language}" STREQUAL "C") - set(test_file ${scratch_dir}/cmake_hdf5_test.c) - elseif("${language}" STREQUAL "CXX") - set(test_file ${scratch_dir}/cmake_hdf5_test.cxx) - elseif("${language}" STREQUAL "Fortran") - set(test_file ${scratch_dir}/cmake_hdf5_test.f90) - endif() - exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} - ARGS -show ${lib_type_args} ${test_file} - OUTPUT_VARIABLE ${output} - RETURN_VALUE ${return_value} - ) - if(NOT ${${return_value}} EQUAL 0) - message(STATUS - "Unable to determine HDF5 ${language} flags from HDF5 wrapper.") - endif() - exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE} - ARGS -showconfig - OUTPUT_VARIABLE config_output - RETURN_VALUE config_return - ) - if(NOT ${return_value} EQUAL 0) - message( STATUS - "Unable to determine HDF5 ${language} version from HDF5 wrapper.") - endif() - string(REGEX MATCH "HDF5 Version: ([a-zA-Z0-9\\.\\-]*)" version_match "${config_output}") - if(version_match) - string(REPLACE "HDF5 Version: " "" ${version} "${version_match}") - string(REPLACE "-patch" "." ${version} "${${version}}") - endif() - if(config_output MATCHES "Parallel HDF5: yes") - set(${is_parallel} TRUE) - else() - set(${is_parallel} FALSE) - endif() -endmacro() - -# Parse a compile line for definitions, includes, library paths, and libraries. -macro( _HDF5_parse_compile_line - compile_line_var - include_paths - definitions - library_paths - libraries - libraries_hl) - - separate_arguments(_HDF5_COMPILE_ARGS UNIX_COMMAND "${${compile_line_var}}") - - foreach(arg IN LISTS _HDF5_COMPILE_ARGS) - if("${arg}" MATCHES "^-I(.*)$") - # include directory - list(APPEND ${include_paths} "${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^-D(.*)$") - # compile definition - list(APPEND ${definitions} "-D${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^-L(.*)$") - # library search path - list(APPEND ${library_paths} "${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^-l(hdf5.*hl.*)$") - # library name (hl) - list(APPEND ${libraries_hl} "${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^-l(.*)$") - # library name - list(APPEND ${libraries} "${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.(a|so|dylib|sl|lib)$") - # library file - if(NOT EXISTS "${arg}") - continue() - endif() - get_filename_component(_HDF5_LPATH "${arg}" DIRECTORY) - get_filename_component(_HDF5_LNAME "${arg}" NAME_WE) - string(REGEX REPLACE "^lib" "" _HDF5_LNAME "${_HDF5_LNAME}") - list(APPEND ${library_paths} "${_HDF5_LPATH}") - if(_HDF5_LNAME MATCHES "hdf5.*hl") - list(APPEND ${libraries_hl} "${_HDF5_LNAME}") - else() - list(APPEND ${libraries} "${_HDF5_LNAME}") - endif() - endif() - endforeach() -endmacro() - -# Select a preferred imported configuration from a target -function(_HDF5_select_imported_config target imported_conf) - # We will first assign the value to a local variable _imported_conf, then assign - # it to the function argument at the end. - get_target_property(_imported_conf ${target} MAP_IMPORTED_CONFIG_${CMAKE_BUILD_TYPE}) - if (NOT _imported_conf) - # Get available imported configurations by examining target properties - get_target_property(_imported_conf ${target} IMPORTED_CONFIGURATIONS) - if(HDF5_FIND_DEBUG) - message(STATUS "Found imported configurations: ${_imported_conf}") - endif() - # Find the imported configuration that we prefer. - # We do this by making list of configurations in order of preference, - # starting with ${CMAKE_BUILD_TYPE} and ending with the first imported_conf - set(_preferred_confs ${CMAKE_BUILD_TYPE}) - list(GET _imported_conf 0 _fallback_conf) - list(APPEND _preferred_confs RELWITHDEBINFO RELEASE DEBUG ${_fallback_conf}) - if(HDF5_FIND_DEBUG) - message(STATUS "Start search through imported configurations in the following order: ${_preferred_confs}") - endif() - # Now find the first of these that is present in imported_conf - cmake_policy(PUSH) - cmake_policy(SET CMP0057 NEW) # support IN_LISTS - foreach (_conf IN LISTS _preferred_confs) - if (${_conf} IN_LIST _imported_conf) - set(_imported_conf ${_conf}) - break() - endif() - endforeach() - cmake_policy(POP) - endif() - if(HDF5_FIND_DEBUG) - message(STATUS "Selected imported configuration: ${_imported_conf}") - endif() - # assign value to function argument - set(${imported_conf} ${_imported_conf} PARENT_SCOPE) -endfunction() - - -if(NOT HDF5_ROOT) - set(HDF5_ROOT $ENV{HDF5_ROOT}) -endif() -if(HDF5_ROOT) - set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH) -else() - set(_HDF5_SEARCH_OPTS) -endif() - -# Try to find HDF5 using an installed hdf5-config.cmake -if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE) - find_package(HDF5 QUIET NO_MODULE - HINTS ${HDF5_ROOT} - ${_HDF5_SEARCH_OPTS} - ) - if( HDF5_FOUND) - if(HDF5_FIND_DEBUG) - message(STATUS "Found HDF5 at ${HDF5_DIR} via NO_MODULE. Now trying to extract locations etc.") - endif() - set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL}) - set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) - set(HDF5_LIBRARIES) - if (NOT TARGET hdf5 AND NOT TARGET hdf5-static AND NOT TARGET hdf5-shared) - # Some HDF5 versions (e.g. 1.8.18) used hdf5::hdf5 etc - set(_target_prefix "hdf5::") - endif() - set(HDF5_C_TARGET ${_target_prefix}hdf5) - set(HDF5_C_HL_TARGET ${_target_prefix}hdf5_hl) - set(HDF5_CXX_TARGET ${_target_prefix}hdf5_cpp) - set(HDF5_CXX_HL_TARGET ${_target_prefix}hdf5_hl_cpp) - set(HDF5_Fortran_TARGET ${_target_prefix}hdf5_fortran) - set(HDF5_Fortran_HL_TARGET ${_target_prefix}hdf5_hl_fortran) - set(HDF5_DEFINITIONS "") - if(HDF5_USE_STATIC_LIBRARIES) - set(_suffix "-static") - else() - set(_suffix "-shared") - endif() - foreach(_lang ${HDF5_LANGUAGE_BINDINGS}) - - #Older versions of hdf5 don't have a static/shared suffix so - #if we detect that occurrence clear the suffix - if(_suffix AND NOT TARGET ${HDF5_${_lang}_TARGET}${_suffix}) - if(NOT TARGET ${HDF5_${_lang}_TARGET}) - #cant find this component with or without the suffix - #so bail out, and let the following locate HDF5 - set(HDF5_FOUND FALSE) - break() - endif() - set(_suffix "") - endif() - - if(HDF5_FIND_DEBUG) - message(STATUS "Trying to get properties of target ${HDF5_${_lang}_TARGET}${_suffix}") - endif() - # Find library for this target. Complicated as on Windows with a DLL, we need to search for the import-lib. - _HDF5_select_imported_config(${HDF5_${_lang}_TARGET}${_suffix} _hdf5_imported_conf) - get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} ) - if (NOT _hdf5_lang_location) - # no import lib, just try LOCATION - get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf}) - if (NOT _hdf5_lang_location) - get_target_property(_hdf5_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION) - endif() - endif() - if( _hdf5_lang_location ) - set(HDF5_${_lang}_LIBRARY ${_hdf5_lang_location}) - list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix}) - set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix}) - set(HDF5_${_lang}_FOUND True) - endif() - if(FIND_HL) - get_target_property(__lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} ) - if (NOT _hdf5_lang_hl_location) - get_target_property(_hdf5_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf}) - if (NOT _hdf5_hl_lang_location) - get_target_property(_hdf5_hl_lang_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION) - endif() - endif() - if( _hdf5_lang_hl_location ) - set(HDF5_${_lang}_HL_LIBRARY ${_hdf5_lang_hl_location}) - list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix}) - set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix}) - set(HDF5_HL_FOUND True) - endif() - unset(_hdf5_lang_hl_location) - endif() - unset(_hdf5_imported_conf) - unset(_hdf5_lang_location) - endforeach() - endif() -endif() - -if(NOT HDF5_FOUND) - set(_HDF5_NEED_TO_SEARCH False) - set(HDF5_COMPILER_NO_INTERROGATE True) - # Only search for languages we've enabled - foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) - # First check to see if our regular compiler is one of wrappers - if(__lang STREQUAL "C") - _HDF5_test_regular_compiler_C( - HDF5_${__lang}_COMPILER_NO_INTERROGATE - HDF5_${__lang}_VERSION - HDF5_${__lang}_IS_PARALLEL) - elseif(__lang STREQUAL "CXX") - _HDF5_test_regular_compiler_CXX( - HDF5_${__lang}_COMPILER_NO_INTERROGATE - HDF5_${__lang}_VERSION - HDF5_${__lang}_IS_PARALLEL) - elseif(__lang STREQUAL "Fortran") - _HDF5_test_regular_compiler_Fortran( - HDF5_${__lang}_COMPILER_NO_INTERROGATE - HDF5_${__lang}_IS_PARALLEL) - else() - continue() - endif() - if(HDF5_${__lang}_COMPILER_NO_INTERROGATE) - message(STATUS "HDF5: Using hdf5 compiler wrapper for all ${__lang} compiling") - set(HDF5_${__lang}_FOUND True) - set(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE - "${CMAKE_${__lang}_COMPILER}" - CACHE FILEPATH "HDF5 ${__lang} compiler wrapper") - set(HDF5_${__lang}_DEFINITIONS) - set(HDF5_${__lang}_INCLUDE_DIRS) - set(HDF5_${__lang}_LIBRARIES) - set(HDF5_${__lang}_HL_LIBRARIES) - - mark_as_advanced(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE) - - set(HDF5_${__lang}_FOUND True) - set(HDF5_HL_FOUND True) - else() - set(HDF5_COMPILER_NO_INTERROGATE False) - # If this language isn't using the wrapper, then try to seed the - # search options with the wrapper - find_program(HDF5_${__lang}_COMPILER_EXECUTABLE - NAMES ${HDF5_${__lang}_COMPILER_NAMES} NAMES_PER_DIR - HINTS ${HDF5_ROOT} - PATH_SUFFIXES bin Bin - DOC "HDF5 ${__lang} Wrapper compiler. Used only to detect HDF5 compile flags." - ${_HDF5_SEARCH_OPTS} - ) - mark_as_advanced( HDF5_${__lang}_COMPILER_EXECUTABLE ) - unset(HDF5_${__lang}_COMPILER_NAMES) - - if(HDF5_${__lang}_COMPILER_EXECUTABLE) - _HDF5_invoke_compiler(${__lang} HDF5_${__lang}_COMPILE_LINE - HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION HDF5_${__lang}_IS_PARALLEL) - if(HDF5_${__lang}_RETURN_VALUE EQUAL 0) - message(STATUS "HDF5: Using hdf5 compiler wrapper to determine ${__lang} configuration") - _HDF5_parse_compile_line( HDF5_${__lang}_COMPILE_LINE - HDF5_${__lang}_INCLUDE_DIRS - HDF5_${__lang}_DEFINITIONS - HDF5_${__lang}_LIBRARY_DIRS - HDF5_${__lang}_LIBRARY_NAMES - HDF5_${__lang}_HL_LIBRARY_NAMES - ) - set(HDF5_${__lang}_LIBRARIES) - - foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES) - set(_HDF5_SEARCH_NAMES_LOCAL) - if("x${L}" MATCHES "hdf5") - # hdf5 library - set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) - if(HDF5_USE_STATIC_LIBRARIES) - if(WIN32) - set(_HDF5_SEARCH_NAMES_LOCAL lib${L}) - else() - set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) - endif() - endif() - else() - # external library - set(_HDF5_SEARCH_OPTS_LOCAL) - endif() - find_library(HDF5_${__lang}_LIBRARY_${L} - NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR - HINTS ${HDF5_${__lang}_LIBRARY_DIRS} - ${HDF5_ROOT} - ${_HDF5_SEARCH_OPTS_LOCAL} - ) - unset(_HDF5_SEARCH_OPTS_LOCAL) - unset(_HDF5_SEARCH_NAMES_LOCAL) - if(HDF5_${__lang}_LIBRARY_${L}) - list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) - else() - list(APPEND HDF5_${__lang}_LIBRARIES ${L}) - endif() - endforeach() - if(FIND_HL) - set(HDF5_${__lang}_HL_LIBRARIES) - foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES) - set(_HDF5_SEARCH_NAMES_LOCAL) - if("x${L}" MATCHES "hdf5") - # hdf5 library - set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS}) - if(HDF5_USE_STATIC_LIBRARIES) - if(WIN32) - set(_HDF5_SEARCH_NAMES_LOCAL lib${L}) - else() - set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a) - endif() - endif() - else() - # external library - set(_HDF5_SEARCH_OPTS_LOCAL) - endif() - find_library(HDF5_${__lang}_LIBRARY_${L} - NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR - HINTS ${HDF5_${__lang}_LIBRARY_DIRS} - ${HDF5_ROOT} - ${_HDF5_SEARCH_OPTS_LOCAL} - ) - unset(_HDF5_SEARCH_OPTS_LOCAL) - unset(_HDF5_SEARCH_NAMES_LOCAL) - if(HDF5_${__lang}_LIBRARY_${L}) - list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}}) - else() - list(APPEND HDF5_${__lang}_HL_LIBRARIES ${L}) - endif() - endforeach() - set(HDF5_HL_FOUND True) - endif() - - set(HDF5_${__lang}_FOUND True) - _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_DEFINITIONS) - _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_INCLUDE_DIRS) - _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_LIBRARIES) - _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_HL_LIBRARIES) - else() - set(_HDF5_NEED_TO_SEARCH True) - endif() - else() - set(_HDF5_NEED_TO_SEARCH True) - endif() - endif() - if(HDF5_${__lang}_VERSION) - if(NOT HDF5_VERSION) - set(HDF5_VERSION ${HDF5_${__lang}_VERSION}) - elseif(NOT HDF5_VERSION VERSION_EQUAL HDF5_${__lang}_VERSION) - message(WARNING "HDF5 Version found for language ${__lang}, ${HDF5_${__lang}_VERSION} is different than previously found version ${HDF5_VERSION}") - endif() - endif() - if(DEFINED HDF5_${__lang}_IS_PARALLEL) - if(NOT DEFINED HDF5_IS_PARALLEL) - set(HDF5_IS_PARALLEL ${HDF5_${__lang}_IS_PARALLEL}) - elseif(NOT HDF5_IS_PARALLEL AND HDF5_${__lang}_IS_PARALLEL) - message(WARNING "HDF5 found for language ${__lang} is parallel but previously found language is not parallel.") - elseif(HDF5_IS_PARALLEL AND NOT HDF5_${__lang}_IS_PARALLEL) - message(WARNING "HDF5 found for language ${__lang} is not parallel but previously found language is parallel.") - endif() - endif() - endforeach() -else() - set(_HDF5_NEED_TO_SEARCH True) -endif() - -if(NOT HDF5_FOUND AND HDF5_COMPILER_NO_INTERROGATE) - # No arguments necessary, all languages can use the compiler wrappers - set(HDF5_FOUND True) - set(HDF5_METHOD "Included by compiler wrappers") - set(HDF5_REQUIRED_VARS HDF5_METHOD) -elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH) - # Compiler wrappers aren't being used by the build but were found and used - # to determine necessary include and library flags - set(HDF5_INCLUDE_DIRS) - set(HDF5_LIBRARIES) - set(HDF5_HL_LIBRARIES) - foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) - if(HDF5_${__lang}_FOUND) - if(NOT HDF5_${__lang}_COMPILER_NO_INTERROGATE) - list(APPEND HDF5_DEFINITIONS ${HDF5_${__lang}_DEFINITIONS}) - list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIRS}) - list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES}) - if(FIND_HL) - list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES}) - endif() - endif() - endif() - endforeach() - _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS) - _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS) - _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES) - _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES) - set(HDF5_FOUND True) - set(HDF5_REQUIRED_VARS HDF5_LIBRARIES) - if(FIND_HL) - list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES) - endif() -endif() - -find_program( HDF5_DIFF_EXECUTABLE - NAMES h5diff - HINTS ${HDF5_ROOT} - PATH_SUFFIXES bin Bin - ${_HDF5_SEARCH_OPTS} - DOC "HDF5 file differencing tool." ) -mark_as_advanced( HDF5_DIFF_EXECUTABLE ) - -if( NOT HDF5_FOUND ) - # seed the initial lists of libraries to find with items we know we need - set(HDF5_C_LIBRARY_NAMES hdf5) - set(HDF5_C_HL_LIBRARY_NAMES hdf5_hl) - - set(HDF5_CXX_LIBRARY_NAMES hdf5_cpp ${HDF5_C_LIBRARY_NAMES}) - set(HDF5_CXX_HL_LIBRARY_NAMES hdf5_hl_cpp ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_CXX_LIBRARY_NAMES}) - - set(HDF5_Fortran_LIBRARY_NAMES hdf5_fortran ${HDF5_C_LIBRARY_NAMES}) - set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES}) - - foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) - # find the HDF5 include directories - if("${__lang}" STREQUAL "Fortran") - set(HDF5_INCLUDE_FILENAME hdf5.mod) - elseif("${__lang}" STREQUAL "CXX") - set(HDF5_INCLUDE_FILENAME H5Cpp.h) - else() - set(HDF5_INCLUDE_FILENAME hdf5.h) - endif() - - find_path(HDF5_${__lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME} - HINTS ${HDF5_ROOT} - PATHS $ENV{HOME}/.local/include - PATH_SUFFIXES include Include - ${_HDF5_SEARCH_OPTS} - ) - mark_as_advanced(HDF5_${__lang}_INCLUDE_DIR) - # set the _DIRS variable as this is what the user will normally use - set(HDF5_${__lang}_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR}) - list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR}) - - # find the HDF5 libraries - foreach(LIB IN LISTS HDF5_${__lang}_LIBRARY_NAMES) - if(HDF5_USE_STATIC_LIBRARIES) - # According to bug 1643 on the CMake bug tracker, this is the - # preferred method for searching for a static library. - # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search - # first for the full static library name, but fall back to a - # generic search on the name if the static search fails. - set( THIS_LIBRARY_SEARCH_DEBUG - lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug - lib${LIB}d-static.a lib${LIB}_debug-static.a ${LIB}d-static ${LIB}_D-static ${LIB}_debug-static ) - set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a lib${LIB} lib${LIB}-static.a ${LIB}-static) - else() - set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) - set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) - if(WIN32) - list(APPEND HDF5_DEFINITIONS "-DH5_BUILT_AS_DYNAMIC_LIB") - endif() - endif() - find_library(HDF5_${LIB}_LIBRARY_DEBUG - NAMES ${THIS_LIBRARY_SEARCH_DEBUG} - HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib - ${_HDF5_SEARCH_OPTS} - ) - find_library( HDF5_${LIB}_LIBRARY_RELEASE - NAMES ${THIS_LIBRARY_SEARCH_RELEASE} - HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib - ${_HDF5_SEARCH_OPTS} - ) - select_library_configurations( HDF5_${LIB} ) - list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY}) - endforeach() - if(HDF5_${__lang}_LIBRARIES) - set(HDF5_${__lang}_FOUND True) - endif() - - # Append the libraries for this language binding to the list of all - # required libraries. - list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES}) - - if(FIND_HL) - foreach(LIB IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES) - if(HDF5_USE_STATIC_LIBRARIES) - # According to bug 1643 on the CMake bug tracker, this is the - # preferred method for searching for a static library. - # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search - # first for the full static library name, but fall back to a - # generic search on the name if the static search fails. - set( THIS_LIBRARY_SEARCH_DEBUG - lib${LIB}d.a lib${LIB}_debug.a lib${LIB}d lib${LIB}_D lib${LIB}_debug - lib${LIB}d-static.a lib${LIB}_debug-static.a lib${LIB}d-static lib${LIB}_D-static lib${LIB}_debug-static ) - set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} lib${LIB}-static.a lib${LIB}-static) - else() - set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_D ${LIB}_debug ${LIB}d-shared ${LIB}_D-shared ${LIB}_debug-shared) - set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared) - endif() - find_library(HDF5_${LIB}_LIBRARY_DEBUG - NAMES ${THIS_LIBRARY_SEARCH_DEBUG} - HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib - ${_HDF5_SEARCH_OPTS} - ) - find_library( HDF5_${LIB}_LIBRARY_RELEASE - NAMES ${THIS_LIBRARY_SEARCH_RELEASE} - HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib - ${_HDF5_SEARCH_OPTS} - ) - select_library_configurations( HDF5_${LIB} ) - list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${LIB}_LIBRARY}) - endforeach() - - # Append the libraries for this language binding to the list of all - # required libraries. - list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES}) - endif() - endforeach() - if(FIND_HL AND HDF5_HL_LIBRARIES) - set(HDF5_HL_FOUND True) - endif() - - _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS) - _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS) - _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES) - _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES) - - # If the HDF5 include directory was found, open H5pubconf.h to determine if - # HDF5 was compiled with parallel IO support - set( HDF5_IS_PARALLEL FALSE ) - set( HDF5_VERSION "" ) - foreach( _dir IN LISTS HDF5_INCLUDE_DIRS ) - foreach(_hdr "${_dir}/H5pubconf.h" "${_dir}/H5pubconf-64.h" "${_dir}/H5pubconf-32.h") - if( EXISTS "${_hdr}" ) - file( STRINGS "${_hdr}" - HDF5_HAVE_PARALLEL_DEFINE - REGEX "HAVE_PARALLEL 1" ) - if( HDF5_HAVE_PARALLEL_DEFINE ) - set( HDF5_IS_PARALLEL TRUE ) - endif() - unset(HDF5_HAVE_PARALLEL_DEFINE) - - file( STRINGS "${_hdr}" - HDF5_VERSION_DEFINE - REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" ) - if( "${HDF5_VERSION_DEFINE}" MATCHES - "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?\"" ) - set( HDF5_VERSION "${CMAKE_MATCH_1}" ) - if( CMAKE_MATCH_3 ) - set( HDF5_VERSION ${HDF5_VERSION}.${CMAKE_MATCH_3}) - endif() - endif() - unset(HDF5_VERSION_DEFINE) - endif() - endforeach() - endforeach() - set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL - "HDF5 library compiled with parallel IO support" ) - mark_as_advanced( HDF5_IS_PARALLEL ) - - set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS) - if(FIND_HL) - list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES) - endif() -endif() - -# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of -# HDF5_INCLUDE_DIRS -if( HDF5_INCLUDE_DIRS ) - set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) -endif() - -# If HDF5_REQUIRED_VARS is empty at this point, then it's likely that -# something external is trying to explicitly pass already found -# locations -if(NOT HDF5_REQUIRED_VARS) - set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS) -endif() - -find_package_handle_standard_args(HDF5 - REQUIRED_VARS ${HDF5_REQUIRED_VARS} - VERSION_VAR HDF5_VERSION - HANDLE_COMPONENTS -) - -unset(_HDF5_SEARCH_OPTS) - -if( HDF5_FOUND AND NOT HDF5_DIR) - # hide HDF5_DIR for the non-advanced user to avoid confusion with - # HDF5_DIR-NOT_FOUND while HDF5 was found. - mark_as_advanced(HDF5_DIR) -endif() - -if (HDF5_FIND_DEBUG) - message(STATUS "HDF5_DIR: ${HDF5_DIR}") - message(STATUS "HDF5_DEFINITIONS: ${HDF5_DEFINITIONS}") - message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}") - message(STATUS "HDF5_LIBRARIES: ${HDF5_LIBRARIES}") - message(STATUS "HDF5_HL_LIBRARIES: ${HDF5_HL_LIBRARIES}") - foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS) - message(STATUS "HDF5_${__lang}_DEFINITIONS: ${HDF5_${__lang}_DEFINITIONS}") - message(STATUS "HDF5_${__lang}_INCLUDE_DIR: ${HDF5_${__lang}_INCLUDE_DIR}") - message(STATUS "HDF5_${__lang}_INCLUDE_DIRS: ${HDF5_${__lang}_INCLUDE_DIRS}") - message(STATUS "HDF5_${__lang}_LIBRARY: ${HDF5_${__lang}_LIBRARY}") - message(STATUS "HDF5_${__lang}_LIBRARIES: ${HDF5_${__lang}_LIBRARIES}") - message(STATUS "HDF5_${__lang}_HL_LIBRARY: ${HDF5_${__lang}_HL_LIBRARY}") - message(STATUS "HDF5_${__lang}_HL_LIBRARIES: ${HDF5_${__lang}_HL_LIBRARIES}") - endforeach() -endif() diff --git a/cmake/Modules/NewCMake/FindMPI.cmake b/cmake/Modules/NewCMake/FindMPI.cmake deleted file mode 100644 index 5cd2a2afe..000000000 --- a/cmake/Modules/NewCMake/FindMPI.cmake +++ /dev/null @@ -1,1514 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindMPI -# ------- -# -# Find a Message Passing Interface (MPI) implementation. -# -# The Message Passing Interface (MPI) is a library used to write -# high-performance distributed-memory parallel applications, and is -# typically deployed on a cluster. MPI is a standard interface (defined -# by the MPI forum) for which many implementations are available. -# -# Variables for using MPI -# ^^^^^^^^^^^^^^^^^^^^^^^ -# -# The module exposes the components ``C``, ``CXX``, ``MPICXX`` and ``Fortran``. -# Each of these controls the various MPI languages to search for. -# The difference between ``CXX`` and ``MPICXX`` is that ``CXX`` refers to the -# MPI C API being usable from C++, whereas ``MPICXX`` refers to the MPI-2 C++ API -# that was removed again in MPI-3. -# -# Depending on the enabled components the following variables will be set: -# -# ``MPI_FOUND`` -# Variable indicating that MPI settings for all requested languages have been found. -# If no components are specified, this is true if MPI settings for all enabled languages -# were detected. Note that the ``MPICXX`` component does not affect this variable. -# ``MPI_VERSION`` -# Minimal version of MPI detected among the requested languages, or all enabled languages -# if no components were specified. -# -# This module will set the following variables per language in your -# project, where ```` is one of C, CXX, or Fortran: -# -# ``MPI__FOUND`` -# Variable indicating the MPI settings for ```` were found and that -# simple MPI test programs compile with the provided settings. -# ``MPI__COMPILER`` -# MPI compiler for ```` if such a program exists. -# ``MPI__COMPILE_OPTIONS`` -# Compilation options for MPI programs in ````, given as a :ref:`;-list `. -# ``MPI__COMPILE_DEFINITIONS`` -# Compilation definitions for MPI programs in ````, given as a :ref:`;-list `. -# ``MPI__INCLUDE_DIRS`` -# Include path(s) for MPI header. -# ``MPI__LINK_FLAGS`` -# Linker flags for MPI programs. -# ``MPI__LIBRARIES`` -# All libraries to link MPI programs against. -# -# Additionally, the following :prop_tgt:`IMPORTED` targets are defined: -# -# ``MPI::MPI_`` -# Target for using MPI from ````. -# -# The following variables indicating which bindings are present will be defined: -# -# ``MPI_MPICXX_FOUND`` -# Variable indicating whether the MPI-2 C++ bindings are present (introduced in MPI-2, removed with MPI-3). -# ``MPI_Fortran_HAVE_F77_HEADER`` -# True if the Fortran 77 header ``mpif.h`` is available. -# ``MPI_Fortran_HAVE_F90_MODULE`` -# True if the Fortran 90 module ``mpi`` can be used for accessing MPI (MPI-2 and higher only). -# ``MPI_Fortran_HAVE_F08_MODULE`` -# True if the Fortran 2008 ``mpi_f08`` is available to MPI programs (MPI-3 and higher only). -# -# If possible, the MPI version will be determined by this module. The facilities to detect the MPI version -# were introduced with MPI-1.2, and therefore cannot be found for older MPI versions. -# -# ``MPI__VERSION_MAJOR`` -# Major version of MPI implemented for ```` by the MPI distribution. -# ``MPI__VERSION_MINOR`` -# Minor version of MPI implemented for ```` by the MPI distribution. -# ``MPI__VERSION`` -# MPI version implemented for ```` by the MPI distribution. -# -# Note that there's no variable for the C bindings being accessible through ``mpi.h``, since the MPI standards -# always have required this binding to work in both C and C++ code. -# -# For running MPI programs, the module sets the following variables -# -# ``MPIEXEC_EXECUTABLE`` -# Executable for running MPI programs, if such exists. -# ``MPIEXEC_NUMPROC_FLAG`` -# Flag to pass to ``mpiexec`` before giving it the number of processors to run on. -# ``MPIEXEC_MAX_NUMPROCS`` -# Number of MPI processors to utilize. Defaults to the number -# of processors detected on the host system. -# ``MPIEXEC_PREFLAGS`` -# Flags to pass to ``mpiexec`` directly before the executable to run. -# ``MPIEXEC_POSTFLAGS`` -# Flags to pass to ``mpiexec`` after other flags. -# -# Variables for locating MPI -# ^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# This module performs a three step search for an MPI implementation: -# -# 1. Check if the compiler has MPI support built-in. This is the case if the user passed a -# compiler wrapper as ``CMAKE__COMPILER`` or if they're on a Cray system. -# 2. Attempt to find an MPI compiler wrapper and determine the compiler information from it. -# 3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings. -# Currently, only Microsoft MPI and MPICH2 on Windows are supported. -# -# For controlling the second step, the following variables may be set: -# -# ``MPI__COMPILER`` -# Search for the specified compiler wrapper and use it. -# ``MPI__COMPILER_FLAGS`` -# Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers -# support linking debug or tracing libraries if a specific flag is passed and this variable -# may be used to obtain them. -# ``MPI_COMPILER_FLAGS`` -# Used to initialize ``MPI__COMPILER_FLAGS`` if no language specific flag has been given. -# Empty by default. -# ``MPI_EXECUTABLE_SUFFIX`` -# A suffix which is appended to all names that are being looked for. For instance you may set this -# to ``.mpich`` or ``.openmpi`` to prefer the one or the other on Debian and its derivatives. -# -# In order to control the guessing step, the following variable may be set: -# -# ``MPI_GUESS_LIBRARY_NAME`` -# Valid values are ``MSMPI`` and ``MPICH2``. If set, only the given library will be searched for. -# By default, ``MSMPI`` will be preferred over ``MPICH2`` if both are available. -# This also sets ``MPI_SKIP_COMPILER_WRAPPER`` to ``true``, which may be overridden. -# -# Each of the search steps may be skipped with the following control variables: -# -# ``MPI_ASSUME_NO_BUILTIN_MPI`` -# If true, the module assumes that the compiler itself does not provide an MPI implementation and -# skips to step 2. -# ``MPI_SKIP_COMPILER_WRAPPER`` -# If true, no compiler wrapper will be searched for. -# ``MPI_SKIP_GUESSING`` -# If true, the guessing step will be skipped. -# -# Additionally, the following control variable is available to change search behavior: -# -# ``MPI_CXX_SKIP_MPICXX`` -# Add some definitions that will disable the MPI-2 C++ bindings. -# Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof, -# for example MVAPICH or Intel MPI. -# -# If the find procedure fails for a variable ``MPI__WORKS``, then the settings detected by or passed to -# the module did not work and even a simple MPI test program failed to compile. -# -# If all of these parameters were not sufficient to find the right MPI implementation, a user may -# disable the entire autodetection process by specifying both a list of libraries in ``MPI__LIBRARIES`` -# and a list of include directories in ``MPI__ADDITIONAL_INCLUDE_DIRS``. -# Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the -# settings in the cache. -# -# Cache variables for MPI -# ^^^^^^^^^^^^^^^^^^^^^^^ -# -# The variable ``MPI__INCLUDE_DIRS`` will be assembled from the following variables. -# For C and CXX: -# -# ``MPI__HEADER_DIR`` -# Location of the ``mpi.h`` header on disk. -# -# For Fortran: -# -# ``MPI_Fortran_F77_HEADER_DIR`` -# Location of the Fortran 77 header ``mpif.h``, if it exists. -# ``MPI_Fortran_MODULE_DIR`` -# Location of the ``mpi`` or ``mpi_f08`` modules, if available. -# -# For all languages the following variables are additionally considered: -# -# ``MPI__ADDITIONAL_INCLUDE_DIRS`` -# A :ref:`;-list ` of paths needed in addition to the normal include directories. -# ``MPI__INCLUDE_DIR`` -# Path variables for include folders referred to by ````. -# ``MPI__ADDITIONAL_INCLUDE_VARS`` -# A :ref:`;-list ` of ```` that will be added to the include locations of ````. -# -# The variable ``MPI__LIBRARIES`` will be assembled from the following variables: -# -# ``MPI__LIBRARY`` -# The location of a library called ```` for use with MPI. -# ``MPI__LIB_NAMES`` -# A :ref:`;-list ` of ```` that will be added to the include locations of ````. -# -# Usage of mpiexec -# ^^^^^^^^^^^^^^^^ -# -# When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically -# use all of the ``MPIEXEC_EXECUTABLE`` flags as follows: -# -# :: -# -# ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} -# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS -# -# where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to -# pass to the MPI program. -# -# Advanced variables for using MPI -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# The module can perform some advanced feature detections upon explicit request. -# -# **Important notice:** The following checks cannot be performed without *executing* an MPI test program. -# Consider the special considerations for the behavior of :command:`try_run` during cross compilation. -# Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems. -# You should only enable these detections if you absolutely need the information. -# -# If the following variables are set to true, the respective search will be performed: -# -# ``MPI_DETERMINE_Fortran_CAPABILITIES`` -# Determine for all available Fortran bindings what the values of ``MPI_SUBARRAYS_SUPPORTED`` and -# ``MPI_ASYNC_PROTECTS_NONBLOCKING`` are and make their values available as ``MPI_Fortran__SUBARRAYS`` -# and ``MPI_Fortran__ASYNCPROT``, where ```` is one of ``F77_HEADER``, ``F90_MODULE`` and -# ``F08_MODULE``. -# ``MPI_DETERMINE_LIBRARY_VERSION`` -# For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI__LIBRARY_VERSION``. -# This information is usually tied to the runtime component of an MPI implementation and might differ depending on ````. -# Note that the return value is entirely implementation defined. This information might be used to identify -# the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor. -# -# Backward Compatibility -# ^^^^^^^^^^^^^^^^^^^^^^ -# -# For backward compatibility with older versions of FindMPI, these -# variables are set, but deprecated: -# -# :: -# -# MPI_COMPILER MPI_LIBRARY MPI_EXTRA_LIBRARY -# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_LINK_FLAGS -# MPI_LIBRARIES -# -# In new projects, please use the ``MPI__XXX`` equivalents. -# Additionally, the following variables are deprecated: -# -# ``MPI__COMPILE_FLAGS`` -# Use ``MPI__COMPILE_OPTIONS`` and ``MPI__COMPILE_DEFINITIONS`` instead. -# ``MPI__INCLUDE_PATH`` -# For consumption use ``MPI__INCLUDE_DIRS`` and for specifying folders use ``MPI__ADDITIONAL_INCLUDE_DIRS`` instead. -# ``MPIEXEC`` -# Use ``MPIEXEC_EXECUTABLE`` instead. - -cmake_policy(PUSH) -cmake_policy(SET CMP0057 NEW) # if IN_LIST - -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - -# Generic compiler names -set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r) -set(_MPI_CXX_GENERIC_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++ - mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r) -set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r - mpif90 mpif90_r mpf90 mpf90_r - mpif77 mpif77_r mpf77 mpf77_r - mpifc) - -# GNU compiler names -set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r) -set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r mpigxx) -set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r - mpig77 mpig77_r mpg77 mpg77_r) - -# Intel MPI compiler names on Windows -if(WIN32) - list(APPEND _MPI_C_GENERIC_COMPILER_NAMES mpicc.bat) - list(APPEND _MPI_CXX_GENERIC_COMPILER_NAMES mpicxx.bat) - list(APPEND _MPI_Fortran_GENERIC_COMPILER_NAMES mpifc.bat) - - # Intel MPI compiler names - set(_MPI_Intel_C_COMPILER_NAMES mpiicc.bat) - set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc.bat) - set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort.bat mpif77.bat mpif90.bat) - - # Intel MPI compiler names for MSMPI - set(_MPI_MSVC_C_COMPILER_NAMES mpicl.bat) - set(_MPI_MSVC_CXX_COMPILER_NAMES mpicl.bat) -else() - # Intel compiler names - set(_MPI_Intel_C_COMPILER_NAMES mpiicc) - set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++) - set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77) -endif() - -# PGI compiler names -set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc) -set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC) -set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77) - -# XLC MPI Compiler names -set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r) -set(_MPI_XL_CXX_COMPILER_NAMES mpixlcxx mpixlC mpixlc++ mpxlcxx mpxlc++ mpixlc++ mpxlCC - mpixlcxx_r mpixlC_r mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r) -set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95_r - mpixlf90 mpixlf90_r mpxlf90 mpxlf90_r - mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r - mpixlf mpixlf_r mpxlf mpxlf_r) - -# Prepend vendor-specific compiler wrappers to the list. If we don't know the compiler, -# attempt all of them. -# By attempting vendor-specific compiler names first, we should avoid situations where the compiler wrapper -# stems from a proprietary MPI and won't know which compiler it's being used for. For instance, Intel MPI -# controls its settings via the I_MPI_CC environment variables if the generic name is being used. -# If we know which compiler we're working with, we can use the most specialized wrapper there is in order to -# pick up the right settings for it. -foreach (LANG IN ITEMS C CXX Fortran) - set(_MPI_${LANG}_COMPILER_NAMES "") - foreach (id IN ITEMS GNU Intel MSVC PGI XL) - if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id) - list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${id}_${LANG}_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) - endif() - unset(_MPI_${id}_${LANG}_COMPILER_NAMES) - endforeach() - list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${LANG}_GENERIC_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX}) - unset(_MPI_${LANG}_GENERIC_COMPILER_NAMES) -endforeach() - -# Names to try for mpiexec -# Only mpiexec commands are guaranteed to behave as described in the standard, -# mpirun commands are not covered by the standard in any way whatsoever. -# lamexec is the executable for LAM/MPI, srun is for SLURM or Open MPI with SLURM support. -# srun -n X is however a valid command, so it behaves 'like' mpiexec. -set(_MPIEXEC_NAMES_BASE mpiexec mpiexec.hydra mpiexec.mpd mpirun lamexec srun) - -unset(_MPIEXEC_NAMES) -foreach(_MPIEXEC_NAME IN LISTS _MPIEXEC_NAMES_BASE) - list(APPEND _MPIEXEC_NAMES "${_MPIEXEC_NAME}${MPI_EXECUTABLE_SUFFIX}") -endforeach() -unset(_MPIEXEC_NAMES_BASE) - -function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) - if(DEFINED MPI_${LANG}_COMPILER_FLAGS) -# separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}") - separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS "${MPI_${LANG}_COMPILER_FLAGS}") - else() - separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}") - endif() - execute_process( - COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG} - OUTPUT_VARIABLE WRAPPER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE WRAPPER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE WRAPPER_RETURN) - # Some compiler wrappers will yield spurious zero return values, for example - # Intel MPI tolerates unknown arguments and if the MPI wrappers loads a shared - # library that has invalid or missing version information there would be warning - # messages emitted by ld.so in the compiler output. In either case, we'll treat - # the output as invalid. - if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available") - set(WRAPPER_RETURN 255) - endif() - # Ensure that no error output might be passed upwards. - if(NOT WRAPPER_RETURN EQUAL 0) - unset(WRAPPER_OUTPUT) - endif() - set(${OUTPUT_VARIABLE} "${WRAPPER_OUTPUT}" PARENT_SCOPE) - set(${RESULT_VARIABLE} "${WRAPPER_RETURN}" PARENT_SCOPE) -endfunction() - -function (_MPI_interrogate_compiler lang) - unset(MPI_COMPILE_CMDLINE) - unset(MPI_LINK_CMDLINE) - - unset(MPI_COMPILE_OPTIONS_WORK) - unset(MPI_COMPILE_DEFINITIONS_WORK) - unset(MPI_INCLUDE_DIRS_WORK) - unset(MPI_LINK_FLAGS_WORK) - unset(MPI_LIB_NAMES_WORK) - unset(MPI_LIB_FULLPATHS_WORK) - - # Check whether the -showme:compile option works. This indicates that we have either Open MPI - # or a newer version of LAM/MPI, and implies that -showme:link will also work. - # Open MPI also supports -show, but separates linker and compiler information - _MPI_check_compiler(${LANG} "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - if (MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-showme:link" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) - - if (NOT MPI_COMPILER_RETURN EQUAL 0) - unset(MPI_COMPILE_CMDLINE) - endif() - endif() - - # MPICH and MVAPICH offer -compile-info and -link-info. - # For modern versions, both do the same as -show. However, for old versions, they do differ - # when called for mpicxx and mpif90 and it's necessary to use them over -show in order to find the - # removed MPI C++ bindings. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - - if (MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-link-info" MPI_LINK_CMDLINE MPI_COMPILER_RETURN) - - if (NOT MPI_COMPILER_RETURN EQUAL 0) - unset(MPI_COMPILE_CMDLINE) - endif() - endif() - endif() - - # MPICH, MVAPICH2 and Intel MPI just use "-show". Open MPI also offers this, but the - # -showme commands are more specialized. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - endif() - - # Older versions of LAM/MPI have "-showme". Open MPI also supports this. - # Unknown to MPICH, MVAPICH and Intel MPI. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - _MPI_check_compiler(${LANG} "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN) - endif() - - if (NOT (MPI_COMPILER_RETURN EQUAL 0) OR NOT (DEFINED MPI_COMPILE_CMDLINE)) - # Cannot interrogate this compiler, so exit. - set(MPI_${LANG}_WRAPPER_FOUND FALSE PARENT_SCOPE) - return() - endif() - unset(MPI_COMPILER_RETURN) - - # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE - # into MPI_LINK_CMDLINE, if we didn't find the link line. - if (NOT DEFINED MPI_LINK_CMDLINE) - set(MPI_LINK_CMDLINE "${MPI_COMPILE_CMDLINE}") - endif() - - # At this point, we obtained some output from a compiler wrapper that works. - # We'll now try to parse it into variables with meaning to us. - if("${LANG}" STREQUAL "Fortran") - # Some MPICH-1 and MVAPICH-1 versions return a three command answer for Fortran, consisting - # out of a symlink command for mpif.h, the actual compiler command and a deletion of the - # created symlink. We need to detect that case, remember the include path and drop the - # symlink/deletion operation to obtain the link/compile lines we'd usually expect. - if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h") - get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY) - string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") - string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") - string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") - string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") - endif() - endif() - - # The Intel MPI wrapper on Linux will emit some objcopy commands after its compile command - # if -static_mpi was passed to the wrapper. To avoid spurious matches, we need to drop these lines. - if(UNIX) - string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}") - string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}") - endif() - - # Extract compile options from the compile command line. - string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}") - - foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS) - string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}") - # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries - # themselves were built with this flag. However, this flag is unrelated to using MPI, and - # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore - # produce inconsistent results with the regularly flags. - # Similarly, aliasing flags do not belong into our flag array. - if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f(stack-protector|(no-|)strict-aliasing|PI[CE]|pi[ce])") - list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}") - endif() - endforeach() - - # Same deal, with the definitions. We also treat arguments passed to the preprocessor directly. - string(REGEX MATCHALL "(^| )(-Wp,|-Xpreprocessor |)[-/]D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}") - - foreach(_MPI_COMPILE_DEFINITION IN LISTS MPI_ALL_COMPILE_DEFINITIONS) - string(REGEX REPLACE "^ ?(-Wp,|-Xpreprocessor )?[-/]D" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") - string(REPLACE "\"" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}") - if(NOT "${_MPI_COMPILE_DEFINITION}" MATCHES "^_FORTIFY_SOURCE.*") - list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${_MPI_COMPILE_DEFINITION}") - endif() - endforeach() - - # Extract include paths from compile command line - string(REGEX MATCHALL "(^| )[-/]I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") - - # If extracting failed to work, we'll try using -showme:incdirs. - if (NOT MPI_ALL_INCLUDE_PATHS) - _MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN) - if(MPI_INCDIRS_COMPILER_RETURN) - separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}") - endif() - endif() - - foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS) - string(REGEX REPLACE "^ ?[-/]I" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") - string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") - get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH) - list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}") - endforeach() - - # Extract linker paths from the link command line - string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker |)(-L|[/-]LIBPATH:|[/-]libpath:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") - - # If extracting failed to work, we'll try using -showme:libdirs. - if (NOT MPI_ALL_LINK_PATHS) - _MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN) - if(MPI_LIBDIRS_COMPILER_RETURN) - separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}") - endif() - endif() - - foreach(_MPI_LPATH IN LISTS MPI_ALL_LINK_PATHS) - string(REGEX REPLACE "^ ?(-Wl,|-Xlinker )?(-L|[/-]LIBPATH:|[/-]libpath:)" "" _MPI_LPATH "${_MPI_LPATH}") - string(REPLACE "\"" "" _MPI_LPATH "${_MPI_LPATH}") - get_filename_component(_MPI_LPATH "${_MPI_LPATH}" REALPATH) - list(APPEND MPI_LINK_DIRECTORIES_WORK "${_MPI_LPATH}") - endforeach() - - # Extract linker flags from the link command line - string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") - - foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS) - string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG) - # MPI might be marked to build with non-executable stacks but this should not propagate. - if (NOT "${_MPI_LINK_FLAG}" MATCHES "(-Wl,|-Xlinker )-z,noexecstack") - if (MPI_LINK_FLAGS_WORK) - string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}") - else() - set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}") - endif() - endif() - endforeach() - - # Extract the set of libraries to link against from the link command - # line - string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") - - foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) - string(REGEX REPLACE "^ ?-l" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) - if(NOT "${_MPI_LIB_PATH}" STREQUAL "") - list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") - else() - list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") - endif() - endforeach() - - if(WIN32) - # A compiler wrapper on Windows will just have the name of the - # library to link on its link line, potentially with a full path - string(REGEX MATCHALL "(^| )([^\" ]+\\.lib|\"[^\"]+\\.lib\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") - foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES) - string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) - if(NOT "${_MPI_LIB_PATH}" STREQUAL "") - list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") - else() - list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") - endif() - endforeach() - else() - # On UNIX platforms, archive libraries can be given with full path. - string(REGEX MATCHALL "(^| )([^\" ]+\\.a|\"[^\"]+\\.a\")" MPI_LIBFULLPATHS "${MPI_LINK_CMDLINE}") - foreach(_MPI_LIB_NAME IN LISTS MPI_LIBFULLPATHS) - string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}") - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY) - if(NOT "${_MPI_LIB_PATH}" STREQUAL "") - list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}") - else() - list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}") - endif() - endforeach() - endif() - - # An MPI compiler wrapper could have its MPI libraries in the implictly - # linked directories of the compiler itself. - if(DEFINED CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) - list(APPEND MPI_LINK_DIRECTORIES_WORK "${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}") - endif() - - # Determine full path names for all of the libraries that one needs - # to link against in an MPI program - unset(MPI_PLAIN_LIB_NAMES_WORK) - foreach(_MPI_LIB_NAME IN LISTS MPI_LIB_NAMES_WORK) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_NAME}" NAME_WE) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${MPI_LINK_DIRECTORIES_WORK} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - - # Deal with the libraries given with full path next - unset(MPI_DIRECT_LIB_NAMES_WORK) - foreach(_MPI_LIB_FULLPATH IN LISTS MPI_LIB_FULLPATHS_WORK) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME) - get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_FULLPATH}" DIRECTORY) - list(APPEND MPI_DIRECT_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_PATH} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - if(MPI_DIRECT_LIB_NAMES_WORK) - set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}") - endif() - - # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to - # link it in that case. -lpthread is covered by the normal library treatment on the other hand. - if("${MPI_COMPILE_CMDLINE}" MATCHES "-pthread") - list(APPEND MPI_COMPILE_OPTIONS_WORK "-pthread") - if(MPI_LINK_FLAGS_WORK) - string(APPEND MPI_LINK_FLAGS_WORK " -pthread") - else() - set(MPI_LINK_FLAGS_WORK "-pthread") - endif() - endif() - - if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) - list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}") - endif() - if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) - list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}") - endif() - if(MPI_${LANG}_EXTRA_LIB_NAMES) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") - endif() - - # If we found MPI, set up all of the appropriate cache entries - if(NOT MPI_${LANG}_COMPILE_OPTIONS) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) - endif() - if(NOT MPI_${LANG}_COMPILE_DEFINITIONS) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_COMPILE_DEFINITIONS_WORK} CACHE STRING "MPI ${LANG} compilation definitions" FORCE) - endif() - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} additional include directories" FORCE) - endif() - if(NOT MPI_${LANG}_LINK_FLAGS) - set(MPI_${LANG}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${LANG} linker flags" FORCE) - endif() - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES ${MPI_PLAIN_LIB_NAMES_WORK} CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - set(MPI_${LANG}_WRAPPER_FOUND TRUE PARENT_SCOPE) -endfunction() - -function(_MPI_guess_settings LANG) - set(MPI_GUESS_FOUND FALSE) - # Currently only MSMPI and MPICH2 on Windows are supported, so we can skip this search if we're not targeting that. - if(WIN32) - # MSMPI - - # The environment variables MSMPI_INC and MSMPILIB32/64 are the only ways of locating the MSMPI_SDK, - # which is installed separately from the runtime. Thus it's possible to have mpiexec but not MPI headers - # or import libraries and vice versa. - if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MSMPI") - # We first attempt to locate the msmpi.lib. Should be find it, we'll assume that the MPI present is indeed - # Microsoft MPI. - if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB64}") - set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x64") - else() - set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB32}") - set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x86") - endif() - - find_library(MPI_msmpi_LIBRARY - NAMES msmpi - HINTS ${MPI_MSMPI_LIB_PATH} - DOC "Location of the msmpi library for Microsoft MPI") - mark_as_advanced(MPI_msmpi_LIBRARY) - - if(MPI_msmpi_LIBRARY) - # Next, we attempt to locate the MPI header. Note that for Fortran we know that mpif.h is a way - # MSMPI can be used and therefore that header has to be present. - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - get_filename_component(MPI_MSMPI_INC_DIR "$ENV{MSMPI_INC}" REALPATH) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MSMPI_INC_DIR}" CACHE STRING "MPI ${LANG} additional include directories" FORCE) - unset(MPI_MSMPI_INC_DIR) - endif() - - # For MSMPI, one can compile the MPI module by building the mpi.f90 shipped with the MSMPI SDK, - # thus it might be present or provided by the user. Figuring out which is supported is done later on. - # The PGI Fortran compiler for instance ships a prebuilt set of modules in its own include folder. - # Should a user be employing PGI or have built its own set and provided it via cache variables, the - # splitting routine would have located the module files. - - # For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran - # we need some extra library to glue Fortran support together: - # MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names - # ending with a c are using the cdecl calling convention, whereas those ending with an s are for Fortran - # implementations using stdcall. Therefore, the 64-bit MSMPI only ships those ending in 'c', whereas the 32-bit - # has both variants available. - # The second difference is the last but one letter, if it's an e(nd), the length of a string argument is - # passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed), - # it's passed immediately after the string address. - - # To summarize: - # - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention - # - msmpifmc: CHARACTER length passed directly after string address and using cdecl calling convention - # - msmpifes: CHARACTER length passed after the parameter list and using stdcall calling convention - # - msmpifms: CHARACTER length passed directly after string address and using stdcall calling convention - # 32-bit MSMPI ships all four libraries, 64-bit MSMPI ships only the first two. - - # As is, Intel Fortran and PGI Fortran both use the 'ec' variant of the calling convention, whereas - # the old Compaq Visual Fortran compiler defaulted to the 'ms' version. It's possible to make Intel Fortran - # use the CVF calling convention using /iface:cvf, but we assume - and this is also assumed in FortranCInterface - - # this isn't the case. It's also possible to make CVF use the 'ec' variant, using /iface=(cref,nomixed_str_len_arg). - - # Our strategy is now to locate all libraries, but enter msmpifec into the LIB_NAMES array. - # Should this not be adequate it's a straightforward way for a user to change the LIB_NAMES array and - # have his library found. Still, this should not be necessary outside of exceptional cases, as reasoned. - if ("${LANG}" STREQUAL "Fortran") - set(MPI_MSMPI_CALLINGCONVS c) - if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4) - list(APPEND MPI_MSMPI_CALLINGCONVS s) - endif() - foreach(mpistrlenpos IN ITEMS e m) - foreach(mpicallingconv IN LISTS MPI_MSMPI_CALLINGCONVS) - find_library(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY - NAMES msmpif${mpistrlenpos}${mpicallingconv} - HINTS "${MPI_MSMPI_LIB_PATH}" - DOC "Location of the msmpi${mpistrlenpos}${mpicallingconv} library for Microsoft MPI") - mark_as_advanced(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY) - endforeach() - endforeach() - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES "msmpi;msmpifec" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - - # At this point we're *not* done. MSMPI requires an additional include file for Fortran giving the value - # of MPI_AINT. This file is called mpifptr.h located in the x64 and x86 subfolders, respectively. - find_path(MPI_mpifptr_INCLUDE_DIR - NAMES "mpifptr.h" - HINTS "${MPI_MSMPI_INC_PATH_EXTRA}" - DOC "Location of the mpifptr.h extra header for Microsoft MPI") - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS "mpifptr" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) - endif() - mark_as_advanced(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS MPI_mpifptr_INCLUDE_DIR) - else() - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES "msmpi" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - endif() - mark_as_advanced(MPI_${LANG}_LIB_NAMES) - set(MPI_GUESS_FOUND TRUE) - endif() - endif() - - # At this point there's not many MPIs that we could still consider. - # OpenMPI 1.6.x and below supported Windows, but these ship compiler wrappers that still work. - # The only other relevant MPI implementation without a wrapper is MPICH2, which had Windows support in 1.4.1p1 and older. - if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2") - set(MPI_MPICH_PREFIX_PATHS - "$ENV{ProgramW6432}/MPICH2/lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/../lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]/lib" - ) - - # All of C, C++ and Fortran will need mpi.lib, so we'll look for this first - find_library(MPI_mpi_LIBRARY - NAMES mpi - HINTS ${MPI_MPICH_PREFIX_PATHS}) - mark_as_advanced(MPI_mpi_LIBRARY) - # If we found mpi.lib, we detect the rest of MPICH2 - if(MPI_mpi_LIBRARY) - set(MPI_MPICH_LIB_NAMES "mpi") - # If MPI-2 C++ bindings are requested, we need to locate cxx.lib as well. - # Otherwise, MPICH_SKIP_MPICXX will be defined and these bindings aren't needed. - if("${LANG}" STREQUAL "CXX" AND NOT MPI_CXX_SKIP_MPICXX) - find_library(MPI_cxx_LIBRARY - NAMES cxx - HINTS ${MPI_MPICH_PREFIX_PATHS}) - mark_as_advanced(MPI_cxx_LIBRARY) - list(APPEND MPI_MPICH_LIB_NAMES "cxx") - # For Fortran, MPICH2 provides three different libraries: - # fmpich2.lib which uses uppercase symbols and cdecl, - # fmpich2s.lib which uses uppercase symbols and stdcall (32-bit only), - # fmpich2g.lib which uses lowercase symbols with double underscores and cdecl. - # fmpich2s.lib would be useful for Compaq Visual Fortran, fmpich2g.lib has to be used with GNU g77 and is also - # provided in the form of an .a archive for MinGW and Cygwin. From our perspective, fmpich2.lib is the only one - # we need to try, and if it doesn't work with the given Fortran compiler we'd find out later on during validation - elseif("${LANG}" STREQUAL "Fortran") - find_library(MPI_fmpich2_LIBRARY - NAMES fmpich2 - HINTS ${MPI_MPICH_PREFIX_PATHS}) - find_library(MPI_fmpich2s_LIBRARY - NAMES fmpich2s - HINTS ${MPI_MPICH_PREFIX_PATHS}) - find_library(MPI_fmpich2g_LIBRARY - NAMES fmpich2g - HINTS ${MPI_MPICH_PREFIX_PATHS}) - mark_as_advanced(MPI_fmpich2_LIBRARY MPI_fmpich2s_LIBRARY MPI_fmpich2g_LIBRARY) - list(APPEND MPI_MPICH_LIB_NAMES "fmpich2") - endif() - - if(NOT MPI_${LANG}_LIB_NAMES) - set(MPI_${LANG}_LIB_NAMES "${MPI_MPICH_LIB_NAMES}" CACHE STRING "MPI ${LANG} libraries to link against" FORCE) - endif() - unset(MPI_MPICH_LIB_NAMES) - - if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - # For MPICH2, the include folder would be in ../include relative to the library folder. - get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_mpi_LIBRARY}" DIRECTORY) - get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_MPICH_ROOT_DIR}" DIRECTORY) - if(IS_DIRECTORY "${MPI_MPICH_ROOT_DIR}/include") - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MPICH_ROOT_DIR}/include" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI__INCLUDE_DIR." FORCE) - endif() - unset(MPI_MPICH_ROOT_DIR) - endif() - set(MPI_GUESS_FOUND TRUE) - endif() - unset(MPI_MPICH_PREFIX_PATHS) - endif() - endif() - set(MPI_${LANG}_GUESS_FOUND "${MPI_GUESS_FOUND}" PARENT_SCOPE) -endfunction() - -function(_MPI_adjust_compile_definitions LANG) - if("${LANG}" STREQUAL "CXX") - # To disable the C++ bindings, we need to pass some definitions since the mpi.h header has to deal with both C and C++ - # bindings in MPI-2. - if(MPI_CXX_SKIP_MPICXX AND NOT MPI_${LANG}_COMPILE_DEFINITIONS MATCHES "SKIP_MPICXX") - # MPICH_SKIP_MPICXX is being used in MPICH and derivatives like MVAPICH or Intel MPI - # OMPI_SKIP_MPICXX is being used in Open MPI - # _MPICC_H is being used for IBM Platform MPI - list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX" "OMPI_SKIP_MPICXX" "_MPICC_H") - set(MPI_${LANG}_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}" CACHE STRING "MPI ${LANG} compilation definitions" FORCE) - endif() - endif() -endfunction() - -macro(_MPI_assemble_libraries LANG) - set(MPI_${LANG}_LIBRARIES "") - # Only for libraries do we need to check whether the compiler's linking stage is separate. - if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT) - foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) - endforeach() - endif() -endmacro() - -macro(_MPI_assemble_include_dirs LANG) - if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - set(MPI_${LANG}_INCLUDE_DIRS "") - else() - set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") - if("${LANG}" MATCHES "(C|CXX)") - if(MPI_${LANG}_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - else() # Fortran - if(MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") - endif() - if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") - endif() - endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}") - endforeach() - endif() - endif() -endmacro() - -function(_MPI_split_include_dirs LANG) - if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - return() - endif() - # Backwards compatibility: Search INCLUDE_PATH if given. - if(MPI_${LANG}_INCLUDE_PATH) - list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") - endif() - - # We try to find the headers/modules among those paths (and system paths) - # For C/C++, we just need to have a look for mpi.h. - if("${LANG}" MATCHES "(C|CXX)") - find_path(MPI_${LANG}_HEADER_DIR "mpi.h" - HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} - ) - mark_as_advanced(MPI_${LANG}_HEADER_DIR) - if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - # Fortran is more complicated here: An implementation could provide - # any of the Fortran 77/90/2008 APIs for MPI. For example, MSMPI - # only provides Fortran 77 and - if mpi.f90 is built - potentially - # a Fortran 90 module. - elseif("${LANG}" STREQUAL "Fortran") - find_path(MPI_${LANG}_F77_HEADER_DIR "mpif.h" - HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} - ) - find_path(MPI_${LANG}_MODULE_DIR - NAMES "mpi.mod" "mpi_f08.mod" - HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} - ) - if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS - "${MPI_${LANG}_F77_HEADER_DIR}" - "${MPI_${LANG}_MODULE_DIR}" - ) - endif() - mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) - endif() - # Remove duplicates and default system directories from the list. - if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) - foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) - list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR}) - endforeach() - endif() - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) -endfunction() - -macro(_MPI_create_imported_target LANG) - if(NOT TARGET MPI::MPI_${LANG}) - add_library(MPI::MPI_${LANG} INTERFACE IMPORTED) - endif() - - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}") - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}") - - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "") - if(MPI_${LANG}_LINK_FLAGS) - set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LINK_FLAGS}") - endif() - # If the compiler links MPI implicitly, no libraries will be found as they're contained within - # CMAKE__IMPLICIT_LINK_LIBRARIES already. - if(MPI_${LANG}_LIBRARIES) - set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}") - endif() - # Given the new design of FindMPI, INCLUDE_DIRS will always be located, even under implicit linking. - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}") -endmacro() - -function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY) - set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI") - set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/FindMPI") - set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin") - unset(MPI_TEST_COMPILE_DEFINITIONS) - if("${LANG}" STREQUAL "Fortran") - if("${MODE}" STREQUAL "F90_MODULE") - set(MPI_Fortran_INCLUDE_LINE "use mpi\n implicit none") - elseif("${MODE}" STREQUAL "F08_MODULE") - set(MPI_Fortran_INCLUDE_LINE "use mpi_f08\n implicit none") - else() # F77 header - set(MPI_Fortran_INCLUDE_LINE "implicit none\n include 'mpif.h'") - endif() - configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.f90.in" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90" @ONLY) - set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90") - elseif("${LANG}" STREQUAL "CXX") - configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.c" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp" COPYONLY) - set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp") - if("${MODE}" STREQUAL "TEST_MPICXX") - set(MPI_TEST_COMPILE_DEFINITIONS TEST_MPI_MPICXX) - endif() - else() # C - set(MPI_TEST_SOURCE_FILE "${SRC_DIR}/${MPI_TEST_FILE_NAME}.c") - endif() - if(RUN_BINARY) - try_run(MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} - "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" - COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} - LINK_LIBRARIES MPI::MPI_${LANG} - RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}) - set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE) - else() - try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} - "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}" - COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS} - LINK_LIBRARIES MPI::MPI_${LANG} - COPY_FILE "${BIN_FILE}") - endif() -endfunction() - -macro(_MPI_check_lang_works LANG) - # For Fortran we may have by the MPI-3 standard an implementation that provides: - # - the mpi_f08 module - # - *both*, the mpi module and 'mpif.h' - # Since older MPI standards (MPI-1) did not define anything but 'mpif.h', we need to check all three individually. - if( NOT MPI_${LANG}_WORKS ) - if("${LANG}" STREQUAL "Fortran") - set(MPI_Fortran_INTEGER_LINE "(kind=MPI_INTEGER_KIND)") - _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE) - _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE) - _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE) - - set(MPI_${LANG}_WORKS FALSE) - - foreach(mpimethod IN ITEMS F77_HEADER F08_MODULE F90_MODULE) - if(MPI_RESULT_${LANG}_test_mpi_${mpimethod}) - set(MPI_${LANG}_WORKS TRUE) - set(MPI_${LANG}_HAVE_${mpimethod} TRUE) - else() - set(MPI_${LANG}_HAVE_${mpimethod} FALSE) - endif() - endforeach() - # MPI-1 versions had no MPI_INTGER_KIND defined, so we need to try without it. - # However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header. - unset(MPI_Fortran_INTEGER_LINE) - if(NOT MPI_${LANG}_WORKS) - _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE) - if(MPI_RESULT_${LANG}_test_mpi_F77_HEADER_NOKIND) - set(MPI_${LANG}_WORKS TRUE) - set(MPI_${LANG}_HAVE_F77_HEADER TRUE) - endif() - endif() - else() - _MPI_try_staged_settings(${LANG} test_mpi normal FALSE) - # If 'test_mpi' built correctly, we've found valid MPI settings. There might not be MPI-2 C++ support, but there can't - # be MPI-2 C++ support without the C bindings being present, so checking for them is sufficient. - set(MPI_${LANG}_WORKS "${MPI_RESULT_${LANG}_test_mpi_normal}") - endif() - endif() -endmacro() - -# Some systems install various MPI implementations in separate folders in some MPI prefix -# This macro enumerates all such subfolders and adds them to the list of hints that will be searched. -macro(MPI_search_mpi_prefix_folder PREFIX_FOLDER) - if(EXISTS "${PREFIX_FOLDER}") - file(GLOB _MPI_folder_children RELATIVE "${PREFIX_FOLDER}" "${PREFIX_FOLDER}/*") - foreach(_MPI_folder_child IN LISTS _MPI_folder_children) - if(IS_DIRECTORY "${PREFIX_FOLDER}/${_MPI_folder_child}") - list(APPEND MPI_HINT_DIRS "${PREFIX_FOLDER}/${_MPI_folder_child}") - endif() - endforeach() - endif() -endmacro() - -set(MPI_HINT_DIRS ${MPI_HOME} $ENV{MPI_ROOT} $ENV{MPI_HOME} $ENV{I_MPI_ROOT}) -if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux") - # SUSE Linux Enterprise Server stores its MPI implementations under /usr/lib64/mpi/gcc/ - # We enumerate the subfolders and append each as a prefix - MPI_search_mpi_prefix_folder("/usr/lib64/mpi/gcc") -elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") - # MSMPI stores its runtime in a special folder, this adds the possible locations to the hints. - list(APPEND MPI_HINT_DIRS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]") -elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") - # FreeBSD ships mpich under the normal system paths - but available openmpi implementations - # will be found in /usr/local/mpi/ - MPI_search_mpi_prefix_folder("/usr/local/mpi") -endif() - -# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. -# The MPI standard does not mandate the existence of either, but instead only makes requirements if a distribution -# ships an mpiexec program (mpirun executables are not regulated by the standard). -find_program(MPIEXEC_EXECUTABLE - NAMES ${_MPIEXEC_NAMES} - PATH_SUFFIXES bin sbin - HINTS ${MPI_HINT_DIRS} - DOC "Executable for running MPI programs.") - -# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin). -# This gives us a fairly reliable base directory to search for /bin /lib and /include from. -get_filename_component(_MPI_BASE_DIR "${MPIEXEC_EXECUTABLE}" PATH) -get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) - -# According to the MPI standard, section 8.8 -n is a guaranteed, and the only guaranteed way to -# launch an MPI process using mpiexec if such a program exists. -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for mpiexec; the next option will be the number of processes.") -set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by mpiexec.") -set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will be placed after all flags passed to mpiexec.") - -# Set the number of processes to the physical processor count -cmake_host_system_information(RESULT _MPIEXEC_NUMPROCS QUERY NUMBER_OF_PHYSICAL_CORES) -set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.") -unset(_MPIEXEC_NUMPROCS) -mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS) - -#============================================================================= -# Backward compatibility input hacks. Propagate the FindMPI hints to C and -# CXX if the respective new versions are not defined. Translate the old -# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${LANG}_LIBRARIES. -# -# Once we find the new variables, we translate them back into their old -# equivalents below. -if(NOT MPI_IGNORE_LEGACY_VARIABLES) - foreach (LANG IN ITEMS C CXX) - # Old input variables. - set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) - - # Set new vars based on their old equivalents, if the new versions are not already set. - foreach (var ${_MPI_OLD_INPUT_VARS}) - if (NOT MPI_${LANG}_${var} AND MPI_${var}) - set(MPI_${LANG}_${var} "${MPI_${var}}") - endif() - endforeach() - - # Chop the old compile flags into options and definitions - - unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) - unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) - if(MPI_${LANG}_COMPILE_FLAGS) - separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") - foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) - if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") - list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") - else() - list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}") - endif() - endforeach() - unset(MPI_SEPARATE_FLAGS) - endif() - - # If a list of libraries was given, we'll split it into new-style cache variables - unset(MPI_${LANG}_EXTRA_LIB_NAMES) - if(NOT MPI_${LANG}_LIB_NAMES) - foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) - if(_MPI_LIB) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) - get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) - list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endif() - endforeach() - endif() - endforeach() -endif() -#============================================================================= - -unset(MPI_VERSION) -unset(MPI_VERSION_MAJOR) -unset(MPI_VERSION_MINOR) - -unset(_MPI_MIN_VERSION) - -# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. -if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) - set(MPI_SKIP_COMPILER_WRAPPER TRUE) -endif() - -# This loop finds the compilers and sends them off for interrogation. -foreach(LANG IN ITEMS C CXX Fortran) - if(CMAKE_${LANG}_COMPILER_LOADED) - if(NOT MPI_FIND_COMPONENTS) - set(_MPI_FIND_${LANG} TRUE) - elseif( ${LANG} IN_LIST MPI_FIND_COMPONENTS) - set(_MPI_FIND_${LANG} TRUE) - elseif( ${LANG} STREQUAL CXX AND NOT MPI_CXX_SKIP_MPICXX AND MPICXX IN_LIST MPI_FIND_COMPONENTS ) - set(_MPI_FIND_${LANG} TRUE) - else() - set(_MPI_FIND_${LANG} FALSE) - endif() - else() - set(_MPI_FIND_${LANG} FALSE) - endif() - if(_MPI_FIND_${LANG}) - if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS ) - set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.") - mark_as_advanced(MPI_CXX_SKIP_MPICXX) - endif() - if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) - set(MPI_${LANG}_TRIED_IMPLICIT FALSE) - set(MPI_${LANG}_WORKS_IMPLICIT FALSE) - if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) - # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. - # Cray PrgEnv. - _MPI_create_imported_target(${LANG}) - _MPI_check_lang_works(${LANG}) - - # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. - if(MPI_${LANG}_WORKS) - set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) - set(MPI_${LANG}_WORKS_IMPLICIT TRUE) - endif() - set(MPI_${LANG}_TRIED_IMPLICIT TRUE) - endif() - - if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS) - set(MPI_${LANG}_WRAPPER_FOUND FALSE) - set(MPI_PINNED_COMPILER FALSE) - - if(NOT MPI_SKIP_COMPILER_WRAPPER) - if(MPI_${LANG}_COMPILER) - # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. - if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") - # Get rid of our default list of names and just search for the name the user wants. - set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") - unset(MPI_${LANG}_COMPILER CACHE) - endif() - # If the user specifies a compiler, we don't want to try to search libraries either. - set(MPI_PINNED_COMPILER TRUE) - endif() - - # If we have an MPI base directory, we'll try all compiler names in that one first. - # This should prevent mixing different MPI environments - if(_MPI_BASE_DIR) - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - HINTS ${_MPI_BASE_DIR} - NO_DEFAULT_PATH - DOC "MPI compiler for ${LANG}" - ) - endif() - - # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), - # we shall try searching in the default paths. - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - DOC "MPI compiler for ${LANG}" - ) - - if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - set(MPI_PINNED_COMPILER TRUE) - - # If we haven't made the implicit compiler test yet, perform it now. - if(NOT MPI_${LANG}_TRIED_IMPLICIT) - _MPI_create_imported_target(${LANG}) - _MPI_check_lang_works(${LANG}) - endif() - - # Should the MPI compiler not work implicitly for MPI, still interrogate it. - # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used - # directly during linkage instead of CMAKE__COMPILER will not work. - if(NOT MPI_${LANG}_WORKS) - set(MPI_${LANG}_WORKS_IMPLICIT FALSE) - _MPI_interrogate_compiler(${LANG}) - else() - set(MPI_${LANG}_WORKS_IMPLICIT TRUE) - endif() - elseif(MPI_${LANG}_COMPILER) - _MPI_interrogate_compiler(${LANG}) - endif() - endif() - - if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) - # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the - # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. - if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) - else() - _MPI_guess_settings(${LANG}) - endif() - endif() - endif() - endif() - - _MPI_split_include_dirs(${LANG}) - _MPI_assemble_include_dirs(${LANG}) - _MPI_assemble_libraries(${LANG}) - - _MPI_adjust_compile_definitions(${LANG}) - # We always create imported targets even if they're empty - _MPI_create_imported_target(${LANG}) - - if(NOT MPI_${LANG}_WORKS) - _MPI_check_lang_works(${LANG}) - endif() - - # Next, we'll initialize the MPI variables that have not been previously set. - set(MPI_${LANG}_COMPILE_OPTIONS "" CACHE STRING "MPI ${LANG} compilation flags" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) - if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) - endif() - mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS - MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) - - # If we've found MPI, then we'll perform additional analysis: Determine the MPI version, MPI library version, supported - # MPI APIs (i.e. MPI-2 C++ bindings). For Fortran we also need to find specific parameters if we're under MPI-3. - if(MPI_${LANG}_WORKS) - if("${LANG}" STREQUAL "CXX" AND NOT DEFINED MPI_MPICXX_FOUND) - if(NOT MPI_CXX_SKIP_MPICXX AND NOT MPI_CXX_VALIDATE_SKIP_MPICXX) - _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE) - if(MPI_RESULT_${LANG}_test_mpi_MPICXX) - set(MPI_MPICXX_FOUND TRUE) - else() - set(MPI_MPICXX_FOUND FALSE) - endif() - else() - set(MPI_MPICXX_FOUND FALSE) - endif() - endif() - - # At this point, we know the bindings present but not the MPI version or anything else. - if(NOT DEFINED MPI_${LANG}_VERSION) - unset(MPI_${LANG}_VERSION_MAJOR) - unset(MPI_${LANG}_VERSION_MINOR) - endif() - set(MPI_BIN_FOLDER ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI) - - # For Fortran, we'll want to use the most modern MPI binding to test capabilities other than the - # Fortran parameters, since those depend on the method of consumption. - # For C++, we can always use the C bindings, and should do so, since the C++ bindings do not exist in MPI-3 - # whereas the C bindings do, and the C++ bindings never offered any feature advantage over their C counterparts. - if("${LANG}" STREQUAL "Fortran") - if(MPI_${LANG}_HAVE_F08_MODULE) - set(MPI_${LANG}_HIGHEST_METHOD F08_MODULE) - elseif(MPI_${LANG}_HAVE_F90_MODULE) - set(MPI_${LANG}_HIGHEST_METHOD F90_MODULE) - else() - set(MPI_${LANG}_HIGHEST_METHOD F77_HEADER) - endif() - - # Another difference between C and Fortran is that we can't use the preprocessor to determine whether MPI_VERSION - # and MPI_SUBVERSION are provided. These defines did not exist in MPI 1.0 and 1.1 and therefore might not - # exist. For C/C++, test_mpi.c will handle the MPI_VERSION extraction, but for Fortran, we need mpiver.f90. - if(NOT DEFINED MPI_${LANG}_VERSION) - _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE) - if(MPI_RESULT_${LANG}_mpiver_${MPI_${LANG}_HIGHEST_METHOD}) - file(STRINGS ${MPI_BIN_FOLDER}/mpiver_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") - if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") - set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") - set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") - set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") - endif() - endif() - endif() - - # Finally, we want to find out which capabilities a given interface supports, compare the MPI-3 standard. - # This is determined by interface specific parameters MPI_SUBARRAYS_SUPPORTED and MPI_ASYNC_PROTECTS_NONBLOCKING - # and might vary between the different methods of consumption. - if(MPI_DETERMINE_Fortran_CAPABILITIES AND NOT MPI_Fortran_CAPABILITIES_DETERMINED) - foreach(mpimethod IN ITEMS F08_MODULE F90_MODULE F77_HEADER) - if(MPI_${LANG}_HAVE_${mpimethod}) - set(MPI_${LANG}_${mpimethod}_SUBARRAYS FALSE) - set(MPI_${LANG}_${mpimethod}_ASYNCPROT FALSE) - _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE) - if(MPI_RESULT_${LANG}_fortranparam_mpi_${mpimethod} AND - NOT "${MPI_RUN_RESULT_${LANG}_fortranparam_mpi_${mpimethod}}" STREQUAL "FAILED_TO_RUN") - if("${MPI_RUN_OUTPUT_${LANG}_fortranparam_mpi_${mpimethod}}" MATCHES - ".*INFO:SUBARRAYS\\[ *([TF]) *\\]-ASYNCPROT\\[ *([TF]) *\\].*") - if("${CMAKE_MATCH_1}" STREQUAL "T") - set(MPI_${LANG}_${mpimethod}_SUBARRAYS TRUE) - endif() - if("${CMAKE_MATCH_2}" STREQUAL "T") - set(MPI_${LANG}_${mpimethod}_ASYNCPROT TRUE) - endif() - endif() - endif() - endif() - endforeach() - set(MPI_Fortran_CAPABILITIES_DETERMINED TRUE) - endif() - else() - set(MPI_${LANG}_HIGHEST_METHOD normal) - - # By the MPI-2 standard, MPI_VERSION and MPI_SUBVERSION are valid for both C and C++ bindings. - if(NOT DEFINED MPI_${LANG}_VERSION) - file(STRINGS ${MPI_BIN_FOLDER}/test_mpi_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER") - if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*") - set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}") - set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}") - set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}") - endif() - endif() - endif() - - unset(MPI_BIN_FOLDER) - - # At this point, we have dealt with determining the MPI version and parameters for each Fortran method available. - # The one remaining issue is to determine which MPI library is installed. - # Determining the version and vendor of the MPI library is only possible via MPI_Get_library_version() at runtime, - # and therefore we cannot do this while cross-compiling (a user may still define MPI__LIBRARY_VERSION_STRING - # themselves and we'll attempt splitting it, which is equivalent to provide the try_run output). - # It's also worth noting that the installed version string can depend on the language, or on the system the binary - # runs on if MPI is not statically linked. - if(MPI_DETERMINE_LIBRARY_VERSION AND NOT MPI_${LANG}_LIBRARY_VERSION_STRING) - _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE) - if(MPI_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD} AND - "${MPI_RUN_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" EQUAL "0") - string(STRIP "${MPI_RUN_OUTPUT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" - MPI_${LANG}_LIBRARY_VERSION_STRING) - else() - set(MPI_${LANG}_LIBRARY_VERSION_STRING "NOTFOUND") - endif() - endif() - endif() - - set(MPI_${LANG}_FIND_QUIETLY ${MPI_FIND_QUIETLY}) - set(MPI_${LANG}_FIND_VERSION ${MPI_FIND_VERSION}) - set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) - - unset(MPI_${LANG}_REQUIRED_VARS) - if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") - foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") - endforeach() - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_LIB_NAMES") - if("${LANG}" STREQUAL "Fortran") - # For Fortran we only need one of the module or header directories to have *some* support for MPI. - if(NOT MPI_${LANG}_MODULE_DIR) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_F77_HEADER_DIR") - endif() - if(NOT MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_MODULE_DIR") - endif() - else() - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_HEADER_DIR") - endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(mpiincvar IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpiincvar}_INCLUDE_DIR") - endforeach() - endif() - # Append the works variable now. If the settings did not work, this will show up properly. - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") - else() - # If the compiler worked implicitly, use its path as output. - # Should the compiler variable be set, we also require it to work. - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_COMPILER") - if(MPI_${LANG}_COMPILER) - list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS") - endif() - endif() - find_package_handle_standard_args(MPI_${LANG} REQUIRED_VARS ${MPI_${LANG}_REQUIRED_VARS} - VERSION_VAR MPI_${LANG}_VERSION) - - if(DEFINED MPI_${LANG}_VERSION) - if(NOT _MPI_MIN_VERSION OR _MPI_MIN_VERSION VERSION_GREATER MPI_${LANG}_VERSION) - set(_MPI_MIN_VERSION MPI_${LANG}_VERSION) - endif() - endif() - endif() -endforeach() - -unset(_MPI_REQ_VARS) -foreach(LANG IN ITEMS C CXX Fortran) - if((NOT MPI_FIND_COMPONENTS AND CMAKE_${LANG}_COMPILER_LOADED) OR LANG IN_LIST MPI_FIND_COMPONENTS) - list(APPEND _MPI_REQ_VARS "MPI_${LANG}_FOUND") - endif() -endforeach() - -if(MPICXX IN_LIST MPI_FIND_COMPONENTS) - list(APPEND _MPI_REQ_VARS "MPI_MPICXX_FOUND") -endif() - -find_package_handle_standard_args(MPI - REQUIRED_VARS ${_MPI_REQ_VARS} - VERSION_VAR ${_MPI_MIN_VERSION} - HANDLE_COMPONENTS) - -#============================================================================= -# More backward compatibility stuff - -# For compatibility reasons, we also define MPIEXEC -set(MPIEXEC "${MPIEXEC_EXECUTABLE}") - -# Copy over MPI__INCLUDE_PATH from the assembled INCLUDE_DIRS. -foreach(LANG IN ITEMS C CXX Fortran) - if(MPI_${LANG}_FOUND) - set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}") - unset(MPI_${LANG}_COMPILE_FLAGS) - if(MPI_${LANG}_COMPILE_OPTIONS) - set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}") - endif() - if(MPI_${LANG}_COMPILE_DEFINITIONS) - foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS) - string(APPEND MPI_${LANG}_COMPILE_FLAGS " -D${_MPI_DEF}") - endforeach() - endif() - endif() -endforeach() - -# Bare MPI sans ${LANG} vars are set to CXX then C, depending on what was found. -# This mimics the behavior of the old language-oblivious FindMPI. -set(_MPI_OLD_VARS COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES) -if (MPI_CXX_FOUND) - foreach (var ${_MPI_OLD_VARS}) - set(MPI_${var} ${MPI_CXX_${var}}) - endforeach() -elseif (MPI_C_FOUND) - foreach (var ${_MPI_OLD_VARS}) - set(MPI_${var} ${MPI_C_${var}}) - endforeach() -endif() - -# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache. -if (MPI_LIBRARIES) - list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK) - set(MPI_LIBRARY "${MPI_LIBRARY_WORK}") - unset(MPI_LIBRARY_WORK) -else() - set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND") -endif() - -list(LENGTH MPI_LIBRARIES MPI_NUMLIBS) -if (MPI_NUMLIBS GREATER 1) - set(MPI_EXTRA_LIBRARY_WORK "${MPI_LIBRARIES}") - list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0) - set(MPI_EXTRA_LIBRARY "${MPI_EXTRA_LIBRARY_WORK}") - unset(MPI_EXTRA_LIBRARY_WORK) -else() - set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") -endif() -set(MPI_IGNORE_LEGACY_VARIABLES TRUE) -#============================================================================= - -# unset these vars to cleanup namespace -unset(_MPI_OLD_VARS) -unset(_MPI_PREFIX_PATH) -unset(_MPI_BASE_DIR) -foreach (lang C CXX Fortran) - unset(_MPI_${LANG}_COMPILER_NAMES) -endforeach() - -cmake_policy(POP) diff --git a/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in deleted file mode 100644 index 30f912c62..000000000 --- a/cmake/Modules/NewCMake/FindMPI/fortranparam_mpi.f90.in +++ /dev/null @@ -1,4 +0,0 @@ - program mpi_ver - @MPI_Fortran_INCLUDE_LINE@ - print *, 'INFO:SUBARRAYS[', MPI_SUBARRAYS_SUPPORTED, ']-ASYNCPROT[', MPI_ASYNC_PROTECTS_NONBLOCKING, ']' - end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/libver_mpi.c b/cmake/Modules/NewCMake/FindMPI/libver_mpi.c deleted file mode 100644 index be9d19d43..000000000 --- a/cmake/Modules/NewCMake/FindMPI/libver_mpi.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#ifdef __cplusplus -#include -#else -#include -#endif - -int main(int argc, char* argv[]) -{ - char mpilibver_str[MPI_MAX_LIBRARY_VERSION_STRING]; - int mpilibver_len; - MPI_Get_library_version(mpilibver_str, &mpilibver_len); -#ifdef __cplusplus - std::puts(mpilibver_str); -#else - puts(mpilibver_str); -#endif -} diff --git a/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in deleted file mode 100644 index 793858716..000000000 --- a/cmake/Modules/NewCMake/FindMPI/libver_mpi.f90.in +++ /dev/null @@ -1,7 +0,0 @@ - program mpi_ver - @MPI_Fortran_INCLUDE_LINE@ - character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpilibver_str - integer(kind=MPI_INTEGER_KIND) :: ierror, reslen - call MPI_GET_LIBRARY_VERSION(mpilibver_str, reslen, ierror) - print *, mpilibver_str - end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in b/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in deleted file mode 100644 index a25452385..000000000 --- a/cmake/Modules/NewCMake/FindMPI/mpiver.f90.in +++ /dev/null @@ -1,10 +0,0 @@ - program mpi_ver - @MPI_Fortran_INCLUDE_LINE@ - integer(kind=kind(MPI_VERSION)), parameter :: zero = ichar('0') - character, dimension(17), parameter :: mpiver_str =& - (/ 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', '-', 'V', 'E', 'R', '[', & - char(zero + MPI_VERSION), & - '.', & - char(zero + MPI_SUBVERSION), ']' /) - print *, mpiver_str - end program mpi_ver diff --git a/cmake/Modules/NewCMake/FindMPI/test_mpi.c b/cmake/Modules/NewCMake/FindMPI/test_mpi.c deleted file mode 100644 index b8a308a4b..000000000 --- a/cmake/Modules/NewCMake/FindMPI/test_mpi.c +++ /dev/null @@ -1,37 +0,0 @@ -#include - -#ifdef __cplusplus -#include -#else -#include -#endif - -#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) -const char mpiver_str[] = { 'I', 'N', - 'F', 'O', - ':', 'M', - 'P', 'I', - '-', 'V', - 'E', 'R', - '[', ('0' + MPI_VERSION), - '.', ('0' + MPI_SUBVERSION), - ']', '\0' }; -#endif - -int main(int argc, char* argv[]) -{ -#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) -#ifdef __cplusplus - std::puts(mpiver_str); -#else - puts(mpiver_str); -#endif -#endif -#ifdef TEST_MPI_MPICXX - MPI::MPI_Init(&argc, &argv); - MPI::MPI_Finalize(); -#else - MPI_Init(&argc, &argv); - MPI_Finalize(); -#endif -} diff --git a/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in b/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in deleted file mode 100644 index 4d43a04d6..000000000 --- a/cmake/Modules/NewCMake/FindMPI/test_mpi.f90.in +++ /dev/null @@ -1,6 +0,0 @@ - program hello - @MPI_Fortran_INCLUDE_LINE@ - integer@MPI_Fortran_INTEGER_LINE@ ierror - call MPI_INIT(ierror) - call MPI_FINALIZE(ierror) - end program diff --git a/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake b/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake deleted file mode 100644 index 67f6bd6f2..000000000 --- a/cmake/Modules/NewCMake/FindPackageHandleStandardArgs.cmake +++ /dev/null @@ -1,386 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindPackageHandleStandardArgs ------------------------------ - -This module provides a function intended to be used in :ref:`Find Modules` -implementing :command:`find_package()` calls. It handles the -``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. -It also sets the ``_FOUND`` variable. The package is -considered found if all variables listed contain valid results, e.g. -valid filepaths. - -.. command:: find_package_handle_standard_args - - There are two signatures:: - - find_package_handle_standard_args( - (DEFAULT_MSG|) - ... - ) - - find_package_handle_standard_args( - [FOUND_VAR ] - [REQUIRED_VARS ...] - [VERSION_VAR ] - [HANDLE_COMPONENTS] - [CONFIG_MODE] - [FAIL_MESSAGE ] - ) - - The ``_FOUND`` variable will be set to ``TRUE`` if all - the variables ``...`` are valid and any optional - constraints are satisfied, and ``FALSE`` otherwise. A success or - failure message may be displayed based on the results and on - whether the ``REQUIRED`` and/or ``QUIET`` option was given to - the :command:`find_package` call. - - The options are: - - ``(DEFAULT_MSG|)`` - In the simple signature this specifies the failure message. - Use ``DEFAULT_MSG`` to ask for a default message to be computed - (recommended). Not valid in the full signature. - - ``FOUND_VAR `` - Obsolete. Specifies either ``_FOUND`` or - ``_FOUND`` as the result variable. This exists only - for compatibility with older versions of CMake and is now ignored. - Result variables of both names are always set for compatibility. - - ``REQUIRED_VARS ...`` - Specify the variables which are required for this package. - These may be named in the generated failure message asking the - user to set the missing variable values. Therefore these should - typically be cache entries such as ``FOO_LIBRARY`` and not output - variables like ``FOO_LIBRARIES``. - - ``VERSION_VAR `` - Specify the name of a variable that holds the version of the package - that has been found. This version will be checked against the - (potentially) specified required version given to the - :command:`find_package` call, including its ``EXACT`` option. - The default messages include information about the required - version and the version which has been actually found, both - if the version is ok or not. - - ``HANDLE_COMPONENTS`` - Enable handling of package components. In this case, the command - will report which components have been found and which are missing, - and the ``_FOUND`` variable will be set to ``FALSE`` - if any of the required components (i.e. not the ones listed after - the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are - missing. - - ``CONFIG_MODE`` - Specify that the calling find module is a wrapper around a - call to ``find_package( NO_MODULE)``. This implies - a ``VERSION_VAR`` value of ``_VERSION``. The command - will automatically check whether the package configuration file - was found. - - ``FAIL_MESSAGE `` - Specify a custom failure message instead of using the default - generated message. Not recommended. - -Example for the simple signature: - -.. code-block:: cmake - - find_package_handle_standard_args(LibXml2 DEFAULT_MSG - LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) - -The ``LibXml2`` package is considered to be found if both -``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. -Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found -and ``REQUIRED`` was used, it fails with a -:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was -used or not. If it is found, success will be reported, including -the content of the first ````. On repeated CMake runs, -the same message will not be printed again. - -Example for the full signature: - -.. code-block:: cmake - - find_package_handle_standard_args(LibArchive - REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR - VERSION_VAR LibArchive_VERSION) - -In this case, the ``LibArchive`` package is considered to be found if -both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. -Also the version of ``LibArchive`` will be checked by using the version -contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, -the default messages will be printed. - -Another example for the full signature: - -.. code-block:: cmake - - find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) - find_package_handle_standard_args(Automoc4 CONFIG_MODE) - -In this case, a ``FindAutmoc4.cmake`` module wraps a call to -``find_package(Automoc4 NO_MODULE)`` and adds an additional search -directory for ``automoc4``. Then the call to -``find_package_handle_standard_args`` produces a proper success/failure -message. -#]=======================================================================] - -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) - -# internal helper macro -macro(_FPHSA_FAILURE_MESSAGE _msg) - if (${_NAME}_FIND_REQUIRED) - message(FATAL_ERROR "${_msg}") - else () - if (NOT ${_NAME}_FIND_QUIETLY) - message(STATUS "${_msg}") - endif () - endif () -endmacro() - - -# internal helper macro to generate the failure message when used in CONFIG_MODE: -macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) - # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: - if(${_NAME}_CONFIG) - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") - else() - # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. - # List them all in the error message: - if(${_NAME}_CONSIDERED_CONFIGS) - set(configsText "") - list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) - math(EXPR configsCount "${configsCount} - 1") - foreach(currentConfigIndex RANGE ${configsCount}) - list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) - list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) - string(APPEND configsText " ${filename} (version ${version})\n") - endforeach() - if (${_NAME}_NOT_FOUND_MESSAGE) - string(APPEND configsText " Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") - endif() - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") - - else() - # Simple case: No Config-file was found at all: - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") - endif() - endif() -endmacro() - - -function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) - -# Set up the arguments for `cmake_parse_arguments`. - set(options CONFIG_MODE HANDLE_COMPONENTS) - set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) - set(multiValueArgs REQUIRED_VARS) - -# Check whether we are in 'simple' or 'extended' mode: - set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) - list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) - - if(${INDEX} EQUAL -1) - set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) - set(FPHSA_REQUIRED_VARS ${ARGN}) - set(FPHSA_VERSION_VAR) - else() - cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) - - if(FPHSA_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") - endif() - - if(NOT FPHSA_FAIL_MESSAGE) - set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") - endif() - - # In config-mode, we rely on the variable _CONFIG, which is set by find_package() - # when it successfully found the config-file, including version checking: - if(FPHSA_CONFIG_MODE) - list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) - list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) - set(FPHSA_VERSION_VAR ${_NAME}_VERSION) - endif() - - if(NOT FPHSA_REQUIRED_VARS) - message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") - endif() - endif() - -# now that we collected all arguments, process them - - if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") - set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") - endif() - - list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) - - string(TOUPPER ${_NAME} _NAME_UPPER) - string(TOLOWER ${_NAME} _NAME_LOWER) - - if(FPHSA_FOUND_VAR) - if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") - set(_FOUND_VAR ${FPHSA_FOUND_VAR}) - else() - message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") - endif() - else() - set(_FOUND_VAR ${_NAME_UPPER}_FOUND) - endif() - - # collect all variables which were not found, so they can be printed, so the - # user knows better what went wrong (#6375) - set(MISSING_VARS "") - set(DETAILS "") - # check if all passed variables are valid - set(FPHSA_FOUND_${_NAME} TRUE) - foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) - if(NOT ${_CURRENT_VAR}) - set(FPHSA_FOUND_${_NAME} FALSE) - string(APPEND MISSING_VARS " ${_CURRENT_VAR}") - else() - string(APPEND DETAILS "[${${_CURRENT_VAR}}]") - endif() - endforeach() - if(FPHSA_FOUND_${_NAME}) - set(${_NAME}_FOUND TRUE) - set(${_NAME_UPPER}_FOUND TRUE) - else() - set(${_NAME}_FOUND FALSE) - set(${_NAME_UPPER}_FOUND FALSE) - endif() - - # component handling - unset(FOUND_COMPONENTS_MSG) - unset(MISSING_COMPONENTS_MSG) - - if(FPHSA_HANDLE_COMPONENTS) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(${_NAME}_${comp}_FOUND) - - if(NOT DEFINED FOUND_COMPONENTS_MSG) - set(FOUND_COMPONENTS_MSG "found components: ") - endif() - string(APPEND FOUND_COMPONENTS_MSG " ${comp}") - - else() - - if(NOT DEFINED MISSING_COMPONENTS_MSG) - set(MISSING_COMPONENTS_MSG "missing components: ") - endif() - string(APPEND MISSING_COMPONENTS_MSG " ${comp}") - - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - string(APPEND MISSING_VARS " ${comp}") - endif() - - endif() - endforeach() - set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") - string(APPEND DETAILS "[c${COMPONENT_MSG}]") - endif() - - # version handling: - set(VERSION_MSG "") - set(VERSION_OK TRUE) - - # check with DEFINED here as the requested or found version may be "0" - if (DEFINED ${_NAME}_FIND_VERSION) - if(DEFINED ${FPHSA_VERSION_VAR}) - set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}}) - - if(${_NAME}_FIND_VERSION_EXACT) # exact version required - # count the dots in the version string - string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}") - # add one dot because there is one dot more than there are components - string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) - if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) - # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT - # is at most 4 here. Therefore a simple lookup table is used. - if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) - set(_VERSION_REGEX "[^.]*") - elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) - set(_VERSION_REGEX "[^.]*\\.[^.]*") - elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) - set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") - else () - set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") - endif () - string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}") - unset(_VERSION_REGEX) - if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) - set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) - else () - set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") - endif () - unset(_VERSION_HEAD) - else () - if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION) - set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) - else () - set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") - endif () - endif () - unset(_VERSION_DOTS) - - else() # minimum version specified: - if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION) - set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) - else () - set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") - endif () - endif() - - else() - - # if the package was not found, but a version was given, add that to the output: - if(${_NAME}_FIND_VERSION_EXACT) - set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") - else() - set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") - endif() - - endif() - else () - # Check with DEFINED as the found version may be 0. - if(DEFINED ${FPHSA_VERSION_VAR}) - set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")") - endif() - endif () - - if(VERSION_OK) - string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]") - else() - set(${_NAME}_FOUND FALSE) - endif() - - - # print the result: - if (${_NAME}_FOUND) - FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") - else () - - if(FPHSA_CONFIG_MODE) - _FPHSA_HANDLE_FAILURE_CONFIG_MODE() - else() - if(NOT VERSION_OK) - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") - else() - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}") - endif() - endif() - - endif () - - set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) - set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) -endfunction() diff --git a/cmake/Modules/NewCMake/FindPackageMessage.cmake b/cmake/Modules/NewCMake/FindPackageMessage.cmake deleted file mode 100644 index 6821cee4f..000000000 --- a/cmake/Modules/NewCMake/FindPackageMessage.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindPackageMessage -# ------------------ -# -# -# -# FIND_PACKAGE_MESSAGE( "message for user" "find result details") -# -# This macro is intended to be used in FindXXX.cmake modules files. It -# will print a message once for each unique find result. This is useful -# for telling the user where a package was found. The first argument -# specifies the name (XXX) of the package. The second argument -# specifies the message to display. The third argument lists details -# about the find result so that if they change the message will be -# displayed again. The macro also obeys the QUIET argument to the -# find_package command. -# -# Example: -# -# :: -# -# if(X11_FOUND) -# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" -# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") -# else() -# ... -# endif() - -function(FIND_PACKAGE_MESSAGE pkg msg details) - # Avoid printing a message repeatedly for the same find result. - if(NOT ${pkg}_FIND_QUIETLY) - string(REPLACE "\n" "" details "${details}") - set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) - if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") - # The message has not yet been printed. - message(STATUS "${msg}") - - # Save the find details in the cache to avoid printing the same - # message again. - set("${DETAILS_VAR}" "${details}" - CACHE INTERNAL "Details about finding ${pkg}") - endif() - endif() -endfunction() diff --git a/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake b/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake deleted file mode 100644 index dce6f9926..000000000 --- a/cmake/Modules/NewCMake/SelectLibraryConfigurations.cmake +++ /dev/null @@ -1,70 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# SelectLibraryConfigurations -# --------------------------- -# -# -# -# select_library_configurations( basename ) -# -# This macro takes a library base name as an argument, and will choose -# good values for basename_LIBRARY, basename_LIBRARIES, -# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what -# has been found and set. If only basename_LIBRARY_RELEASE is defined, -# basename_LIBRARY will be set to the release value, and -# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND. -# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will -# take the debug value, and basename_LIBRARY_RELEASE will be set to -# basename_LIBRARY_RELEASE-NOTFOUND. -# -# If the generator supports configuration types, then basename_LIBRARY -# and basename_LIBRARIES will be set with debug and optimized flags -# specifying the library to be used for the given configuration. If no -# build type has been set or the generator in use does not support -# configuration types, then basename_LIBRARY and basename_LIBRARIES will -# take only the release value, or the debug value if the release one is -# not set. - -# This macro was adapted from the FindQt4 CMake module and is maintained by Will -# Dicharry . - -macro( select_library_configurations basename ) - if(NOT ${basename}_LIBRARY_RELEASE) - set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.") - endif() - if(NOT ${basename}_LIBRARY_DEBUG) - set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.") - endif() - - if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND - NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND - ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) ) - # if the generator supports configuration types or CMAKE_BUILD_TYPE - # is set, then set optimized and debug options. - set( ${basename}_LIBRARY "" ) - foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) - list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) - endforeach() - foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG ) - list( APPEND ${basename}_LIBRARY debug "${_libname}" ) - endforeach() - elseif( ${basename}_LIBRARY_RELEASE ) - set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) - elseif( ${basename}_LIBRARY_DEBUG ) - set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} ) - else() - set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND") - endif() - - set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" ) - - if( ${basename}_LIBRARY ) - set( ${basename}_FOUND TRUE ) - endif() - - mark_as_advanced( ${basename}_LIBRARY_RELEASE - ${basename}_LIBRARY_DEBUG - ) -endmacro() diff --git a/cmake/Modules/Testing/Temporary/CTestCostData.txt b/cmake/Modules/Testing/Temporary/CTestCostData.txt deleted file mode 100644 index ed97d539c..000000000 --- a/cmake/Modules/Testing/Temporary/CTestCostData.txt +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/cmake/Modules/Testing/Temporary/LastTest.log b/cmake/Modules/Testing/Temporary/LastTest.log deleted file mode 100644 index 811fffbb0..000000000 --- a/cmake/Modules/Testing/Temporary/LastTest.log +++ /dev/null @@ -1,3 +0,0 @@ -Start testing: Apr 08 18:46 UTC ----------------------------------------------------------- -End testing: Apr 08 18:46 UTC diff --git a/cmake/Modules/comp_src.pl b/cmake/Modules/comp_src.pl deleted file mode 100755 index 510be2504..000000000 --- a/cmake/Modules/comp_src.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl - - @list = @ARGV; - foreach(@list) { - $file = $_; - $compfile = "../../../P2/cmake/Modules/".$file; - $diffs = `diff $file $compfile`; - if($diffs != '') { - print "------------------------------------\n"; - print "$file\n"; - print "$diffs\n"; - print "------------------------------------\n"; - } - } - diff --git a/cmake/Modules/findHelpers.cmake b/cmake/Modules/findHelpers.cmake deleted file mode 100644 index 436554c91..000000000 --- a/cmake/Modules/findHelpers.cmake +++ /dev/null @@ -1,65 +0,0 @@ - -function (findSrc varName version varDir ) - if(EXISTS ${CMAKE_SOURCE_DIR}/libsrc/${varName}) - message("setting source for ${varName} to be in libsrc") - set( ${varDir} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" PARENT_SCOPE) - set( ${varCacheName} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" CACHE STRING "" FORCE ) - else() - message("ProdGSI/libsrc directory not pulled from repo. Either clone with recursive or specify location of library sources") - endif() -endfunction() - -function (findInc incName version incFile ) - cmake_policy(SET CMP0011 NEW) - cmake_policy(SET CMP0009 NEW) - STRING(COMPARE EQUAL ${incFile} "CRTMINC" USECRTMBASE ) - if(( USECRTMBASE ) AND ( CRTM_BASE )) - execute_process(COMMAND find ${CRTM_BASE} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - else() - if(crayComp) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/intel -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - else() - execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/cray -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - endif() - else() - execute_process(COMMAND find ${COREPATH}/${incName} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - endif() - if( NOT (INCFILES) ) - execute_process(COMMAND find ${COREPATH}/sorc -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - endif() - endif() - if( INCFILES ) - string(REGEX REPLACE "\n" ";" INCFILES ${INCFILES} ) - endif() - foreach( INC_FILE in ${INCFILES} ) - message("found ${INC_FILE}") - string(REGEX REPLACE "${incName}_module.mod" "" INCPATH ${INC_FILE} ) - set( ${incFile} ${INCPATH} PARENT_SCOPE ) - return() - endforeach() - file(GLOB_RECURSE INCFILES ${COREPATH}/${incName}_module.mod ) - list(LENGTH INCFILES numFiles) - if(numFiles EQUAL 1) - get_filename_component( INCPATH ${INCFILES} DIRECTORY ) - else() - foreach( INC_FILE in ${INCFILES} ) - get_filename_component( INCPATH ${INC_FILE} DIRECTORY ) - endforeach() - endif() - set( ${incFile} ${INCPATH} PARENT_SCOPE ) -endfunction() - -function (findOtherVersion rootPath srcName srcPath newVer ) - file(GLOB SRCDIRS ${${rootPath}}/${srcName}* ) - foreach( SRC_DIR in ${SRCDIRS} ) - string(REGEX MATCH ${srcName} MATCHFOUND ${SRC_DIR} ) - if( MATCHFOUND ) - set( ${srcPath} ${SRC_DIR} PARENT_SCOPE ) - string(REGEX MATCH "[0-9].[0-9].[0-9]" ALTVER ${SRC_DIR} ) - message("Found ${ALTVER} of ${srcName}. Proceeding with Alternative") - set( ${newVer} ${ALTVER} PARENT_SCOPE ) - return() - endif() - endforeach() -endfunction() diff --git a/cmake/Modules/findHelpers.cmake.orig b/cmake/Modules/findHelpers.cmake.orig deleted file mode 100644 index 2ea182c9d..000000000 --- a/cmake/Modules/findHelpers.cmake.orig +++ /dev/null @@ -1,69 +0,0 @@ -function (findSrc varName version varDir ) - if(EXISTS ${CMAKE_SOURCE_DIR}/libsrc/${varName}) - message("setting source for ${varName} to be in libsrc") - set( ${varDir} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" PARENT_SCOPE) - set( ${varCacheName} "${CMAKE_SOURCE_DIR}/libsrc/${varName}" CACHE STRING "" FORCE ) - else() - message("ProdGSI/libsrc directory not pulled from repo. Either clone with recursive or specify location of library sources") - endif() -endfunction() - -function (findInc incName version incFile ) - cmake_policy(SET CMP0011 NEW) - cmake_policy(SET CMP0009 NEW) - STRING(COMPARE EQUAL ${incFile} "CRTMINC" USECRTMBASE ) - if(( USECRTMBASE ) AND ( CRTM_BASE )) - execute_process(COMMAND find ${CRTM_BASE} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - else() - if(crayComp) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/intel -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - else() - execute_process(COMMAND find ${COREPATH}/${incName}/v${${version}}/cray -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - endif() - else() - execute_process(COMMAND find ${COREPATH}/${incName} -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - endif() - if( NOT (INCFILES) ) - execute_process(COMMAND find ${COREPATH}/sorc -iname ${incName}_module.mod RESULT_VARIABLE res OUTPUT_VARIABLE INCFILES) - endif() - endif() - if( INCFILES ) - string(REGEX REPLACE "\n" ";" INCFILES ${INCFILES} ) - endif() - foreach( INC_FILE in ${INCFILES} ) -<<<<<<< HEAD - string(REGEX MATCH ${${version}} MATCHFOUND ${INC_FILE} ) - if( MATCHFOUND ) -======= ->>>>>>> debug-fix - message("found ${INC_FILE}") - string(REGEX REPLACE "${incName}_module.mod" "" INCPATH ${INC_FILE} ) - set( ${incFile} ${INCPATH} PARENT_SCOPE ) - return() - endforeach() - file(GLOB_RECURSE INCFILES ${COREPATH}/${incName}_module.mod ) - list(LENGTH INCFILES numFiles) - if(numFiles EQUAL 1) - get_filename_component( INCPATH ${INCFILES} DIRECTORY ) - else() - foreach( INC_FILE in ${INCFILES} ) - get_filename_component( INCPATH ${INC_FILE} DIRECTORY ) - endforeach() - endif() - set( ${incFile} ${INCPATH} PARENT_SCOPE ) -endfunction() - -function (findOtherVersion rootPath srcName srcPath newVer ) - file(GLOB SRCDIRS ${${rootPath}}/${srcName}* ) - foreach( SRC_DIR in ${SRCDIRS} ) - string(REGEX MATCH ${srcName} MATCHFOUND ${SRC_DIR} ) - if( MATCHFOUND ) - set( ${srcPath} ${SRC_DIR} PARENT_SCOPE ) - string(REGEX MATCH "[0-9].[0-9].[0-9]" ALTVER ${SRC_DIR} ) - message("Found ${ALTVER} of ${srcName}. Proceeding with Alternative") - set( ${newVer} ${ALTVER} PARENT_SCOPE ) - return() - endif() - endforeach() -endfunction() diff --git a/cmake/Modules/platforms/Cheyenne.cmake b/cmake/Modules/platforms/Cheyenne.cmake deleted file mode 100644 index 764a2bffa..000000000 --- a/cmake/Modules/platforms/Cheyenne.cmake +++ /dev/null @@ -1,24 +0,0 @@ -macro (setCheyenne) - message("Setting paths for Cheyenne") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - - set(BUILD_CORELIBS "ON" ) - set(BUILD_UTIL "OFF" CACHE INTERNAL "" ) - set(BUILD_BUFR "ON" CACHE INTERNAL "") - set(BUILD_SFCIO "ON" CACHE INTERNAL "") - set(BUILD_SIGIO "ON" CACHE INTERNAL "") - set(BUILD_W3EMC "ON" CACHE INTERNAL "") - set(BUILD_W3NCO "ON" CACHE INTERNAL "") - set(BUILD_BACIO "ON" CACHE INTERNAL "") - set(BUILD_CRTM "ON" CACHE INTERNAL "") - set(BUILD_SP "ON" CACHE INTERNAL "") - set(BUILD_NEMSIO "ON" CACHE INTERNAL "") - set(ENV{MPI_HOME} $ENV{MPI_ROOT} ) -endmacro() - diff --git a/cmake/Modules/platforms/Discover.cmake b/cmake/Modules/platforms/Discover.cmake deleted file mode 100644 index 83bcd3742..000000000 --- a/cmake/Modules/platforms/Discover.cmake +++ /dev/null @@ -1,21 +0,0 @@ -macro (setDiscover) - message("Setting paths for Discover") - option(BUILD_CORELIBS "Build core libs from source" ON) - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) - option(HDF5_USE_STATIC_LIBRARIES "Use only static libraries for HDF5" OFF) - set(BUILD_NCDIAG_SERIAL FALSE) - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - set(host "Discover" CACHE INTERNAL "") - - if( ENV{BASEDIR} ) - set(BASEDIR $ENV{BASEDIR}/Linux CACHE INTERNAL "") - endif() - - set(ENV{MPI_HOME} $ENV{MPI_ROOT} ) - -endmacro() - diff --git a/cmake/Modules/platforms/Gaea.cmake b/cmake/Modules/platforms/Gaea.cmake deleted file mode 100644 index d897400e6..000000000 --- a/cmake/Modules/platforms/Gaea.cmake +++ /dev/null @@ -1,14 +0,0 @@ -macro (setGaea) - - message("Setting flags and paths for Cray") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) - set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "HDF5_Static" ) - - set(HOST_FLAG "-xCORE-AVX2" CACHE INTERNAL "Host Flag") # for Haswell (C4) - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag" ) - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ -traceback ${HOST_FLAG} ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "") - set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ -traceback ${HOST_FLAG} ${MKL_FLAG} ${MPI3FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "") - set(GSI_LDFLAGS "${MKL_FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") - set(BUILD_CORELIBS "OFF" ) -endmacro() diff --git a/cmake/Modules/platforms/Generic.cmake b/cmake/Modules/platforms/Generic.cmake deleted file mode 100644 index 8945f43c3..000000000 --- a/cmake/Modules/platforms/Generic.cmake +++ /dev/null @@ -1,16 +0,0 @@ -macro (setGeneric) - message("Setting paths for Generic System") - option(BUILD_CORELIBS "Build core libs from source" ON) - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - if(EXISTS /jetmon) - set(HOST_FLAG "-axSSE4.2,AVX,CORE-AVX2" CACHE INTERNAL "Host Flag") - else() - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - endif() - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "${HOST_FLAG} -DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - option(HDF5_USE_STATIC_LIBRARIES "Use only static libraries for HDF5" OFF) - -endmacro() diff --git a/cmake/Modules/platforms/Generic.cmake.orig b/cmake/Modules/platforms/Generic.cmake.orig deleted file mode 100644 index 1adc85d4f..000000000 --- a/cmake/Modules/platforms/Generic.cmake.orig +++ /dev/null @@ -1,25 +0,0 @@ -macro (setGeneric) - message("Setting paths for Generic System") -<<<<<<< HEAD -# option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) -# option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - option(BUILD_CORELIBS "Build core libs from source" ON) - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") -======= - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - if(EXISTS /jetmon) - set(HOST_FLAG "-axSSE4.2,AVX,CORE-AVX2" CACHE INTERNAL "Host Flag") - else() - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - endif() ->>>>>>> origin/master - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "${HOST_FLAG} -DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") -<<<<<<< HEAD - option(HDF5_USE_STATIC_LIBRARIES "Use only static libraries for HDF5" OFF) -======= ->>>>>>> origin/master - -endmacro() diff --git a/cmake/Modules/platforms/Jet.cmake b/cmake/Modules/platforms/Jet.cmake deleted file mode 100644 index 8c19dd06f..000000000 --- a/cmake/Modules/platforms/Jet.cmake +++ /dev/null @@ -1,10 +0,0 @@ -macro (setJet) - message("Setting paths for Jet") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HOST_FLAG "-axSSE4.2,AVX,CORE-AVX2" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "${HOST_FLAG} -DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") -endmacro() - diff --git a/cmake/Modules/platforms/S4.cmake b/cmake/Modules/platforms/S4.cmake deleted file mode 100644 index 1eecb29fa..000000000 --- a/cmake/Modules/platforms/S4.cmake +++ /dev/null @@ -1,10 +0,0 @@ -macro (setS4) - message("Setting paths for S4") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} ${HOST_FLAG}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - set(HDF5_USE_STATIC_LIBRARIES "OFF") -endmacro() diff --git a/cmake/Modules/platforms/Theia.cmake b/cmake/Modules/platforms/Theia.cmake deleted file mode 100644 index 58ac83260..000000000 --- a/cmake/Modules/platforms/Theia.cmake +++ /dev/null @@ -1,55 +0,0 @@ -macro (setTHEIA) - message("Setting paths for THEIA") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "GSI Fortran Flags") - set(ENKF_Platform_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "ENKF Fortran Flags") - set(HDF5_USE_STATIC_LIBRARIES "OFF") - if( NOT DEFINED ENV{COREPATH} ) - set(COREPATH "/scratch3/NCEPDEV/nwprod/lib" ) - else() - set(COREPATH $ENV{COREPATH} ) - endif() - if( NOT DEFINED ENV{CRTM_INC} ) - set(CRTM_BASE "/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod/lib/crtm" ) - endif() - if( NOT DEFINED ENV{WRFPATH} ) - set(WRFPATH "/scratch3/NCEPDEV/nceplibs/ext/WRF/3.7/WRFV3" ) - else() - set(WRFPATH $ENV{WRFPATH} ) - endif() - - if( NOT DEFINED ENV{NETCDF_VER} ) - set(NETCDF_VER "3.6.3" ) - endif() - if( NOT DEFINED ENV{BACIO_VER} ) - set(BACIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{BUFR_VER} ) - set(BUFR_VER "10.2.5" ) - endif() - if( NOT DEFINED ENV{CRTM_VER} ) - set(CRTM_VER "2.2.3" ) - endif() - if( NOT DEFINED ENV{NEMSIO_VER} ) - set(NEMSIO_VER "2.2.1" ) - endif() - if( NOT DEFINED ENV{SFCIO_VER} ) - set(SFCIO_VER "1.0.0" ) - endif() - if( NOT DEFINED ENV{SIGIO_VER} ) - set(SIGIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{SP_VER} ) - set(SP_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{W3EMC_VER} ) - set(W3EMC_VER "2.0.5" ) - endif() - if( NOT DEFINED ENV{W3NCO_VER} ) - set(W3NCO_VER "2.0.6" ) - endif() -endmacro() - diff --git a/cmake/Modules/platforms/WCOSS-C.cmake b/cmake/Modules/platforms/WCOSS-C.cmake deleted file mode 100644 index 1c9cf712c..000000000 --- a/cmake/Modules/platforms/WCOSS-C.cmake +++ /dev/null @@ -1,60 +0,0 @@ -macro (setWCOSS_C) - - message("Setting flags and paths for Cray") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" ON) - set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "HDF5_Static" ) - - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "" CACHE INTERNAL "MKL flag" ) - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "") - set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "") - set(GSI_LDFLAGS "${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") - if( NOT DEFINED ENV{COREPATH} ) - set(COREPATH "/gpfs/hps/nco/ops/nwprod/lib" ) - else() - set(COREPATH $ENV{COREPATH} ) - endif() - if( NOT DEFINED ENV{CRTM_INC} ) - set(CRTM_BASE "/gpfs/hps/nco/ops/nwprod/lib/crtm" ) - endif() - if( NOT DEFINED ENV{WRFPATH} ) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(WRFPATH "/gpfs/hps/nco/ops/nwprod/wrf_shared.v1.1.0-intel" ) - else() - set(WRFPATH "/gpfs/hps/nco/ops/nwprod/wrf_shared.v1.1.0-cray" ) - endif() - else() - set(WRFPATH $ENV{WRFPATH} ) - endif() - if( NOT DEFINED ENV{NETCDF_VER} ) - set(NETCDF_VER "3.6.3" ) - endif() - if( NOT DEFINED ENV{BACIO_VER} ) - set(BACIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{BUFR_VER} ) - set(BUFR_VER "11.0.1" ) - endif() - if( NOT DEFINED ENV{CRTM_VER} ) - set(CRTM_VER "2.2.3" ) - endif() - if( NOT DEFINED ENV{NEMSIO_VER} ) - set(NEMSIO_VER "2.2.2" ) - endif() - if( NOT DEFINED ENV{SFCIO_VER} ) - set(SFCIO_VER "1.0.0" ) - endif() - if( NOT DEFINED ENV{SIGIO_VER} ) - set(SIGIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{SP_VER} ) - set(SP_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{W3EMC_VER} ) - set(W3EMC_VER "2.2.0" ) - endif() - if( NOT DEFINED ENV{W3NCO_VER} ) - set(W3NCO_VER "2.0.6" ) - endif() -endmacro() diff --git a/cmake/Modules/platforms/WCOSS-D.cmake b/cmake/Modules/platforms/WCOSS-D.cmake deleted file mode 100644 index a0858d2b7..000000000 --- a/cmake/Modules/platforms/WCOSS-D.cmake +++ /dev/null @@ -1,21 +0,0 @@ -macro (setWCOSS_D) - message("Setting paths for Dell") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} -O3" CACHE INTERNAL "GSI Fortran Flags") - set(GSI_LDFLAGS "${OpenMP_Fortran_FLAGS} ${MKL_FLAG}" CACHE INTERNAL "") - set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "ENKF Fortran Flags") - - set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "" ) - if( NOT DEFINED ENV{COREPATH} ) - set(COREPATH "/gpfs/dell1/nco/ops/nwprod/lib" ) - else() - set(COREPATH $ENV{COREPATH} ) - endif() - if( NOT DEFINED ENV{CRTM_INC} ) - set(CRTM_BASE "/gpfs/dell1/nco/ops/nwprod/lib/crtm" ) - endif() -endmacro() diff --git a/cmake/Modules/platforms/WCOSS.cmake b/cmake/Modules/platforms/WCOSS.cmake deleted file mode 100644 index 81b129739..000000000 --- a/cmake/Modules/platforms/WCOSS.cmake +++ /dev/null @@ -1,61 +0,0 @@ -macro (setWCOSS) - message("Setting paths for WCOSS") - option(FIND_HDF5 "Try to Find HDF5 libraries" OFF) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) - set(HDF5_USE_STATIC_LIBRARIES "OFF") - - #if ibmpe module is not loaded last, CMake tries to use intel mpi. Force use of ibmhpc - set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") - set( MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") - set(GSI_Intel_Platform_FLAGS "-DPOUND_FOR_STRINGIFY -traceback -O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") - set(ENKF_Platform_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${HOST_FLAG} " CACHE INTERNAL "") - - set(MPI_Fortran_COMPILER /opt/ibmhpc/pe13010/base/bin/mpif90 CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) - set(MPI_C_COMPILER /opt/ibmhpc/pe13010/base/bin/mpicc CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) - set(MPI_CXX_COMPILER /opt/ibmhpc/pe13010/base/bin/mpicxx CACHE FILEPATH "Forced use of ibm wrapper" FORCE ) - - if( NOT DEFINED ENV{COREPATH} ) - set(COREPATH "/nwprod/lib" ) - else() - set(COREPATH $ENV{COREPATH} ) - endif() - if( NOT DEFINED ENV{CRTM_INC} ) - set(CRTM_BASE "/nwprod2/lib" ) - endif() - if( NOT DEFINED ENV{WRFPATH} ) - set(WRFPATH "/nwprod/sorc/wrf_shared.fd" ) - else() - set(WRFPATH $ENV{WRFPATH} ) - endif() - if( NOT DEFINED ENV{NETCDF_VER} ) - set(NETCDF_VER "3.6.3" ) - endif() - if( NOT DEFINED ENV{BACIO_VER} ) - set(BACIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{BUFR_VER} ) - set(BUFR_VER "10.2.5" ) - endif() - if( NOT DEFINED ENV{CRTM_VER} ) - set(CRTM_VER "2.2.3" ) - endif() - if( NOT DEFINED ENV{NEMSIO_VER} ) - set(NEMSIO_VER "2.2.1" ) - endif() - if( NOT DEFINED ENV{SFCIO_VER} ) - set(SFCIO_VER "1.0.0" ) - endif() - if( NOT DEFINED ENV{SIGIO_VER} ) - set(SIGIO_VER "2.0.1" ) - endif() - if( NOT DEFINED ENV{SP_VER} ) - set(SP_VER "2.0.2" ) - endif() - if( NOT DEFINED ENV{W3EMC_VER} ) - set(W3EMC_VER "2.0.5" ) - endif() - if( NOT DEFINED ENV{W3NCO_VER} ) - set(W3NCO_VER "2.0.6" ) - endif() - -endmacro() diff --git a/cmake/Modules/setCompilerFlags.cmake.orig b/cmake/Modules/setCompilerFlags.cmake.orig deleted file mode 100644 index 09c2b0a6d..000000000 --- a/cmake/Modules/setCompilerFlags.cmake.orig +++ /dev/null @@ -1,167 +0,0 @@ -function (setIntel) - string(REPLACE "." ";" COMPILER_VERSION_LIST ${CMAKE_C_COMPILER_VERSION}) - list(GET COMPILER_VERSION_LIST 0 MAJOR_VERSION) - list(GET COMPILER_VERSION_LIST 1 MINOR_VERSION) - list(GET COMPILER_VERSION_LIST 2 PATCH_VERSION) - set(COMPILER_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" CACHE INTERNAL "Compiler Version") - message("Compiler version is ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") - message("Compiler version is ${COMPILER_VERSION}") - if(${MAJOR_VERSION} GREATER 15 ) - set( OMPFLAG "-qopenmp" CACHE INTERNAL "OpenMP flag") - else() - set( OMPFLAG "-openmp" CACHE INTERNAL "OpenMP flag") - endif() - if(( HOST-Tide ) OR ( HOST-Gyre )) - set( MPI3FLAG "" CACHE INTERNAL "" ) - else() - set( MPI3FLAG "-DMPI3" CACHE INTERNAL "" ) - endif() - STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) - STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) - set( MKL_FLAG "-mkl" ) - set(EXTRA_LINKER_FLAGS ${MKL_FLAG} PARENT_SCOPE) - if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) - if(( HOST-Tide ) OR ( HOST-Gyre )) - set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -traceback -O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) - set(ENKF_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) - set(UTIL_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DWRF -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) - set (BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp " PARENT_SCOPE ) - set (BUFR_Fortran_FLAGS "-O2 -r8 -fp-model strict -traceback -xSSE2 -O3 -axCORE-AVX2 ${OMPFLAG} " PARENT_SCOPE ) - set (BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -O3 -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) - elseif( HOST-Luna OR HOST-Surge ) - set( MKL_FLAG "" ) - set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS} -O3" PARENT_SCOPE) -<<<<<<< HEAD - set(GSI_LDFLAGS "${OMPFLAG}" PARENT_SCOPE) - - set(ENKF_Fortran_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${MPI3FLAG} ${OMPFLAG} " PARENT_SCOPE) -======= - set(GSI_LDFLAGS "-liomp5" PARENT_SCOPE) - - set(ENKF_Fortran_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OMPFLAG} " PARENT_SCOPE) ->>>>>>> master - set(UTIL_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone -DWRF -D_REAL8_ ${OMPFLAG} " PARENT_SCOPE) - set (BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp " PARENT_SCOPE ) - set (BUFR_Fortran_FLAGS " -c -g -traceback -O3 -axCORE-AVX2 -r8 " PARENT_SCOPE ) - set (BUFR_C_FLAGS "-DSTATIC_ALLOCATION -DUNDERSCORE -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) - elseif ( HOST-Venus OR HOST-Mars ) - set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -fp-model strict -assume byterecl -convert big_endian -implicitnone -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS} -O3" PARENT_SCOPE) - set(GSI_LDFLAGS "${OMPFLAG} ${MKL_FLAG}" PARENT_SCOPE) - - set(ENKF_Fortran_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OMPFLAG} " PARENT_SCOPE) - set(UTIL_Fortran_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DWRF -D_REAL8_ ${OMPFLAG} " PARENT_SCOPE) - set (BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp " PARENT_SCOPE ) - set (BUFR_Fortran_FLAGS " -c -g -traceback -O3 -axCORE-AVX2 -r8 " PARENT_SCOPE ) - set (BUFR_C_FLAGS "-DSTATIC_ALLOCATION -DUNDERSCORE -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) - else() - set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) - set(ENKF_Fortran_FLAGS "-O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DGFS -D_REAL8_ ${MPI3FLAG} ${OMPFLAG}" PARENT_SCOPE) - set(UTIL_Fortran_FLAGS "-O3 -xHOST -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DWRF -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) - set (BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp " PARENT_SCOPE ) - set (BUFR_Fortran_FLAGS "-O2 -r8 -fp-model strict -traceback -xSSE2 -O3 -axCORE-AVX2 ${OMPFLAG} " PARENT_SCOPE ) - set (BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -O3 -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) - endif() - - #Common release/production flags - set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) - set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" PARENT_SCOPE ) - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" PARENT_SCOPE ) - set (BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " PARENT_SCOPE ) - set (CRTM_Fortran_FLAGS " -O3 -convert big_endian -free -assume byterecl -fp-model source -traceback " PARENT_SCOPE ) - set (NEMSIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) - set (SFCIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) - set (SIGIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) - set (SP_Fortran_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OMPFLAG} " PARENT_SCOPE ) - set (SP_F77_FLAGS " -DLINUX -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OMPFLAG} " PARENT_SCOPE ) - set (W3EMC_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OMPFLAG} " PARENT_SCOPE ) - set (W3NCO_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OMPFLAG} " PARENT_SCOPE ) - set (W3NCO_C_FLAGS "-O0 -DUNDERSCORE -DLINUX -D__linux__ " PARENT_SCOPE ) - set (NDATE_Fortran_FLAGS "-fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" PARENT_SCOPE ) - set( NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" PARENT_SCOPE ) - else( ) #DEBUG flags - message("Building DEBUG version of GSI") - set( debug_suffix "_DBG" PARENT_SCOPE ) - if(( HOST-Tide ) OR ( HOST-Gyre )) - set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -mcmodel medium -shared-intel -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -convert big_endian -implicitnone -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) - set(ENKF_Fortran_FLAGS "-g -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -warn all -traceback -debug all -check all,noarg_temp_created -implicitnone -DGFS -D_REAL8_ ${MPI3FLAG} ${OMPFLAG}" PARENT_SCOPE) - set(UTIL_Fortran_FLAGS "-g -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -warn all -traceback -debug all -check all,noarg_temp_created -implicitnone -DWRF -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) - set (BACIO_Fortran_FLAGS "-g -free -assume nocc_omp " PARENT_SCOPE ) - else() - set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model strict -convert big_endian -assume byterecl -implicitnone -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -D_REAL8_ ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) - set(ENKF_Fortran_FLAGS "-O0 -xHOST -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian -D_REAL8_ ${MPI3FLAG} ${OMPFLAG}" PARENT_SCOPE) - set(UTIL_Fortran_FLAGS "-O0 -xHOST -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian -D_REAL8_ ${OMPFLAG}" PARENT_SCOPE) - set (BACIO_Fortran_FLAGS "-g -free -assume nocc_omp " PARENT_SCOPE ) - endif() - #Common debug flags - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" PARENT_SCOPE ) - set (BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " PARENT_SCOPE ) - set (BUFR_Fortran_FLAGS "-g -r8 -fp-model strict -traceback -xSSE2 -axCORE-AVX2 ${OMPFLAG} " PARENT_SCOPE ) - set (BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) - set (CRTM_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${OMPFLAG} " PARENT_SCOPE ) -# set(CRTM_Fortran_FLAGS "-O0 -fp-model strict -free -convert big_endian -assume byterecl -implicitnone -mcmodel medium -shared-intel -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces ${OMPFLAG} ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) - set (SFCIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) - set (SIGIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) - set (SP_Fortran_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -i${intsize} -r8 -convert big_endian -DLINUX ${OMPFLAG} " PARENT_SCOPE ) - set (SP_F77_FLAGS " -g -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -DLINUX ${OMPFLAG} " PARENT_SCOPE ) - set (W3EMC_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OMPFLAG} " PARENT_SCOPE ) - set (NEMSIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xSSE2 -fp-model strict -traceback -g ${MKL_FLAG} ${OMPFLAG} " PARENT_SCOPE ) - set (W3NCO_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OMPFLAG} " PARENT_SCOPE ) - set (W3NCO_C_FLAGS "-O0 -g -DUNDERSCORE -DLINUX -D__linux__ " PARENT_SCOPE ) - set (NDATE_Fortran_FLAGS "-fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" PARENT_SCOPE) - set( NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" PARENT_SCOPE ) - set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O1 -g -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" PARENT_SCOPE) - set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" PARENT_SCOPE ) - endif() -endfunction() - -function (setGNU) - message("Setting GNU Compiler Flags") - set(GSI_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" PARENT_SCOPE) - set(EXTRA_LINKER_FLAGS "-lgomp" PARENT_SCOPE) - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" PARENT_SCOPE ) - set(ENKF_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" PARENT_SCOPE) - set(UTIL_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" PARENT_SCOPE) - set(BUFR_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) - set(BUFR_Fortran_PP_FLAGS " -P " PARENT_SCOPE) - set(BUFR_C_FLAGS " -O3 -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) - set(BACIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) - set(CRTM_Fortran_FLAGS " -g -std=f2003 -fdollar-ok -O3 -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " PARENT_SCOPE) - set(NEMSIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) - set(SIGIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) - set(SFCIO_Fortran_FLAGS " -O3 -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) - set(SP_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -DLINUX" PARENT_SCOPE) - set(SP_F77_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -DLINUX" PARENT_SCOPE) - set(W3EMC_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) - set(W3NCO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ " PARENT_SCOPE) - set(W3NCO_C_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" PARENT_SCOPE) - set(WRFLIB_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" PARENT_SCOPE) - set( NCDIAG_Fortran_FLAGS "-ffree-line-length-none" PARENT_SCOPE ) - set( NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" PARENT_SCOPE) -endfunction() - -function (setPGI) - message("Setting PGI Compiler Flags") - set(CMAKE_Fortran_FLAGS_RELEASE "") - set(Fortran_FLAGS "" PARENT_SCOPE) - set(GSI_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ -mp -Mfree" PARENT_SCOPE) - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" PARENT_SCOPE ) - set(ENKF_Fortran_FLAGS " -O3 -byteswapio -fast -DGFS -D_REAL8_ -mp" PARENT_SCOPE) - set(UTIL_Fortran_FLAGS " -O3 -byteswapio -fast -DWRF -D_REAL8_ -mp" PARENT_SCOPE) - - set(BUFR_Fortran_FLAGS "-O1 -byteswapio -D_REAL8_ -mp" PARENT_SCOPE) - set(BUFR_Fortran_PP_FLAGS " -P " PARENT_SCOPE) - set(BUFR_C_FLAGS " -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" PARENT_SCOPE ) - - set(BACIO_C_INCLUDES " -I/usr/include/malloc" PARENT_SCOPE) - set(BACIO_Fortran_FLAGS " -O3 -byteswapio -fast -D_REAL8_ -mp -Mfree" PARENT_SCOPE) - set(CRTM_Fortran_FLAGS " -O1 -byteswapio -module ../../include -Mfree " PARENT_SCOPE) - set(NEMSIO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -mp" PARENT_SCOPE) - set(SIGIO_Fortran_FLAGS " -O3 -Mfree -byteswapio -fast -D_REAL8_ -mp" PARENT_SCOPE) - set(SFCIO_Fortran_FLAGS " -O3 -byteswapio -Mfree -fast -D_REAL8_ -mp" PARENT_SCOPE) - set(SP_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -mp" PARENT_SCOPE) - set(SP_F77_FLAGS "-DLINUX -O1 -byteswapio -D_REAL8_ -mp" PARENT_SCOPE) - set(W3EMC_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ " PARENT_SCOPE) - set(W3NCO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ " PARENT_SCOPE) - set(W3NCO_C_FLAGS " -O1 -D_REAL8_ -mp" PARENT_SCOPE) - set(WRFLIB_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ -mp -Mfree" PARENT_SCOPE) -endfunction() diff --git a/cmake/Modules/setGNUFlags.cmake b/cmake/Modules/setGNUFlags.cmake deleted file mode 100644 index c47f56eee..000000000 --- a/cmake/Modules/setGNUFlags.cmake +++ /dev/null @@ -1,62 +0,0 @@ -function (setGNU) - set(COMPILER_TYPE "gnu" CACHE INTERNAL "Compiler brand") - message("Setting GNU Compiler Flags") - if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) - set(GSI_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ ${GSDCLOUDOPT} -fopenmp -ffree-line-length-0" CACHE INTERNAL "") - set(EXTRA_LINKER_FLAGS "-lgomp -lnetcdf -lnetcdff" CACHE INTERNAL "") - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) - set(ENKF_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(UTIL_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check" CACHE INTERNAL "") - set(BUFR_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") - set(BUFR_C_FLAGS " -O3 -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - set(BACIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(CRTM_Fortran_FLAGS " -g -std=f2003 -fdollar-ok -O3 -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " CACHE INTERNAL "") - set(NEMSIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SIGIO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SFCIO_Fortran_FLAGS " -O3 -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SP_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_Fortran_4_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_F77_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_F77_4_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") - set(W3EMC_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(W3EMC_4_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") - set(W3NCO_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ " CACHE INTERNAL "") - set(W3NCO_4_Fortran_FLAGS " -O3 -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") - set(W3NCO_C_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(WRFLIB_Fortran_FLAGS " -O3 -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" CACHE INTERNAL "") - set(NCDIAG_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "") - set(NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-O3 -fconvert=big-endian" CACHE INTERNAL "") - else( ) #DEBUG - set(GSI_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ ${GSDCLOUDOPT} -fopenmp -ffree-line-length-0" CACHE INTERNAL "") - set(EXTRA_LINKER_FLAGS "-lgomp -lnetcdf -lnetcdff" CACHE INTERNAL "") - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -fbacktrace -Dfunder" CACHE INTERNAL "" ) - set(ENKF_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -DGFS -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(UTIL_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -DWRF -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-line-length-0 -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check" CACHE INTERNAL "") - set(BUFR_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") - set(BUFR_C_FLAGS " -g -fbacktrace -g -fbacktrace -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - set(BACIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(CRTM_Fortran_FLAGS " -g -fbacktrace -std=f2003 -fdollar-ok -g -fbacktrace -fconvert=big-endian -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -static -Wall " CACHE INTERNAL "") - set(NEMSIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SIGIO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffree-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SFCIO_Fortran_FLAGS " -g -fbacktrace -ffree-form -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(SP_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_Fortran_4_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_F77_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp -DLINUX" CACHE INTERNAL "") - set(SP_F77_4_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fopenmp -DLINUX" CACHE INTERNAL "") - set(W3EMC_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(W3EMC_4_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") - set(W3NCO_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -fdefault-real-8 -D_REAL8_ " CACHE INTERNAL "") - set(W3NCO_4_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffixed-form -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check " CACHE INTERNAL "") - set(W3NCO_C_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp" CACHE INTERNAL "") - set(WRFLIB_Fortran_FLAGS " -g -fbacktrace -fconvert=big-endian -ffast-math -fno-second-underscore -frecord-marker=4 -funroll-loops -g -ggdb -static -Wall -fno-range-check -D_REAL8_ -fopenmp -ffree-line-length-0" CACHE INTERNAL "") - set(NCDIAG_Fortran_FLAGS "-ffree-line-length-none" CACHE INTERNAL "") - set(NDATE_Fortran_FLAGS "-fconvert=big-endian -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -fbacktrace -Wl,-noinhibit-exec" CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-O3 -fconvert=big-endian" CACHE INTERNAL "") - endif( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) -endfunction() - diff --git a/cmake/Modules/setHOST.cmake b/cmake/Modules/setHOST.cmake deleted file mode 100644 index 357aa798c..000000000 --- a/cmake/Modules/setHOST.cmake +++ /dev/null @@ -1,96 +0,0 @@ -macro( setHOST ) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Cheyenne.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Discover.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Generic.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Gaea.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Jet.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/S4.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/Theia.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/WCOSS-C.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/WCOSS-D.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/Modules/platforms/WCOSS.cmake) - - site_name(HOSTNAME) - message("The hostname is ${HOSTNAME}" ) - string(REGEX MATCH "s4-" HOST-S4 ${HOSTNAME} ) - string(REGEX MATCH "gaea" HOST-Gaea ${HOSTNAME} ) - string(REGEX MATCH "tfe[0-9]" HOST-Theia ${HOSTNAME} ) - if(EXISTS /jetmon) - set(HOST-Jet "True" ) - endif() - string(REGEX MATCH "g[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) - if( HOST-WCOSS ) - message("host is WCOSS") - endif() - string(REGEX MATCH "g[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) - if( NOT HOST-WCOSS ) # don't overwrite if we are on gyre - string(REGEX MATCH "t[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) - endif() - string(REGEX MATCH "v[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) - if( NOT HOST-WCOSS_D )# don't overwrite if we are on venus - string(REGEX MATCH "m[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) - endif() - string(REGEX MATCH "llogin" HOST-WCOSS_C ${HOSTNAME} ) - if( NOT HOST-WCOSS_C )# don't overwrite if we are on luna - string(REGEX MATCH "slogin" HOST-WCOSS_C ${HOSTNAME} ) - endif() - string(REGEX MATCH "discover" HOST-Discover ${HOSTNAME} ) - string(REGEX MATCH "cheyenne" HOST-Cheyenne ${HOSTNAME} ) - message("done figuring out host--${HOSTNAME}") - if ( BUILD_CORELIBS ) - MESSAGE(STATUS "BUILD_CORELIBS manually-specified as ON") - set( host "GENERIC" ) - set( HOST-Generic "TRUE" ) - setGeneric() - elseif(HOST-Jet) - option(BUILD_CORELIBS "Build the Core libraries " ON) - set( host "Jet" ) - set( HOST-Jet "TRUE" ) - setJet() - elseif( HOST-S4 ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - set( host "S4" ) - set( HOST-S4 "TRUE" ) - setS4() - elseif( HOST-WCOSS ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - set( host "WCOSS" ) - set( HOST-WCOSS "TRUE" ) - setWCOSS() - elseif( HOST-Theia ) - set( host "Theia" ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - setTHEIA() - set( HOST-Theia "TRUE" ) - elseif( HOST-Gaea ) - set( host "Gaea" ) - option(BUILD_CORELIBS "Build the Core libraries " On) - setGaea() - set( HOST-Gaea "TRUE" ) - elseif( HOST-Cheyenne ) - option(BUILD_CORELIBS "Build the Core libraries " ON) - set( host "Cheyenne" ) - setCheyenne() - set( HOST-Cheyenne "TRUE" ) - elseif( HOST-WCOSS_C ) - set( host "WCOSS_C" ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - setWCOSS_C() - set( HOST-WCOSS_C "TRUE" ) - elseif( HOST-WCOSS_D ) - set( host "WCOSS_D" ) - option(BUILD_CORELIBS "Build the Core libraries " OFF) - setWCOSS_D() - set( HOST-WCOSS_D "TRUE" ) - elseif( HOST-Discover ) - set(host "Discover" ) - setDiscover() - set( HOST-Discover "TRUE" ) - else( ) - set( host "GENERIC" ) - option(BUILD_CORELIBS "Build the Core libraries " ON) - setGeneric() - set( HOST-Generic "TRUE" ) - endif() - message("Host is set to ${host}") -endmacro() diff --git a/cmake/Modules/setIntelFlags.cmake b/cmake/Modules/setIntelFlags.cmake deleted file mode 100644 index bd968fc76..000000000 --- a/cmake/Modules/setIntelFlags.cmake +++ /dev/null @@ -1,87 +0,0 @@ -function(set_LIBRARY_UTIL_Intel) - set(BACIO_Fortran_FLAGS "-O3 -free -assume nocc_omp ${HOST_FLAG} " CACHE INTERNAL "" ) - set(BUFR_Fortran_FLAGS "-O2 -r8 -fp-model strict -traceback -O3 ${HOST_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(BUFR_C_FLAGS "-DSTATIC_ALLOCATION -DUNDERSCORE -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - set(BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " CACHE INTERNAL "" ) - set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") - set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" CACHE INTERNAL "" ) - set (CRTM_Fortran_FLAGS " -O3 -convert big_endian -free -assume byterecl -fp-model source -traceback ${HOST_FLAG}" CACHE INTERNAL "" ) - set (NEMSIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SFCIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SIGIO_Fortran_FLAGS " -O2 -convert big_endian -free -assume byterecl -fp-model strict -traceback ${HOST_FLAG} -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SP_Fortran_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SP_Fortran_4_FLAGS " -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (SP_F77_FLAGS " -DLINUX -O2 -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -convert big_endian -assume byterecl -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3EMC_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3EMC_4_Fortran_FLAGS " -O3 -auto -assume nocc_omp -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3NCO_Fortran_FLAGS " -O3 -auto -assume nocc_omp -i -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3NCO_4_Fortran_FLAGS " -O3 -auto -assume nocc_omp -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set (W3NCO_C_FLAGS "-O0 -DUNDERSCORE -DLINUX -D__linux__ " CACHE INTERNAL "" ) - set (NDATE_Fortran_FLAGS "${HOST_FLAG} -fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 -Wl,-noinhibit-exec" CACHE INTERNAL "" ) - set(NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" CACHE INTERNAL "" ) - set(UTIL_Fortran_FLAGS "-O3 ${HOST_FLAG} -warn all -implicitnone -traceback -fp-model strict -convert big_endian -DWRF -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS "-O3 -fp-model source -convert big_endian -assume byterecl -implicitnone" CACHE INTERNAL "") -endfunction(set_LIBRARY_UTIL_Intel) - -function(set_LIBRARY_UTIL_Debug_Intel) - set (BACIO_Fortran_FLAGS "-g -free -assume nocc_omp " CACHE INTERNAL "" ) - set(BUFR_Fortran_FLAGS " -c -g -traceback -O3 -axCORE-AVX2 -r8 " CACHE INTERNAL "" ) - set(BUFR_C_FLAGS "-g -traceback -DUNDERSCORE -O3 -axCORE-AVX2 -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - set(BUFR_Fortran_PP_FLAGS " -P -traditional-cpp -C " CACHE INTERNAL "" ) - set(CRTM_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SFCIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SIGIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SP_Fortran_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -i${intsize} -r8 -convert big_endian -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SP_Fortran_4_FLAGS " -g -ip -fp-model strict -assume byterecl -fpp -convert big_endian -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(SP_F77_FLAGS " -g -ip -fp-model strict -assume byterecl -convert big_endian -fpp -i${intsize} -r8 -DLINUX ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3EMC_Fortran_FLAGS " -g -auto -assume nocc_omp -i${intsize} -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3EMC_4_Fortran_FLAGS " -g -auto -assume nocc_omp -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(NEMSIO_Fortran_FLAGS " -convert big_endian -free -assume byterecl -xHOST -fp-model strict -traceback -g ${MKL_FLAG} ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3NCO_Fortran_FLAGS " -g -auto -assume nocc_omp -i -r8 -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3NCO_4_Fortran_FLAGS " -g -auto -assume nocc_omp -convert big_endian -assume byterecl -fp-model strict ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "" ) - set(W3NCO_C_FLAGS "-O0 -g -DUNDERSCORE -DLINUX -D__linux__ " CACHE INTERNAL "" ) - set(NCDIAG_Fortran_FLAGS "-free -assume byterecl -convert big_endian" CACHE INTERNAL "" ) - set(WRFLIB_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O1 -g -fp-model source -assume byterecl -convert big_endian -g -traceback -D_REAL8_ ${MPI_Fortran_COMPILE_FLAGS}" CACHE INTERNAL "") - set(NDATE_Fortran_FLAGS "${HOST_FLAG} -fp-model source -ftz -assume byterecl -convert big_endian -heap-arrays -DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -Wl,-noinhibit-exec" CACHE INTERNAL "" ) - set(WRFLIB_C_FLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) - set(UTIL_Fortran_FLAGS "-O0 ${HOST_FLAG} -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian -D_REAL8_ ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS "-O0 -warn all -implicitnone -traceback -g -debug full -fp-model strict -convert big_endian" CACHE INTERNAL "") -endfunction(set_LIBRARY_UTIL_Debug_Intel) - -function(set_GSI_ENKF_Intel) - #Common release/production flags - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder" CACHE INTERNAL "" ) - set(GSI_Fortran_FLAGS "${GSI_Intel_Platform_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "Full GSI Fortran FLAGS" ) - set(ENKF_Fortran_FLAGS "${ENKF_Platform_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "Full ENKF Fortran FLAGS" ) - set(GSDCLOUD_Fortran_FLAGS "-O3 -convert big_endian" CACHE INTERNAL "") -endfunction(set_GSI_ENKF_Intel) - -function (set_GSI_ENKF_Debug_Intel) - set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -mcmodel medium -shared-intel -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") - set(ENKF_Fortran_FLAGS "-O0 ${HOST_FLAG} -warn all -implicitnone -traceback -g -debug all -check all,noarg_temp_created -fp-model strict -convert big_endian -assume byterecl -D_REAL8_ ${MPI3FLAG} ${OpenMP_Fortran_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -convert big_endian" CACHE INTERNAL "") - #Common debug flags - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) -endfunction (set_GSI_ENKF_Debug_Intel) - -function (setIntel) - string(REPLACE "." ";" COMPILER_VERSION_LIST ${CMAKE_C_COMPILER_VERSION}) - list(GET COMPILER_VERSION_LIST 0 MAJOR_VERSION) - list(GET COMPILER_VERSION_LIST 1 MINOR_VERSION) - list(GET COMPILER_VERSION_LIST 2 PATCH_VERSION) - set(COMPILER_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" CACHE INTERNAL "Compiler Version") - set(COMPILER_TYPE "intel" CACHE INTERNAL "Compiler brand") - STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) - STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) - set(EXTRA_LINKER_FLAGS ${MKL_FLAG} CACHE INTERNAL "Extra Linker flags") - if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) - set_GSI_ENKF_Intel() - set_LIBRARY_UTIL_Intel() - else( ) #DEBUG flags - message("Building DEBUG version of GSI") - set( debug_suffix "_DBG" CACHE INTERNAL "" ) - set_GSI_ENKF_Debug_Intel() - set_LIBRARY_UTIL_Debug_Intel() - endif() -endfunction() - diff --git a/cmake/Modules/setPGIFlags.cmake b/cmake/Modules/setPGIFlags.cmake deleted file mode 100644 index 3e63ba4ce..000000000 --- a/cmake/Modules/setPGIFlags.cmake +++ /dev/null @@ -1,78 +0,0 @@ -function (setPGI) - message("Setting PGI Compiler Flags") - set(COMPILER_TYPE "pgi" CACHE INTERNAL "Compiler brand") - if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) - set(CMAKE_Fortran_FLAGS_RELEASE "") - set(Fortran_FLAGS "" CACHE INTERNAL "") - set(GSI_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ ${GSDCLOUDOPT} -mp -Mfree" CACHE INTERNAL "") - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -Dfunder" CACHE INTERNAL "" ) - set(ENKF_Fortran_FLAGS " -O3 -byteswapio -fast -DGFS -D_REAL8_ -mp" CACHE INTERNAL "") - set(UTIL_Fortran_FLAGS " -O3 -byteswapio -fast -DWRF -D_REAL8_ -mp" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS " -O3 -byteswapio -fast" CACHE INTERNAL "") - - set(BUFR_Fortran_FLAGS "-O1 -byteswapio -D_REAL8_ -mp -r8" CACHE INTERNAL "") - set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") - set(BUFR_C_FLAGS " -g -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - - set(BACIO_C_INCLUDES " -I/usr/include/malloc" CACHE INTERNAL "") - set(BACIO_Fortran_FLAGS " -O3 -byteswapio -fast -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") - set(CRTM_Fortran_FLAGS " -O1 -byteswapio -module ../../include -Mfree " CACHE INTERNAL "") - set(NEMSIO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -mp" CACHE INTERNAL "") - set(SIGIO_Fortran_FLAGS " -O3 -Mfree -byteswapio -fast -D_REAL8_ -mp" CACHE INTERNAL "") - set(SFCIO_Fortran_FLAGS " -O3 -byteswapio -Mfree -fast -D_REAL8_ -mp" CACHE INTERNAL "") - set(SP_Fortran_FLAGS " -O1 -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") - set(SP_Fortran_4_FLAGS " -O1 -byteswapio -DLINUX -mp " CACHE INTERNAL "") - set(SP_F77_4_FLAGS "-DLINUX -O1 -byteswapio -DLINUX -mp " CACHE INTERNAL "") - set(SP_F77_FLAGS "-DLINUX -O1 -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") - set(W3EMC_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") - set(W3EMC_4_Fortran_FLAGS " -O1 -byteswapio " CACHE INTERNAL "") - set(W3NCO_Fortran_FLAGS " -O1 -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") - set(W3NCO_4_Fortran_FLAGS " -O1 -byteswapio " CACHE INTERNAL "") - set(W3NCO_C_FLAGS " -O1 -D_REAL8_ -mp" CACHE INTERNAL "") - set(WRFLIB_Fortran_FLAGS "-Minform=inform -O1 -byteswapio -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") - set(NDATE_Fortran_FLAGS "-DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -O3 " CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-O3 -byteswapio" CACHE INTERNAL "") - - if ( ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 18.5 ) - set( NCDIAG_Fortran_FLAGS "-Mfree -DOLDPGI" CACHE INTERNAL "" ) - else() - set( NCDIAG_Fortran_FLAGS "-Mfree" CACHE INTERNAL "" ) - endif() - else() - set(Fortran_FLAGS "" CACHE INTERNAL "") - set(GSI_Fortran_FLAGS "-Minform=inform -g -traceback -byteswapio -D_REAL8_ ${GSDCLOUDOPT} -mp -Mfree" CACHE INTERNAL "") - set(GSI_CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -g -traceback -Dfunder" CACHE INTERNAL "" ) - set(ENKF_Fortran_FLAGS " -g -traceback -byteswapio -fast -DGFS -D_REAL8_ -mp" CACHE INTERNAL "") - set(UTIL_Fortran_FLAGS " -g -traceback -byteswapio -fast -DWRF -D_REAL8_ -mp" CACHE INTERNAL "") - set(UTIL_COM_Fortran_FLAGS " -g -traceback -byteswapio -fast" CACHE INTERNAL "") - - set(BUFR_Fortran_FLAGS "-g -traceback -byteswapio -D_REAL8_ -mp -r8" CACHE INTERNAL "") - set(BUFR_Fortran_PP_FLAGS " -P " CACHE INTERNAL "") - set(BUFR_C_FLAGS " -g -traceback -DUNDERSCORE -DDYNAMIC_ALLOCATION -DNFILES=32 -DMAXCD=250 -DMAXNC=600 -DMXNAF=3" CACHE INTERNAL "" ) - - set(BACIO_C_INCLUDES " -I/usr/include/malloc" CACHE INTERNAL "") - set(BACIO_Fortran_FLAGS " -g -traceback -byteswapio -fast -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") - set(CRTM_Fortran_FLAGS " -g -traceback -byteswapio -module ../../include -Mfree " CACHE INTERNAL "") - set(NEMSIO_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -mp" CACHE INTERNAL "") - set(SIGIO_Fortran_FLAGS " -g -traceback -Mfree -byteswapio -fast -D_REAL8_ -mp" CACHE INTERNAL "") - set(SFCIO_Fortran_FLAGS " -g -traceback -byteswapio -Mfree -fast -D_REAL8_ -mp" CACHE INTERNAL "") - set(SP_Fortran_FLAGS " -g -traceback -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") - set(SP_Fortran_4_FLAGS " -g -traceback -byteswapio -DLINUX -mp " CACHE INTERNAL "") - set(SP_F77_4_FLAGS "-DLINUX -g -traceback -byteswapio -DLINUX -mp " CACHE INTERNAL "") - set(SP_F77_FLAGS "-DLINUX -g -traceback -byteswapio -DLINUX -mp -r8 " CACHE INTERNAL "") - set(W3EMC_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") - set(W3EMC_4_Fortran_FLAGS " -g -traceback -byteswapio " CACHE INTERNAL "") - set(W3NCO_Fortran_FLAGS " -g -traceback -byteswapio -D_REAL8_ -r8 " CACHE INTERNAL "") - set(W3NCO_4_Fortran_FLAGS " -g -traceback -byteswapio " CACHE INTERNAL "") - set(W3NCO_C_FLAGS " -g -traceback -D_REAL8_ -mp" CACHE INTERNAL "") - set(WRFLIB_Fortran_FLAGS "-Minform=inform -g -traceback -byteswapio -D_REAL8_ -mp -Mfree" CACHE INTERNAL "") - set(NDATE_Fortran_FLAGS "-DCOMMCODE -DLINUX -DUPPLITTLEENDIAN -g -traceback " CACHE INTERNAL "") - set(GSDCLOUD_Fortran_FLAGS "-O3 -byteswapio" CACHE INTERNAL "") - - if ( ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 18.5 ) - set( NCDIAG_Fortran_FLAGS "-Mfree -DOLDPGI" CACHE INTERNAL "" ) - else() - set( NCDIAG_Fortran_FLAGS "-Mfree" CACHE INTERNAL "" ) - endif() - endif( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) -endfunction() diff --git a/cmake/Modules/setPlatformVariables.cmake b/cmake/Modules/setPlatformVariables.cmake deleted file mode 100644 index 31b271bf2..000000000 --- a/cmake/Modules/setPlatformVariables.cmake +++ /dev/null @@ -1,10 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Jet.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS-C.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/S4.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Theia.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Gaea.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Cheyenne.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Discover.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/WCOSS-D.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/platforms/Generic.cmake) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 4c5e46c2d..74c219cc8 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -19,9 +19,9 @@ add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS -qopenmp ) -message("hey, g2 inc is ${G2TMPL_INC}") -include_directories( ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_4_INC} ${NEMSIOINC} ${SFCIO_4_INC} ${W3EMC4INC} ${G2_INC4} ${G2TMPL_INC} ${GFSIO_INC} ${CRTM_INC} ) -target_link_libraries(${EXENAME} ${BACIO_LIBRARY} ${SP_4_LIBRARY} ${W3NCO_4_LIBRARY} ${SIGIO_4_LIBRARY} ${NEMSIO_LIBRARY} ${IP_4_LIBRARY} ${SFCIO_4_LIBRARY} ${W3EMC_4_LIBRARY} ${ZLIB} ${G2TMPL_LIBRARY} ${G2_4_LIBRARY} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIBRARY} ${CRTM_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIBRARY} ) +message("hey, g2 inc is ${G2TMPL_INCd}") +include_directories( ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ) +target_link_libraries(${EXENAME} ${BACIO_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${SIGIO_LIB} ${NEMSIO_LIB} ${IP_LIB4} ${SFCIO_LIB} ${W3EMC_LIB4} ${ZLIB} ${G2TMPL_LIBd} ${G2_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIB4} ${CRTM_LIB} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIB4} ) install(TARGETS ${EXENAME} From 9ea1c0c37a3183178f81a64d00e4c69033168599 Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Thu, 10 Oct 2019 18:04:33 -0400 Subject: [PATCH 03/85] tweak to findnetcdf --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index f06f9f5fe..bc4e48d5d 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit f06f9f5fea223482f66b788778966041fd83bbce +Subproject commit bc4e48d5d8ce9a5d64fe0d8d7eb91c8cb82948cc From d718fea4dfa4f049726307d86a015acb72322de2 Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Fri, 11 Oct 2019 10:03:36 -0400 Subject: [PATCH 04/85] added include directory --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f179e088..63b8cb3bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,6 @@ find_package( W3EMC ) find_package( CRTM ) find_package( NetCDF ) -include_directories(${CMAKE_INSTALL_PREFIX}/include_d) +include_directories(${CMAKE_INSTALL_PREFIX}/include_d ${CMAKE_INSTALL_PREFIX}/include ) add_subdirectory(sorc/ncep_post.fd) From a3770fc3afc8759e460171733f78f6decf0654fc Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Tue, 15 Oct 2019 18:42:39 +0000 Subject: [PATCH 05/85] updated cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index bc4e48d5d..9fbdd78a6 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit bc4e48d5d8ce9a5d64fe0d8d7eb91c8cb82948cc +Subproject commit 9fbdd78a6f52596eef687e31d165de9249576d39 From 913dea7feb7e629622df1b66f92c5720cf6b4ed2 Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Fri, 18 Oct 2019 14:05:27 -0400 Subject: [PATCH 06/85] changed to https for cmake submodule --- .gitmodules | 2 +- cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index dffa9cbe3..2d2fcfbe3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "cmake"] path = cmake - url = git@github.com:NOAA-EMC/CMakeModules + url = https://github.com/NOAA-EMC/CMakeModules.git diff --git a/cmake b/cmake index 9fbdd78a6..bc4e48d5d 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 9fbdd78a6f52596eef687e31d165de9249576d39 +Subproject commit bc4e48d5d8ce9a5d64fe0d8d7eb91c8cb82948cc From 49fd9605564bd56c88dccdcb35885ad1d79649ca Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Tue, 22 Oct 2019 18:11:08 -0400 Subject: [PATCH 07/85] updated cmake submodule --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index bc4e48d5d..255ab8c7f 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit bc4e48d5d8ce9a5d64fe0d8d7eb91c8cb82948cc +Subproject commit 255ab8c7facee736c178feca97038ec5a92e7617 From a7d954af82efe9a7c6a6450629d8617b8aa5bb34 Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Fri, 1 Nov 2019 17:50:40 +0000 Subject: [PATCH 08/85] updated install directory --- sorc/ncep_post.fd/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 74c219cc8..4b996ab95 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -28,4 +28,5 @@ install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) +install(DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/ DESTINATION include_4 ) From 159e097cb76e32bb99093eefc8911bb611425af8 Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Fri, 8 Nov 2019 12:31:24 -0500 Subject: [PATCH 09/85] added build for libnceppost.a --- sorc/ncep_post.fd/CMakeLists.txt | 169 ++++++++++++++++++++++++++++++- 1 file changed, 166 insertions(+), 3 deletions(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 4b996ab95..ac91e53a9 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -1,6 +1,163 @@ cmake_minimum_required(VERSION 2.6) set(EXENAME ncep_post ) +set(LIBNAME nceppost ) +set(LIB_SRC +AllGETHERV_GSD.f +ALLOCATE_ALL.f +ASSIGNNEMSIOVAR.f +AVIATION.f +blockIO.c +BNDLYR.f +BOUND.f +CALCAPE.f +CALDRG.f +CALDWP.f +CALGUST.f +CALHEL.f +CALLCL.f +CALMCVG.f +CALMICT.f +CALPBL.f +CALPBLREGIME.f +CALPOT.f +CALPW.f +CALRAD_WCLOUD_newcrtm.f +CALRCH.f +CALRH.f +CALRH_GFS.f +CALRH_GSD.f +CALRH_PW.f +CALSTRM.f +CALTAU.f +CALTHTE.f +CALUPDHEL.f +CALVIS.f +CALVIS_GSD.f +CALVOR.f +CALWXT_BOURG.f +CALWXT_DOMINANT.f +CALWXT_EXPLICIT.f +CALWXT.f +CALWXT_RAMER.f +CALWXT_REVISED.f +CANRES.f +CLDFRAC_ZHAO.f +CLDRAD.f +CLMAX.f +CMASSI.f +COLLECT.f +COLLECT_LOC.f +CTLBLK.f +cuparm.f +DEALLOCATE.f +DEWPOINT.f +ETCALC.f +EXCH2.f +EXCH.f +FDLVL.f +FGAMMA.f +FILL_PSETFLD.f +FIXED.f +FRZLVL2.f +FRZLVL.f +GEO_ZENITH_ANGLE.f +GET_BITS.f +GETGBANDSCATTER.f +getIVariableN.f +GETNEMSNDSCATTER.f +get_postfilename.f +getVariable.f +GFIP3.f +GFSPOST.F +GPVS.f +grib2_module.f +GRIBIT.F +GRIDAVG.f +GRIDSPEC.f +gtg_algo.f90 +gtg_compute.f90 +gtg_config.f90 +gtg_ctlblk.f90 +gtg_filter.f90 +gtg_indices.f90 +gtg_smoothseams.f90 +ICAOHEIGHT.f +INITPOST.F +INITPOST_GFS.f +INITPOST_GFS_NEMS.f +INITPOST_GFS_NEMS_MPIIO.f +INITPOST_GFS_SIGIO.f +INITPOST_NEMS.f +INITPOST_NEMS_MPIIO.f +INITPOST_NETCDF.f +INITPOST_NMM.f +kinds_mod.F +LFMFLD.f +LFMFLD_GFS.f +LOOKUP.f +machine.f +map_routines.f90 +MAPSSLP.f +MASKS_mod.f +MDL2AGL.f +MDL2P.f +MDL2SIGMA2.f +MDL2SIGMA.f +MDL2THANDPV.f +MDLFLD.f +MICROINIT.F +MISCLN.f +MIXLEN.f +MPI_FIRST.f +MPI_LAST.f +MSFPS.f +native_endianness.f +NGMFLD.f +NGMSLP.f +OTLFT.f +OTLIFT.f +PARAMR.f +params.F +PARA_RANGE.f +physcons.f +PMICRPH.f +POLEAVG.f +PROCESS.f +READCNTRL.f +READ_xml.f +retrieve_index.f +RHGRD.f +RQSTFLD.f +SCLFLD.f +SELECT_CHANNELS.f +SERVER.f +SET_LVLSXML.f +SET_OUTFLDS.f +SETUP_SERVERS.f +SLP_new.f +SLP_NMM.f +SMOOTH.f +SNFRAC.f +SNFRAC_GFS.f +SOIL_mod.f +SPLINE.f +SURFCE.f +svptbl.f +TABLE.f +TABLEQ.f +TRPAUS.f +TTBLEX.f +VRBLS2D_mod.f +VRBLS3D_mod.f +VRBLS4D_mod.f +WETBULB.f +WETFRZLVL.f +wrf_io_flags.f +wrf_io_flags.h +WRFPOST.f +xml_perl_data.f +ZENSUN.f) file(GLOB EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f ${CMAKE_CURRENT_SOURCE_DIR}/*.f90 ${CMAKE_CURRENT_SOURCE_DIR}/*.F) file(GLOB EXE_C_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c) list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) @@ -14,13 +171,14 @@ else() exit() endif() -set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) +add_library(${LIBNAME} ${EXE_SRC} ${EXE_C_SRC} ) set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) +set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS -qopenmp ) message("hey, g2 inc is ${G2TMPL_INCd}") -include_directories( ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ) +include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ${CMAKE_INSTALL_PREFIX}/include_4 ) target_link_libraries(${EXENAME} ${BACIO_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${SIGIO_LIB} ${NEMSIO_LIB} ${IP_LIB4} ${SFCIO_LIB} ${W3EMC_LIB4} ${ZLIB} ${G2TMPL_LIBd} ${G2_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIB4} ${CRTM_LIB} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIB4} ) @@ -28,5 +186,10 @@ install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) -install(DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/ DESTINATION include_4 ) +install(TARGETS ${LIBNAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + +install(DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/ DESTINATION include_4 ) From 1fdf605f9c52e8596f67dbd6efbd34b6923a201c Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 19 Nov 2019 16:02:56 -0700 Subject: [PATCH 10/85] modifications for macOS clang/gfortran build --- CMakeLists.txt | 2 +- sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f | 6 +- sorc/ncep_post.fd/CMakeLists.txt | 12 +- sorc/ncep_post.fd/Makefile.dom.whateverthisis | 258 +++++++++++++++ sorc/ncep_post.fd/makefile | 306 ++++-------------- 5 files changed, 331 insertions(+), 253 deletions(-) create mode 100644 sorc/ncep_post.fd/Makefile.dom.whateverthisis diff --git a/CMakeLists.txt b/CMakeLists.txt index 63b8cb3bd..a59bcb2c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") message("setting intel true") set(IntelComp true ) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*") +elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang*") set(GNUComp true ) elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*") set(PGIComp true ) diff --git a/sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f b/sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f index 69214d004..14f2f8a24 100644 --- a/sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f +++ b/sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f @@ -317,10 +317,10 @@ SUBROUTINE CALRAD_WCLOUD .or. iget(865) > 0 .or. iget(866) > 0 .or. iget(867) > 0 & .or. iget(868) > 0 .or. iget(869) > 0 .or. iget(870) > 0 & .or. iget(871) > 0 .or. iget(872) > 0 .or. iget(873) > 0 & - .or. iget(874) > 0 .or. iget(875) > 0 .or. iget(876) > 0 & + .or. iget(874) > 0 .or. iget(875) > 0 .or. iget(876) > 0 & .or. iget(877) > 0 .or. iget(878) > 0 .or. iget(879) > 0 & - .or. iget(880) > 0 .or. iget(881) > 0 .or. iget(882) > 0 & - .or. post_abig16 .or. post_abig17 > 0 ) then + .or. iget(880) > 0 .or. iget(881) > 0 .or. iget(882) > 0 & + .or. post_abig16 .or. post_abig17 ) then ! specify numbers of cloud species ! Thompson==8, Ferrier==5,95, WSM6==6, Lin==2 diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 4b996ab95..73ba35871 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -9,8 +9,16 @@ if(IntelComp) message("setting intel flags") set(CMAKE_Fortran_8_FLAGS " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") +elseif(GNUComp) + message("setting gnu flags") + set(CMAKE_Fortran_8_FLAGS " -ffree-form -O3 -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) + if(APPLE) + set(CMAKE_C_FLAGS "-DAPPLE -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") + elseif(UNIX) + set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") + endif(APPLE) else() - message("unkown compiler!") + message("unknown compiler!") exit() endif() @@ -18,7 +26,7 @@ set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLA add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) -set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS -qopenmp ) +set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS} ) message("hey, g2 inc is ${G2TMPL_INCd}") include_directories( ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ) target_link_libraries(${EXENAME} ${BACIO_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${SIGIO_LIB} ${NEMSIO_LIB} ${IP_LIB4} ${SFCIO_LIB} ${W3EMC_LIB4} ${ZLIB} ${G2TMPL_LIBd} ${G2_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIB4} ${CRTM_LIB} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIB4} ) diff --git a/sorc/ncep_post.fd/Makefile.dom.whateverthisis b/sorc/ncep_post.fd/Makefile.dom.whateverthisis new file mode 100644 index 000000000..7a0a614d8 --- /dev/null +++ b/sorc/ncep_post.fd/Makefile.dom.whateverthisis @@ -0,0 +1,258 @@ +#!/bin/ksh +set -x +mac=$(hostname | cut -c1-1) +mac2=$(hostname | cut -c1-2) +################################# options ############################################### +#export CLEAN=NO # comment this line to clean before compiling +#debug=YES # turn on debug mode - default - NO + make_post_lib=YES # create post library - default - NO + make_post_exec=YES # create post executable - default - YES +#make_nowrf=YES # compile with wrf stub instead of WRF lib +################################# options ############################################### +# +if [ $mac2 = ga ] ; then # For GAEA + machine=gaea + center=${center:-ncep} + make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib +elif [ $mac2 = tf ] ; then # For Theia + machine=theia + make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib +elif [ $mac = z -o $mac = h -o $mac = f ] ; then # For ZEUS + machine=zeus + make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib +elif [ $mac = t -o $mac = e -o $mac = g ] ; then # For WCOSS + machine=wcoss +elif [ $mac = l -o $mac = s ] ; then # wcoss_c (i.e. luna and surge) + export machine=wcoss_c + make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib +fi +debug=${debug:-NO} +export make_post_lib=${make_post_lib:-NO} +export make_post_exec=${make_post_exec:-YES} +export make_nowrf=${make_nowrf:- NO} +if [ $machine = wcoss ] ; then + export NETCDFPATH="/usrx/local/NetCDF/3.6.3" + export WRFPATH="/nwprod/sorc/wrf_shared.v1.1.0" + export NWPROD="/nwprod" + export XMLPATH=$NWPROD + export IPPATH=$NWPROD + export SPPATH=/usrx/local/nceplibs + export BACIOPATH=/usrx/local/nceplibs + export ipv="" + export spv=_v2.0.2p + export crtmv=2.0.6 + export crtmv_inc=$crtmv + export xmlv=_v2.0.0 + export baciov=_v2.0.1p + export FC=mpiifort + export CPP="/lib/cpp -P" + export CPPFLAGS="-DLINUX" + export CC=cc + if [ $debug = YES ] ; then + export OPTS="-O0 -openmp " + export DEBUG="-g -traceback -convert big_endian -ftrapuv -check bounds -check format -check output_conversion -check pointers -check uninit -fp-stack-check" + else + export OPTS="-O3 -convert big_endian -fp-model source -openmp -xAVX" + export DEBUG="" + fi + export LIST="" + export FREE="-FR" + export TRAPS="" + export PROFILE="" +elif [ $machine = wcoss_c ] ; then + export FC=ftn + export CPP="/lib/cpp -P" + export CPPFLAGS="-DLINUX" + export CC=cc + if [ $debug = YES ] ; then + export OPTS="-O0 -openmp " + export DEBUG="-g -traceback -convert big_endian -ftrapuv -check bounds -check format -check output_conversion -check pointers -check uninit -fp-stack-check" + else + export OPTS="-O3 -convert big_endian -fp-model source -openmp -xAVX" + export DEBUG="" + fi + export LIST="" + export FREE="-FR" + export TRAPS="" + export PROFILE="" +elif [ $machine = zeus ] ; then + export NETCDFPATH="/apps/netcdf/3.6.3/intel" + export WRFPATH="/scratch2/portfolios/NCEPDEV/meso/save/Dusan.Jovic/WRFV3" + export NWPROD="/contrib/nceplibs/nwprod" + export XMLPATH="/home/Hui-Ya.Chuang" + export IPPATH=$NWPROD + export SPPATH=$NWPROD + export ipv="" + export spv=_v2.0.1 + export crtmv=2.0.7 + export FC="ifort -lmpi" + export CPP="/lib/cpp -P" + export CC=cc + export ARCH="" + export CPPFLAGS="-DLINUX" + if [ $debug = YES ] ; then + export OPTS="-O0 -openmp -g" + export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" + else + export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source -openmp" + export DEBUG="" + fi + export LIST="" + export FREE="-FR" + export TRAPS="" + export PROFILE="" +elif [ $machine = theia ] ; then + export NETCDFPATH="/apps/netcdf/4.3.0-intel" + export WRFPATH="/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/theia/nceplibs/nwprod/lib/sorc/WRFV3" + export NWPROD="/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/theia/nceplibs/nwprod" + export ipv=_v2.0.3 + export spv="" + export crtmv=2.0.7 + export gfsiov="" + export w3ev=_v2.1.0 + export w3nv="" + export xmlv=_v2.0.0 + export g2tv="" + export baciov=_v2.1.0 + export XMLPATH=$NWPROD + export IPPATH=$NWPROD + export SPPATH=$NWPROD + export BACIOPATH=$NWPROD/lib + export FC=mpiifort + export CPP="/lib/cpp -P" + export CC=cc + export ARCH="" + export CPPFLAGS="-DLINUX" + if [ $debug = YES ] ; then + export OPTS="-O0 -openmp -g" + export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" + else + export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source -openmp" + export DEBUG="" + fi + export LIST="" + export FREE="-FR" + export TRAPS="" + export PROFILE="" +elif [ $machine = gaea ] ; then + export NETCDFPATH="/opt/cray/netcdf/4.3.2/INTEL/140" + export WRFPATH="/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod/lib/sorc/WRFV3" + export NWPROD="/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod" + export IPPATH=$NWPROD + export SPPATH=$NWPROD + export baciov=_v2.1.0 + export BACIOPATH=/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod/lib/sorc/bacio_fast_byteswap/bacio${baciov}_4 + export ipv="" + export spv=_v2.0.1 + export xmlv=_v2.0.0 + export FC=ftn + export CPP="/lib/cpp -P" + export ARCH="" + export CPPFLAGS="-DLINUX" + export CC=icc + if [ $debug = YES ] ; then + export OPTS="-O0 -g" + export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" + else + export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source" + export DEBUG="" + fi + export LIST="" + export FREE=-FR + export TRAPS="" + export PROFILE="" + + export gfsiov="" + export crtmv=2.0.7 + export w3ev=_v2.1.0 + export w3nv="" +fi +export crtmv=${crtmv:-2.0.7} +export crtmv_inc=${crtmv_inc:-v$crtmv} +export XMLPATH=${XMLPATH:-$NWPROD} +export BACIOPATH=${BACIOPATH:-$NWPROD/lib} +export xmlv=${xmlv:-""} +export w3ev=${w3ev:-_v2.0.3} +export ipv=${ipv:-""} +export spv=${spv:-""} + +if [ ${CLEAN:-YES} = YES ] ; then make -f Makefile clean ; fi + +export CFLAGS="-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" +if [ $machine = wcoss_c ] ; then + + if [ $make_nowrf = YES ] ; then + WRF_INC= + WRF_LIB= + fi + NETCDF_LIB="${NETCDF}/lib/libnetcdf.a" + export FFLAGS="${OPTS} ${FREE} ${TRAPS} ${DEBUG} -I${XMLPARSE_INC} -I${G2_INC4} -I${G2TMPL_INC} -I${NEMSIO_INC} -I${SIGIO_INC4} -I${SFCIO_INC4} -I${GFSIO_INC4} -I${W3EMC_INC4} -I${CRTM_INC} -I${NETCDF_INCLUDE} -I${PNG_INC}" + + export LIBS="${WRF_LIB} ${XMLPARSE_LIB} ${G2_LIB4} ${G2TMPL_LIB} ${NEMSIO_LIB} ${GFSIO_LIB4} ${SIGIO_LIB4} ${SFCIO_LIB4} ${IP_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${W3EMC_LIB4} ${BACIO_LIB4} ${CRTM_LIB} ${NETCDF_LIB} ${PNG_LIB} ${JASPER_LIB} ${Z_LIB}" +else + SFCIO_INC="-I${NWPROD}/lib/incmod/sfcio_4" + SFCIO_LIB="${NWPROD}/lib/libsfcio_4.a" + + NEMSIO_INC="-I${NWPROD}/lib/incmod/nemsio" + NEMSIO_LIB="-L${NWPROD}/lib -lnemsio" + BACIO_LIB="-L${BACIOPATH} -lbacio${baciov}_4" + SIGIO_INC="-I${NWPROD}/lib/incmod/sigio_4" + SIGIO_LIB="${NWPROD}/lib/libsigio_4.a" + NCDLIBS="-L${NETCDFPATH} -lnetcdf" + NCDFFLAGS="-I${NETCDFPATH}" + if [ $make_nowrf = YES ] ; then + WRF_INC= + WRF_LIB= + else + WRF_INC="-I${WRFPATH}/external/io_quilt -I${WRFPATH}/frame" + WRF_LIB="${WRFPATH}/main/libwrflib.a ${WRFPATH}/frame/pack_utils.o ${WRFPATH}/frame/module_internal_header_util.o ${WRFPATH}/external/io_grib1/libio_grib1.a ${WRFPATH}/external/io_grib_share/libio_grib_share.a ${WRFPATH}/external/io_int/libwrfio_int.a ${WRFPATH}/external/io_netcdf/libwrfio_nf.a ${WRFPATH}/external/esmf_time_f90/libesmf_time.a ${WRFPATH}/external/RSL_LITE/librsl_lite.a" + fi + + G2_INC="-I${NWPROD}/lib/incmod/g2_4 -I${NWPROD}/lib/incmod/g2tmpl${g2tv}" + G2_LIB="-L${NWPROD}/lib -lg2tmpl${g2tv} -lg2_4 -ljasper -lpng -lz" + + GFSIO_INC="-I${NWPROD}/lib/incmod/gfsio${gfsiov}_4" + GFSIO_LIB="-L${NWPROD}/lib -lgfsio${gfsiov}_4" + + IP_LIB="-L${IPPATH}/lib -lip${ipv}_4" + SP_LIB="-L${SPPATH} -lsp${sp}_4" + + W3_INC="-I${NWPROD}/lib/incmod/w3emc${w3ev}_4" + W3_LIB="-L${NWPROD}/lib -lw3nco${w3nv}_4 -lw3emc${w3ev}_4" + + CRTM_INC="-I${NWPROD}/lib/incmod/crtm_${crtmv_inc}" + CRTM_LIB="-L${NWPROD}/lib -lcrtm_v${crtmv}" + XML_INC="-I${XMLPATH}/lib/incmod/xmlparse${xmlv}" + XML_LIB="-L${XMLPATH}/lib -lxmlparse${xmlv}" + + NETCDF_LIB="${NETCDFPATH}/lib/libnetcdf.a" + NETCDF_INC="-I${NETCDFPATH}/include" + + export FFLAGS="${OPTS} ${FREE} ${TRAPS} ${DEBUG} ${WRF_INC} ${XML_INC} ${G2_INC} ${NEMSIO_INC} ${GFSIO_INC} ${SIGIO_INC} ${SFCIO_INC} ${W3_INC} ${CRTM_INC} ${NETCDF_INC}" + + export LIBS="${WRF_LIB} ${XML_LIB} ${G2_LIB} ${NEMSIO_LIB} ${GFSIO_LIB} ${SIGIO_LIB} ${SFCIO_LIB} ${IP_LIB} ${SP_LIB} ${W3_LIB} ${BACIO_LIB} ${CRTM_LIB} ${NETCDF_LIB}" + +fi +if [ $make_post_lib = NO ] ; then + if [ $make_post_exec = YES ] ; then + if [ $make_nowrf = YES ] ; then + _make -f Makefile_nowrf + else + make -f Makefile + fi + fi +else + if [ $make_post_exec = YES ] ; then + if [ $make_nowrf = YES ] ; then + make -f Makefile_nowrf + else + make -f Makefile + fi + fi + export POSTLIBPATH=${POSTLIBPATH:-$(pwd)} + if [ ${CLEAN:-YES} = YES ] ; then rm -rf $POSTLIBPATH/include/post_4 ; fi + mkdir -p $POSTLIBPATH/include/post_4 + make -f Makefile_lib +fi + + diff --git a/sorc/ncep_post.fd/makefile b/sorc/ncep_post.fd/makefile index 7a0a614d8..be85a6c99 100644 --- a/sorc/ncep_post.fd/makefile +++ b/sorc/ncep_post.fd/makefile @@ -1,258 +1,70 @@ -#!/bin/ksh -set -x -mac=$(hostname | cut -c1-1) -mac2=$(hostname | cut -c1-2) -################################# options ############################################### -#export CLEAN=NO # comment this line to clean before compiling -#debug=YES # turn on debug mode - default - NO - make_post_lib=YES # create post library - default - NO - make_post_exec=YES # create post executable - default - YES -#make_nowrf=YES # compile with wrf stub instead of WRF lib -################################# options ############################################### +################################################################################ +# +# Makefile for NCEP Post +# +# Use: +# make - build the executable +# make clean - start with a clean slate +# +################################################################################# +# +# Define the name of the executable +# +TARGET = ncep_post # -if [ $mac2 = ga ] ; then # For GAEA - machine=gaea - center=${center:-ncep} - make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib -elif [ $mac2 = tf ] ; then # For Theia - machine=theia - make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib -elif [ $mac = z -o $mac = h -o $mac = f ] ; then # For ZEUS - machine=zeus - make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib -elif [ $mac = t -o $mac = e -o $mac = g ] ; then # For WCOSS - machine=wcoss -elif [ $mac = l -o $mac = s ] ; then # wcoss_c (i.e. luna and surge) - export machine=wcoss_c - make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib -fi -debug=${debug:-NO} -export make_post_lib=${make_post_lib:-NO} -export make_post_exec=${make_post_exec:-YES} -export make_nowrf=${make_nowrf:- NO} -if [ $machine = wcoss ] ; then - export NETCDFPATH="/usrx/local/NetCDF/3.6.3" - export WRFPATH="/nwprod/sorc/wrf_shared.v1.1.0" - export NWPROD="/nwprod" - export XMLPATH=$NWPROD - export IPPATH=$NWPROD - export SPPATH=/usrx/local/nceplibs - export BACIOPATH=/usrx/local/nceplibs - export ipv="" - export spv=_v2.0.2p - export crtmv=2.0.6 - export crtmv_inc=$crtmv - export xmlv=_v2.0.0 - export baciov=_v2.0.1p - export FC=mpiifort - export CPP="/lib/cpp -P" - export CPPFLAGS="-DLINUX" - export CC=cc - if [ $debug = YES ] ; then - export OPTS="-O0 -openmp " - export DEBUG="-g -traceback -convert big_endian -ftrapuv -check bounds -check format -check output_conversion -check pointers -check uninit -fp-stack-check" - else - export OPTS="-O3 -convert big_endian -fp-model source -openmp -xAVX" - export DEBUG="" - fi - export LIST="" - export FREE="-FR" - export TRAPS="" - export PROFILE="" -elif [ $machine = wcoss_c ] ; then - export FC=ftn - export CPP="/lib/cpp -P" - export CPPFLAGS="-DLINUX" - export CC=cc - if [ $debug = YES ] ; then - export OPTS="-O0 -openmp " - export DEBUG="-g -traceback -convert big_endian -ftrapuv -check bounds -check format -check output_conversion -check pointers -check uninit -fp-stack-check" - else - export OPTS="-O3 -convert big_endian -fp-model source -openmp -xAVX" - export DEBUG="" - fi - export LIST="" - export FREE="-FR" - export TRAPS="" - export PROFILE="" -elif [ $machine = zeus ] ; then - export NETCDFPATH="/apps/netcdf/3.6.3/intel" - export WRFPATH="/scratch2/portfolios/NCEPDEV/meso/save/Dusan.Jovic/WRFV3" - export NWPROD="/contrib/nceplibs/nwprod" - export XMLPATH="/home/Hui-Ya.Chuang" - export IPPATH=$NWPROD - export SPPATH=$NWPROD - export ipv="" - export spv=_v2.0.1 - export crtmv=2.0.7 - export FC="ifort -lmpi" - export CPP="/lib/cpp -P" - export CC=cc - export ARCH="" - export CPPFLAGS="-DLINUX" - if [ $debug = YES ] ; then - export OPTS="-O0 -openmp -g" - export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" - else - export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source -openmp" - export DEBUG="" - fi - export LIST="" - export FREE="-FR" - export TRAPS="" - export PROFILE="" -elif [ $machine = theia ] ; then - export NETCDFPATH="/apps/netcdf/4.3.0-intel" - export WRFPATH="/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/theia/nceplibs/nwprod/lib/sorc/WRFV3" - export NWPROD="/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/theia/nceplibs/nwprod" - export ipv=_v2.0.3 - export spv="" - export crtmv=2.0.7 - export gfsiov="" - export w3ev=_v2.1.0 - export w3nv="" - export xmlv=_v2.0.0 - export g2tv="" - export baciov=_v2.1.0 - export XMLPATH=$NWPROD - export IPPATH=$NWPROD - export SPPATH=$NWPROD - export BACIOPATH=$NWPROD/lib - export FC=mpiifort - export CPP="/lib/cpp -P" - export CC=cc - export ARCH="" - export CPPFLAGS="-DLINUX" - if [ $debug = YES ] ; then - export OPTS="-O0 -openmp -g" - export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" - else - export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source -openmp" - export DEBUG="" - fi - export LIST="" - export FREE="-FR" - export TRAPS="" - export PROFILE="" -elif [ $machine = gaea ] ; then - export NETCDFPATH="/opt/cray/netcdf/4.3.2/INTEL/140" - export WRFPATH="/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod/lib/sorc/WRFV3" - export NWPROD="/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod" - export IPPATH=$NWPROD - export SPPATH=$NWPROD - export baciov=_v2.1.0 - export BACIOPATH=/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod/lib/sorc/bacio_fast_byteswap/bacio${baciov}_4 - export ipv="" - export spv=_v2.0.1 - export xmlv=_v2.0.0 - export FC=ftn - export CPP="/lib/cpp -P" - export ARCH="" - export CPPFLAGS="-DLINUX" - export CC=icc - if [ $debug = YES ] ; then - export OPTS="-O0 -g" - export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" - else - export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source" - export DEBUG="" - fi - export LIST="" - export FREE=-FR - export TRAPS="" - export PROFILE="" - - export gfsiov="" - export crtmv=2.0.7 - export w3ev=_v2.1.0 - export w3nv="" -fi -export crtmv=${crtmv:-2.0.7} -export crtmv_inc=${crtmv_inc:-v$crtmv} -export XMLPATH=${XMLPATH:-$NWPROD} -export BACIOPATH=${BACIOPATH:-$NWPROD/lib} -export xmlv=${xmlv:-""} -export w3ev=${w3ev:-_v2.0.3} -export ipv=${ipv:-""} -export spv=${spv:-""} - -if [ ${CLEAN:-YES} = YES ] ; then make -f Makefile clean ; fi - -export CFLAGS="-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" -if [ $machine = wcoss_c ] ; then - - if [ $make_nowrf = YES ] ; then - WRF_INC= - WRF_LIB= - fi - NETCDF_LIB="${NETCDF}/lib/libnetcdf.a" - export FFLAGS="${OPTS} ${FREE} ${TRAPS} ${DEBUG} -I${XMLPARSE_INC} -I${G2_INC4} -I${G2TMPL_INC} -I${NEMSIO_INC} -I${SIGIO_INC4} -I${SFCIO_INC4} -I${GFSIO_INC4} -I${W3EMC_INC4} -I${CRTM_INC} -I${NETCDF_INCLUDE} -I${PNG_INC}" - - export LIBS="${WRF_LIB} ${XMLPARSE_LIB} ${G2_LIB4} ${G2TMPL_LIB} ${NEMSIO_LIB} ${GFSIO_LIB4} ${SIGIO_LIB4} ${SFCIO_LIB4} ${IP_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${W3EMC_LIB4} ${BACIO_LIB4} ${CRTM_LIB} ${NETCDF_LIB} ${PNG_LIB} ${JASPER_LIB} ${Z_LIB}" -else - SFCIO_INC="-I${NWPROD}/lib/incmod/sfcio_4" - SFCIO_LIB="${NWPROD}/lib/libsfcio_4.a" - - NEMSIO_INC="-I${NWPROD}/lib/incmod/nemsio" - NEMSIO_LIB="-L${NWPROD}/lib -lnemsio" - BACIO_LIB="-L${BACIOPATH} -lbacio${baciov}_4" - SIGIO_INC="-I${NWPROD}/lib/incmod/sigio_4" - SIGIO_LIB="${NWPROD}/lib/libsigio_4.a" - NCDLIBS="-L${NETCDFPATH} -lnetcdf" - NCDFFLAGS="-I${NETCDFPATH}" - if [ $make_nowrf = YES ] ; then - WRF_INC= - WRF_LIB= - else - WRF_INC="-I${WRFPATH}/external/io_quilt -I${WRFPATH}/frame" - WRF_LIB="${WRFPATH}/main/libwrflib.a ${WRFPATH}/frame/pack_utils.o ${WRFPATH}/frame/module_internal_header_util.o ${WRFPATH}/external/io_grib1/libio_grib1.a ${WRFPATH}/external/io_grib_share/libio_grib_share.a ${WRFPATH}/external/io_int/libwrfio_int.a ${WRFPATH}/external/io_netcdf/libwrfio_nf.a ${WRFPATH}/external/esmf_time_f90/libesmf_time.a ${WRFPATH}/external/RSL_LITE/librsl_lite.a" - fi - - G2_INC="-I${NWPROD}/lib/incmod/g2_4 -I${NWPROD}/lib/incmod/g2tmpl${g2tv}" - G2_LIB="-L${NWPROD}/lib -lg2tmpl${g2tv} -lg2_4 -ljasper -lpng -lz" - GFSIO_INC="-I${NWPROD}/lib/incmod/gfsio${gfsiov}_4" - GFSIO_LIB="-L${NWPROD}/lib -lgfsio${gfsiov}_4" +OBJS = wrf_io_flags.o getVariable.o getIVariable.o getIVariableN.o \ + kinds_mod.o machine.o physcons.o \ + native_endianness.o blockIO.o initialize_byte_swap_wrf_binary_file.o \ + count_recs_wrf_binary_file.o inventory_wrf_binary_file.o \ + next_buf.o retrieve_index.o ZENSUN.o CLDFRAC_ZHAO.o \ + GFSPOST.o GETGBANDSCATTER.o \ + VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ + CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o xml_perl_data.o \ + cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o \ + SET_LVLSXML.o FILL_PSETFLD.o \ + BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ + CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o \ + CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ + CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALRH_PW.o \ + CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ + CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o DEWPOINT.o \ + FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ + GET_BITS.o GRIBIT.o INITPOST.o LFMFLD.o \ + MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o MPI_FIRST.o MPI_LAST.o \ + NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ + PARA_RANGE.o PROCESS.o INITPOST_NMM.o EXCH2.o \ + READCNTRL.o READ_xml.o SET_OUTFLDS.o SCLFLD.o SERVER.o SETUP_SERVERS.o \ + SMOOTH.o SURFCE.o \ + SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o WRFPOST.o \ + CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ + ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ + AVIATION.o DEALLOCATE.o INITPOST_NMM_BIN_MPIIO.o \ + CALPBL.o MDL2SIGMA2.o INITPOST_GFS.o CALRH_GFS.o LFMFLD_GFS.o \ + CALRAD_WCLOUD_newcrtm.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ + INITPOST_NEMS.o GETNEMSNDSCATTER.o ICAOHEIGHT.o INITPOST_GFS_NEMS.o \ + INITPOST_BIN_MPIIO.o GEO_ZENITH_ANGLE.o GFIP3.o GRIDAVG.o CALUPDHEL.o \ + INITPOST_GFS_SIGIO.o AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o INITPOST_NEMS_MPIIO.o ASSIGNNEMSIOVAR.o - IP_LIB="-L${IPPATH}/lib -lip${ipv}_4" - SP_LIB="-L${SPPATH} -lsp${sp}_4" +# - W3_INC="-I${NWPROD}/lib/incmod/w3emc${w3ev}_4" - W3_LIB="-L${NWPROD}/lib -lw3nco${w3nv}_4 -lw3emc${w3ev}_4" +.SUFFIXES: .F .f .o .f90 .c - CRTM_INC="-I${NWPROD}/lib/incmod/crtm_${crtmv_inc}" - CRTM_LIB="-L${NWPROD}/lib -lcrtm_v${crtmv}" - XML_INC="-I${XMLPATH}/lib/incmod/xmlparse${xmlv}" - XML_LIB="-L${XMLPATH}/lib -lxmlparse${xmlv}" +.F.f: + $(CPP) $(CPPFLAGS) $< > $*.f - NETCDF_LIB="${NETCDFPATH}/lib/libnetcdf.a" - NETCDF_INC="-I${NETCDFPATH}/include" +$(TARGET): $(OBJST) $(OBJS) + $(FC) -openmp -o $@ $(OBJST) $(OBJS) $(LIBS) - export FFLAGS="${OPTS} ${FREE} ${TRAPS} ${DEBUG} ${WRF_INC} ${XML_INC} ${G2_INC} ${NEMSIO_INC} ${GFSIO_INC} ${SIGIO_INC} ${SFCIO_INC} ${W3_INC} ${CRTM_INC} ${NETCDF_INC}" +.f.o: + $(FC) $(FFLAGS) -c $< - export LIBS="${WRF_LIB} ${XML_LIB} ${G2_LIB} ${NEMSIO_LIB} ${GFSIO_LIB} ${SIGIO_LIB} ${SFCIO_LIB} ${IP_LIB} ${SP_LIB} ${W3_LIB} ${BACIO_LIB} ${CRTM_LIB} ${NETCDF_LIB}" +.f90.o: + $(FC) $(FFLAGS) -c $< -fi -if [ $make_post_lib = NO ] ; then - if [ $make_post_exec = YES ] ; then - if [ $make_nowrf = YES ] ; then - _make -f Makefile_nowrf - else - make -f Makefile - fi - fi -else - if [ $make_post_exec = YES ] ; then - if [ $make_nowrf = YES ] ; then - make -f Makefile_nowrf - else - make -f Makefile - fi - fi - export POSTLIBPATH=${POSTLIBPATH:-$(pwd)} - if [ ${CLEAN:-YES} = YES ] ; then rm -rf $POSTLIBPATH/include/post_4 ; fi - mkdir -p $POSTLIBPATH/include/post_4 - make -f Makefile_lib -fi +.c.o : + ${CC} ${CFLAGS} -c $< +clean: + /bin/rm -f $(TARGET) *.lst *.o *.mod From 7bde670968b6813bbddcdf5ddea64b5ec12e66c1 Mon Sep 17 00:00:00 2001 From: Mark Potts Date: Mon, 25 Nov 2019 13:06:54 -0700 Subject: [PATCH 11/85] updated for gnu build --- sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f | 2 +- sorc/ncep_post.fd/CMakeLists.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f b/sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f index 69214d004..17b27e51a 100644 --- a/sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f +++ b/sorc/ncep_post.fd/CALRAD_WCLOUD_newcrtm.f @@ -320,7 +320,7 @@ SUBROUTINE CALRAD_WCLOUD .or. iget(874) > 0 .or. iget(875) > 0 .or. iget(876) > 0 & .or. iget(877) > 0 .or. iget(878) > 0 .or. iget(879) > 0 & .or. iget(880) > 0 .or. iget(881) > 0 .or. iget(882) > 0 & - .or. post_abig16 .or. post_abig17 > 0 ) then + .or. post_abig16 .or. post_abig17 ) then ! specify numbers of cloud species ! Thompson==8, Ferrier==5,95, WSM6==6, Lin==2 diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index ac91e53a9..7dbfe4236 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -167,8 +167,8 @@ if(IntelComp) set(CMAKE_Fortran_8_FLAGS " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") else() - message("unkown compiler!") - exit() + set(CMAKE_Fortran_8_FLAGS " -ffree-form -O3 -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) + set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") endif() add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) @@ -176,7 +176,7 @@ add_library(${LIBNAME} ${EXE_SRC} ${EXE_C_SRC} ) set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) -set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS -qopenmp ) +set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS} ) message("hey, g2 inc is ${G2TMPL_INCd}") include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ${CMAKE_INSTALL_PREFIX}/include_4 ) target_link_libraries(${EXENAME} ${BACIO_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${SIGIO_LIB} ${NEMSIO_LIB} ${IP_LIB4} ${SFCIO_LIB} ${W3EMC_LIB4} ${ZLIB} ${G2TMPL_LIBd} ${G2_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIB4} ${CRTM_LIB} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIB4} ) From d45935257fb7366755700f5b2e32cab58aac093c Mon Sep 17 00:00:00 2001 From: Mark Potts Date: Mon, 25 Nov 2019 13:26:00 -0700 Subject: [PATCH 12/85] udpated cmake submodule --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 255ab8c7f..dc412e591 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 255ab8c7facee736c178feca97038ec5a92e7617 +Subproject commit dc412e59146c8a04cc87867d5ac1e16d7926d5f4 From 0fe6510ef780572e1c20c6b2ed6b7ce993ff1383 Mon Sep 17 00:00:00 2001 From: Tracy Date: Fri, 6 Dec 2019 15:42:41 -0700 Subject: [PATCH 13/85] Add RST file for UPP v4.0 --- docs/UPP_Users_guide_V4.rst | 1569 +++++++++++++++++++++++++++++++++++ 1 file changed, 1569 insertions(+) create mode 100644 docs/UPP_Users_guide_V4.rst diff --git a/docs/UPP_Users_guide_V4.rst b/docs/UPP_Users_guide_V4.rst new file mode 100644 index 000000000..3391db17c --- /dev/null +++ b/docs/UPP_Users_guide_V4.rst @@ -0,0 +1,1569 @@ +.. role:: math(raw) + :format: html latex +.. role:: bolditalic + :class: bolditalic + +====================================================== +User’s Guide for the NCEP Unified Post Processor (UPP) +====================================================== + +--------- +Version 4 +--------- + +*Acknowledgments:* + +*The adaptation of the original WRF Post Processor package and Users +Guide (by Mike Baldwin of NSSL/CIMMS and Hui-Ya Chuang of NCEP/EMC) was +done by Lígia Bernardet (NOAA/ESRL/DTC) in collaboration with Dusan +Jovic (NCEP/EMC), Robert Rozumalski (COMET), Wesley Ebisuzaki +(NWS/HQTR), and Louisa Nance (NCAR/RAL/DTC). Upgrades to WRF Post +Processor versions 2.2 and higher were performed by Hui-Ya Chuang, Dusan +Jovic and Mathew Pyle (NCEP/EMC). Transitioning of the documentation +from the WRF Post Processor to the Unified Post Processor was performed +by Nicole McKee (NCEP/EMC), Hui-ya Chuang (NCEP/EMC), and Jamie Wolff +(NCAR/RAL/DTC). Implementation of the Community Unified Post Processor +was performed by Tricia Slovacek and Kate Fossell (NCAR/RAL/DTC).* + +NCEP Unified Post Processor (UPP) +================================= + +UPP Introduction +================ + +The NCEP Unified Post Processor has replaced the WRF Post Processor +(WPP). The UPP software package is based on WPP but has enhanced +capabilities to post-process output from a variety of NWP models, +including WRF-NMM, WRF-ARW, Nonhydrostatic Multi-scale Model on the B +grid (NMMB), Global Forecast System (GFS), Climate Forecast System +(CFS), and the global Finite-Volume Cubed Sphere dynamical core (FV3). +At this time, community user support is only provided for the WRF-ARW +and FV3 systems. + +In addition to the option to output fields on the models native vertical +levels, UPP interpolates output from the models native grids to National +Weather Service (NWS) standard levels (pressure, height, etc.) and +standard output grids (AWIPS, Lambert Conformal, polar-stereographic, +etc.) in NWS and World Meteorological Organization (WMO) GRIB format. + +UPP incorporates the Joint Center for Satellite Data Assimilation +(JCSDA) Community Radiative Transfer Model (CRTM) to compute model +derived brightness temperature (TB) for various instruments and +channels. This additional feature enables the generation of a number of +simulated satellite products including GOES and AMSRE products for +WRF-NMM, Hurricane WRF (HWRF), WRF-ARW and GFS. For CRTM documentation, +refer to: + +http://www.dtcenter.org/upp/users/docs/user_guide/crtm_ug/CRTM_User_Guide.pdf. + +Software Installation/Getting Started +===================================== + +UPP Software Requirements +------------------------- + +The Community Unified Post Processor version 4 no longer requires users +to first build the WRF model. The WRF I/O libraries that UPP uses are +now included in the UPP build. + +Before installing the UPP code, it is necessary to ensure that you have +the required libraries available on your system. These libraries +include: + +- Unidata’s NetCDF library + + https://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html + +- The JasPer, PNG, and Zlib libraries, required with the release of + UPPv2.0 and higher, due to the addition of GRIB2 capabilities. NCEP + provides these necessary codes for download: + + http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/ + +- GNU M4 for UPPV4.0 only, which is used to build the WRF I/O libraries + now included in UPPV4.0. This is usually bundled with an operating + system or can be downloaded: + + https://www.gnu.org/software/m4/ + +The UPP has some sample visualization scripts included to create graphics using: + +- GrADS (http://cola.gmu.edu/grads/gadoc/gadoc.php) + +- GEMPAK (http://www.unidata.ucar.edu/software/gempak/index.html) + +**Note:** *These are not part of the UPP installation and need to be +installed separately if one would like to use either plotting package.* + +UPP has been tested on LINUX platforms (with PGI, Intel and GFORTRAN +compilers). + +Obtaining the UPP Code +---------------------- + +The UPP package can be downloaded from: + +http://www.dtcenter.org/upp/users/downloads/index.php + +**Note:** *Always obtain the latest version of the code if you +are not trying to continue a pre-existing project.* + +Once the *tar* file is obtained, *gunzip* and *untar* the file. + +*tar zxvf UPPV4.0.tar.gz* + +This command will create a directory called **UPPV4.0**. + +UPP Directory Structure +----------------------- + +Under the main directory of **UPPV4.0** reside seven subdirectories +(\* indicates directories that are created after the configuration +step): + +**arch**: Machine dependent configuration build scripts used to +construct *configure.upp* + +**bin**\*: Location of executables after compilation. + +**scripts**: contains sample running scripts to process *wrfout* and +*fv3* history files. + +- **run\_unipost**: run *unipost*. + +**include**\*: Source include modules built/used during compilation of +UPP + +**lib**\*: Archived libraries built/used by UPP + +**parm**: Contains the parameter files, which can be modified by the +user to control how the post processing is performed. + +**src**: Contains source codes for: + +- **copygb**: Source code for *copygb* + +- **ndate**: Source code for *ndate* + +- **unipost**: Source code for *unipost* + +- **lib**: Contains source code subdirectories for the UPP libraries + + - **bacio**: Binary I/O library + + - **crtm2**: Community Radiative Transfer Model library + + - **g2**: GRIB2 support library + + - **g2tmpl**: GRIB2 table support library + + - **gfsio**: GFS I/O routines + + - **ip**: General interpolation library (see *lib/ip/iplib.doc*) + + - **nemsio**: NEMS I/O routines + + - **sfcio**: API for performing I/O on the surface restart file of + the global spectral model + + - **sigio**: API for performing I/O on the sigma restart file of the + global spectral model + + - **sp**: Spectral transform library (see lib/sp/splib.doc) + + - **w3emc**: Library for coding and decoding data in GRIB1 format + + - **w3nco**: Library for coding and decoding data in GRIB1 format + + - **wrf\_io**: Library containing WRF I/O and netCDF interface code + + - **wrfmpi\_stubs**: Contains some *C* and *FORTRAN* codes + to generate *libmpi.a* library used to replace MPI calls for + serial compilation. + + - **xmlparse**: XML support GRIB2 parameter file + +Installing the UPP Code +----------------------- + +UPP uses a build mechanism similar to that used by the WRF model. An +environment variable to a compatible version of netCDF must be set +before beginning the installation. + +To reference the netCDF libraries, the configure script checks for an +environment variable (*NETCDF*) first, then the system default +(*/user/local/netcdf*), and then a user supplied link +(*./netcdf\_links*). If none of these resolve a path, the user will +be prompted by the configure script to supply a path. + +Type configure, and provide the required info. For example: + +*./configure* + +You will be given a list of choices for your computer. + +1. Linux x86\_64, PGI compiler (serial) + +2. Linux x86\_64, PGI compiler (dmpar) + +3. Linux x86\_64, Intel compiler (serial) + +4. Linux x86\_64, Intel compiler (dmpar) + +5. Linux x86\_64, Intel compiler, SGI MPT (serial) + +6. Linux x86\_64, Intel compiler, SGI MPT (dmpar) + +7. Linux x86\_64, gfortran compiler (serial) + +8. Linux x86\_64, gfortran compiler (dmpar) + +Choose one of the configure options listed. Check the +*configure.upp* file created and edit for compile options/paths, if +necessary. For debug flag settings, the configure script can be run with +a d switch or flag. + +To compile UPP, enter the following command: + +*./compile >& compile\_upp.log &* + +When compiling with distributed memory (serial) this command should +create 14 (15) UPP libraries in *UPPV3.2/lib/* (*libbacio.a*, +*libCRTM.a*, *libg2.a*, *libg2tmpl.a*, *libgfsio.a*, +*libip.a*, (*libmpi.a*), *libnemsio.a*, *libsfcio.a*, +*libsigio.a*, *libsp.a*, *libw3emc.a*, *libw3nco.a*, +*libwrfio\_nf.a*, *libxmlparse.a*) and three UPP executables in +**bin/** (*unipost.exe*, *ndate.exe*, and *copygb.exe*). + +To remove all built files, as well as the *configure.upp*, type: + +*./clean* + +This action is recommended if a mistake is made during the installation +process or a change is made to the configuration or build environment. +There is also a *clean -a* option which will revert back to a +pre-install configuration. + +UPP Functionalities +------------------- + +The UPP, + +- is compatible with WRF v3.7 and higher for Ferrier physics (UPPV3.0+) + or WRF v3.5 and higer (UPPV2.1). + +- can be used to post-process WRF-ARW, WRF-NMM, NMMB, GFS, CFS, and FV3 + forecasts (community support only provided for WRF-ARW and global FV3 + forecasts). + +- can ingest WRF history files (wrfout\*) in netCDF format. + +- can ingest FV3 history files (dyn\*/phy\* or gfs\*) in binarynemsio + format. + +The UPP is divided into two parts: + +#. **Unipost** + + - Interpolates the forecasts from the models native vertical + coordinate to NWS standard output levels (e.g., pressure, height) + and computes mean sea level pressure. If the requested parameter + is on a models native level, then no vertical interpolation is + performed. + + - Computes diagnostic output quantities (e.g., convective available + potential energy, helicity, relative humidity). A full list of + fields that can be generated by *unipost* is provided for + https://dtcenter.org/upp/users/docs/tables/UPP_GRIB1_Table.pdf and + https://dtcenter.org/upp/users/docs/tables/UPP_GRIB2_Table.pdf. + + - Outputs the results in NWS and WMO standard GRIB1 or GRIB2 format + (for GRIB documentation, see + http://www.nco.ncep.noaa.gov/pmb/docs/). + + - FV3 only available for GRIB2 output. + + - Destaggers the WRF-ARW forecasts from a C-grid to an A-grid. + + - Except for new capabilities of post processing GFS/CFS and + additions of many new variables, UPP uses the same algorithms to + derive most existing variables as were used in WPP. The only three + exceptions/changes from the WPP are: + + - Computes RH w.r.t. ice for GFS, but w.r.t. water for all other + supported models. WPP computed RH w.r.t. water only. + + - The height and wind speed at the maximum wind level is computed + by assuming the wind speed varies quadratically in height in + the location of the maximum wind level. The WPP defined maximum + wind level at the level with the maximum wind speed among all + model levels. The static tropopause level is obtained by + finding the lowest level that has a temperature lapse rate of + less than 2 K/km over a 2 km depth above it. The WPP defined + the tropopause by finding the lowest level that has a mean UPP + V3: Users Guide 8 temperature lapse rate of 2 K/km over three + model layers. + +#. **Copygb** + + - Interpolates the forecasts horizontally from their native grid to + a standard AWIPS or user-defined grid (for information on AWIPS + grids, see + http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html). + + - Outputs the results in NWS and WMO standard GRIB1 format (for GRIB + documentation, see http://www.nco.ncep.noaa.gov/pmb/docs/). + + **Note** *: Copygb only works with GRIB1 format; for GRIB2, use + wgrib2. (for downloading the source code and information on compiling + on your system, see:* + +In addition to *unipost* and *copygb*, a utility called +*ndate* is distributed with the UPP tarfile. This utility is used to +format the dates of the forecasts to be posted for ingestion by the +codes. + +Setting up the WRF or FV3 model to interface with UPP +----------------------------------------------------- + +The unipost program is currently set up to read a large number of fields +from the WRF and FV3 model history files. This configuration stems from +NCEP’s need to generate all of its required operational products. When +using the netCDF or NEMS binary read, this program is configured such +that it will run successfully even if an expected input field is missing +from the WRF or FV3 history file as long as this field is not required +to produce a requested output field. If the pre-requisites for a +requested output field are missing from the WRF or FV3 history file, +unipost will abort at run time. + +Take care not to remove fields from the wrfout or gfs files, which may +be needed for diagnostic purposes by the UPP package. For example, if +isobaric state fields are requested, but the pressure fields on model +interfaces (i.e. P\_HYD for WRF-ARW) are not available in the history +file, unipost will abort at run time. In general, the default fields +available in the wrfout or gfs files are sufficient to run UPP. The +fields written to the WRF history file are controlled by the settings in +the Registry . For WRF, see the Registry.EM, Registry.EM\_COMMON files +in the Registry subdirectory of the main WRFV4 directory. + +**Note** + +UPP is written to process a single forecast hour, therefore, having a +single forecast per output file is optimal. However, for WRF based +forecasts, UPP can be run across multiple forecast times in a single +output file to extract a specified forecast hour. + +UPP Control File Overview +========================= + +GRIB1 control file +------------------ + +**Note** + +The user interacts with unipost through the control file, +*parm/wrf\_cntrl.parm* for WRF runs. + +The control file is composed of a header and a body. The header +specifies the output file information. The body allows the user to +select which fields and levels to process. + +The header of the ***wrf\_cntrl.parm*** file contains the following +variables: + +- **KGTYPE**: defines output grid type, which should always be 255. + +- **IMDLTY**: identifies the process ID for AWIPS. + +- **DATSET**: defines the prefix used for the output file name. + Currently set to WRFPRS. Note: the run\_\* scripts assume WRFPRS is + used for WRF runs. + +The body of the *wrf\_cntrl.parm* file is composed of a series of +line pairs similar to the following: + +(PRESS ON MDL SFCS ) SCAL=( 3.0) + +L=(11000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 +00000 00000 00000) + +where, + +- The top line specifies the variable (e.g. PRESS) to process, the + level type (e.g. ON MDL SFCS) a user is interested in, and the degree + of accuracy to be retained (SCAL=3.0) in the GRIB output. + + - SCAL defines the precision of the data written out to the GRIB + format. Positive values denote decimal scaling (maintain that + number of significant digits), while negative values describe + binary scaling (precise to 2^{SCAL}; i.e., SCAL=-3.0 gives output + precise to the nearest 1/8). Because **copygb** is unable to + handle binary precision at this time, negative numbers are + discouraged. + + - A list of all possible output fields for **unipost** is provided + in the GRIB1 output table + https://dtcenter.org/upp/users/docs/tables/UPP_GRIB1_Table.pdf. + This table provides the full name of the variable in the first + column and an abbreviated name in the second column. The + abbreviated names are used in the control file. Note that the + variable names also contain the type of level on which they are + output. For instance, temperature is available on model surface + and pressure surface. + +- The second line specifies the levels on which the variable is to be + posted. In this case, 0 indicates no output at this level and 1 + indicates output the variable specified on the top line at the level + specified by the position of the digit and the type of level defined + for this variable. For flight/wind energy fields, a 2 may be + specified, such that 2 requests AGL and 1 requests MSL. + +Controlling which variables unipost outputs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To output a field, the body of the control file needs to contain an +entry for the appropriate variable and output for this variable must be +turned on for at least one level (see next section: *Controlling which +levels unipost outputs*). If an entry for a particular field is not yet +available in the control file, two lines may be added to the control +file with the appropriate entries for that field. + +Controlling which levels unipost outputs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The second line of each pair determines which levels unipost will +output. Output on a given level is turned off by a 0 or turned on by a +1. + +- For isobaric output, 46 levels are possible, from 2 to 1000 hPa (*2, + 5, 7, 10, 20, 30, 50, 70 mb and then every 25 mb from 75 to 1000 + mb*). The complete list of levels is specified in + *src/unipost/CTLBLK.f*. + + - Modify specification of variable LSMDEF to change the number of + pressure levels: LSMDEF=47 + + - Modify specification of SPLDEF array to change the values of + pressure levels: (/200.,500.,700.,1000.,2000.,3000. + &,5000.,7000.,7500.,10000.,12500.,15000.,17500.,20000., …/) + +- For model-level output, all model levels are possible, from the + highest to the lowest. + +- When using the Noah LSM, the soil layers are 0-10 cm, 10-40 cm, + 40-100 cm, and 100-200 cm. + +- When using the RUC LSM, the soil levels are 0 cm, 1 cm, 4 cm, 10 cm, + 30 cm, 60 cm, 100 cm, 160 cm, and 300 cm. For the RUC LSM, it is also + necessary to turn on five additional output levels in the + *wrf\_cntrl.parm* to output 9 instead of 4. (For the old RUC LSM, + there are only 6 layers and if using this, you will need to change + “RUC LSM” from 9 to 6 in the WRFPOST.f routine.) + +- When using Pliem-Xiu LSM, there are two layers: 0-1 cm, 1-100 cm + +- For low, mid, and high cloud layers, the layers are :math:`\geq`\ 642 + hPa, :math:`\geq`\ 350 hPa, and <350 hPa, respectively. + +- For PBL layer averages, the levels correspond to 6 layers with a + thickness of 30 hPa each. + +- For flight level, the levels are 30 m, 50 m, 80 m, 100 m, 305 m, 457 + m, 610 m, 914 m, 1524 m, 1829 m, 2134 m, 2743 m, 3658 m, 4572 m, 6000 + m, 7010 m. + +- For AGL radar reflectivity, the levels are 4000 and 1000 m (see + Appendix A for details). + +- For surface or shelter-level output, only the first position of the + line needs to be turned on. + + - For example, the sample control file *parm/wrf\_cntrl.parm* + has the following entry for surface dew point temperature: + + (SURFACE DEWPOINT ) SCAL=( 4.0) + + L=(00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 + 00000 00000 00000 00000) + + Based on this entry, surface dew point temperature will not be + output by unipost. To add this field to the output, modify the + entry to read: + + (SURFACE DEWPOINT ) SCAL=( 4.0) + + L=(10000 00000 00000 00000 00000 00000 00000 00000 00000 00000 + 00000 00000 00000 00000) + +GRIB2 control file +------------------ + +**Note** *: This section describes the control file for outputting +GRIB2 format.* + +Version 3.0 +~~~~~~~~~~~ + +- The xml file **parm/postcntrl.xml** replaces the **wrf\_cntrl.parm** + file to declare which fields you want to output from UPP. The samples + in **parm/wrfcnrtl.xml** are not exhaustive at this time and is + provided as a template only. Note that it will require edits by the + user to expand beyond the basic testing setup. + +- A list of available GRIB2 fields is in **parm/post\_avblflds.xml**. + UPP uses this file to define certain field parameters. Users may look + in this file to view a full list of available GRIB2 fields. Again, as + new fields are added or modified they will be provided. + +- To run grib2, copy a xml template to be named *postcntrl.xml* in + the *DOMAINPATH/parm/* directory as outlined below. Edit the xml + file as needed. + +Version 3.1 and Onward +~~~~~~~~~~~~~~~~~~~~~~ + +- For outputting GRIB2 format using version 3.1, a preprocessing step + is required by the user to convert the xml file + *parm/postcntrl.xml* to a flat text file + *postxconfig-NT.txt*. This new flat file is quicker to process + than the old xml file. The user will still need to edit the + *postcntrl.xml* file to declare which fields are to be output + from UPP. + +- In order to ensure that the user-edited xml files are error free, XML + stylesheets (*parm/EMC\_POST\_CTRL\_Schema.xsd* and + *EMC\_POST\_Avblflds\_Schema.xsd*) are used to validate both the + *postcntrl.xml* and *post\_avblflds.xml* files, respectively. + Confirmation of validation will be given (e.g. postcntrl.xml + validates) or otherwise return errors if it does not match the + schema. To run the validation: + + *xmllint --noout --schema EMC\_POST\_CTRL\_Schema.xsd + postcntrl.xml* + + *xmllint --noout --schema EMC\_POST\_Avblflds\_Schema.xsd + post\_avblflds.xml* + +- Once the xmls are validated, the user will need to generate the flat + file. Edit the *parm/makefile* if necessary to point to the + correct flat file directory and xmls. The makefile will call the perl + program *parm/POSTXMLPreprocessor.pl* to generate the post flat + file *postxconfig-NT.txt*. Generate the flat file: + + *make* + + **Note**\ *: The new flat file can only be used for running version + 3.1 and onward and is not backwards compatible with version 3.0.* + +Running UPP +=========== + +Seven scripts for running the UPP package are included in the tar file: + +**run\_unipost** + +**run\_unipostandgrads** + +**run\_unipostandgempak** + +**run\_unipost\_frames** + +**run\_unipost\_gracet** + +**run\_unipost\_minute** + +**run\_unipostandgrads\_global** + +#. *cd* to your *DOMAINPATH* directory. + +#. Make a directory to put the UPP results. + + *mkdir postprd* + +#. Make a directory to put a copy of *wrf\_cntrl.parm* file if + running grib1. If running grib2 copy *postcntrl.xml* for v3.0 or + *postxconfig-NT.txt* for v3.1+. + + *mkdir parm* + +#. Copy over the relevant control file to your working directory to + customize *unipost* + + For Grib1, copy the default *UPPV4.0/parm/wrf\_cntrl.parm* file. + + For Grib2, copy a template *UPPV3.0/parm/wrfcntrl.xml* if using + v3.0 or *UPPV4.0/parm/postxconfig-NT-WRF.txt* if using v3.1+. For + v4.0, a template *UPPV4.0/parm/postxconfig-NT-GFS.txt* **for FV3 + can be used.** + +#. Edit the *wrf\_cntrl.parm* file to reflect the fields and levels + you want unipost to output. (For Grib2: Edit the *postcntrl.xml* + file for v3.0 or the *postxconfigNT.txt* file for v3.1+) + +#. Copy over the (*UPPV4.0/scripts/run\_unipost*\*) script of your + choice to the *postprd/*. + +#. Edit the run script as outlined below. Once these directories are set + up and the edits outlined below are complete, the scripts can be run + interactively from the *postprd* directory by simply typing the + script name on the command line. + +Overview of the scripts to run the UPP +-------------------------------------- + +**Note** *: It is recommended that the user refer to the +run\_unipost scripts in the script* + +Since V3.0, user modified variables are now all contained at the top of +the *run\_unipost* script in one user-edit section, along with a +brief description. Descriptions below follow the *run\_unipost* +script. + +#. Set up basic path variables: + + **TOP\_DIR** : Top level directory for source code (*UPPV4.0*) + + **DOMAINPATH** : Working directory for this run + + **UNIPOST\_HOME** : Location of the *UPPV4.0* build directory + + **POSTEXEC** : Location of the *UPPV4.0* executables + + **modelDataPath** : Location of the model output data files to be + processed (e.g. *wrfprd/* for WRF-based runs). + + **paramFile** : Name and location of cntrl.parm + (*wrf\_cntrl.parm*) text file that lists desired fields for GRIB1 + output. Template in *UPPV4.0/parm/* + + **txtCntrlFile** : Name and location of *postxconfig-NT.txt* + file that lists desired fields for GRIB2 format for version 3.1+. + This file is generated by the user following the steps listed above + in the GRIB2 Control File section. + + **Note** *: For WRF, the scripts are configured such that + unipost expects the WRF history files (wrfout + files) to be in wrfprd/, the wrf\_cntrl.parm + (postcntrl.xml or postxconfig-NT.txt) file to be + in parm/ and the postprocessor working directory to be + called postprd/, all under DOMAINPATH* + + This set up is for user convenience to have a script ready to run, + paths may be modified but be sure to check the run script to make + sure settings are correct. + +#. Specify dynamic core being run (ARW or FV3) + + **dyncore** : What model core is used (ARW or FV3) + +#. Specify the format for the input model files and output UPP files. + + **inFormat** : Format of the model data + + arw netcdf + + fv3 binarynemsio + + **outFormat** : Format of output from UPP + + grib + + grib2 + +#. Specify the forecast cycles to be post-processed + + **startdate** : Forecast start date (YYYYMMDDHH) + + **fhr** : First forecast hour to be post-processed + + **lastfhr** : Last forecast hour to be post-processed + + **incrementhr** : Increment (in hours) between forecast files + + Do not set to 0 or the script will loop continuously + +#. Set up how many domains will be post-processed + + **domain\_list** : List of domains for run (e.g. d01 d02) + +#. Set/uncomment the run command for your system. (i.e. serial, mpirun, + etc). + + **RUN\_COMMAND** : System run command for serial or parallel runs + + - The default execution command in the distributed scripts is for a + single processor: + + *./unipost.exe > unipost\_${domain}.${fhr}.out 2>&1* + + - To run unipost using mpi (dmpar compilation), the command line + should be: + + >> LINUX-MPI systems: *mpirun -np N unipost.exe > outpost + 2>&1* + + (**Note** *: on some systems a host file also needs to be + specified: machinefile host*) + + >> IBM: *mpirun.lsf unipost.exe < itag > outpost* + + >> SGI MPT: *mpiexec\_mpt* + +#. Set copygb grid definitions (optional - uncomment copygb section in + script to run) + + - copygb\_opt : Copygb grid option to regrid + + awips = Use a predefined awips grid, e.g. 212 \*\* Uncomment + export awips\_id= and add desired grid number. + + custom = Specify your own grid \*\* Uncomment export custom\_gds= + and add grid description. + + **Note** *: More information about copygb is provided + below under Examples of copygb. Copygb runs on + GRIB1 format only. For GRIB2 format, wgrib2 is required, with + more information provided below under "Examples of wgrib2"* + +#. Set naming convention for prefix and extension of output file name + + - **comsp** is the initial string of the output file name (by + default it is not set and the prefix of the output file will be + the string set in *wrf\_cntrl.parm DATSET*, if set it + will concatenate the setting to the front of the string specified + in *wrf\_cntrl.parm DATSET* + + - **tmmark** is used for the file extension (in + *run\_unipost*, *tmmark=tm00*, if not set, it is set to .GrbF) + +Since V3.0, the itag that will be read in by *unipost.exe* from +stdin (unit 5) is generated automatically in the *run\_unipost* +script based on the user-defined options above. It should not be +necessary to edit this. For description purposes, the namelist +(*itag*) contains 5 (6) lines for WRF (FV3): + +#. Name of the WRF or FV3 (pressure level) output file to be posted. + +#. Format of WRF or FV3 model output (netcdf, binarynemsio). + +#. Format of UPP output (GRIB1 or GRIB2) + +#. Forecast valid time (not model start time) in WRF or FV3 format (the + forecast time desired to be post-processed). + +#. Dynamic core used (NCAR or GFS). + +#. Name of the FV3 (surface) output file to be post-processed. + +**Note:** *If the third line (i.e., UPP output type) is not set, UPP will default the output le format to grib1. +This is only for WRF since UPP output for FV3 only supports GRIB2.* + +If scripts *run\_unipostandgrads* or *run\_unipostandgempak* are +used, additional steps are taken to create image files (see +Visualization section below). + +Upon a successful run, *unipost* and *copygb* (optional) will +generate output files *WRFPRS\_dnn.hh* (*GFSPRS.hh*) and +*wrfprs\_dnn.hh* (*gfsprs.hh*), respectively, in the +postprocessor working directory, where *nn* refers to the domain id and +*hh* denotes the forecast hour. In addition, the script +*run\_unipostandgrads* will produce a suite of png images named +*variablehh\_GrADS.png*, and the script *run\_unipostandgempak* +will produce a suite of gif images named *variablehh.gif*. + +If the run did not complete successfully, a log file in the +post-processor working directory called *unipost\_dnn.hh.out* +(*unipost.hh.out*), where *nn* is the domain id and *hh* is the +forecast hour, may be consulted for further information. + +Examples of copygb +================== + +Sample command line for calling copygb: + + *copygb.exe -xg"grid [kgds]" input\_file output\_file* + +where *grid* refers to the output grid to which the native forecast +is being interpolated. + +The output grid can be specified in three ways: + +#. As the grid id of a pre-defined AWIPS grid number (gridno): + + *copygb.exe -g${gridno} -x input\_file output\_file + + For example, using grid 218: + + *copygb.exe -xg"218" WRFPRS_$domain.${fhr} wrfprs\_$domain.${fhr} + +#. As a user defined standard grid, such as for grid 255: + + *copygb.exe xg"255 kgds" input\_file output\_file* + + where the user defined grid is specified by a full set of kgds + parameters determining a GRIB GDS (grid description section) in the + *W3fi63* format. Details on how to specify the kgds parameters + are documented in file *lib/w3lib/w3fi71.f*. For example: + + *copygb.exe -xg" 255 3 109 91 37719 -77645 8 -71000 10433 9966 0 64 42000 42000" + WRFPRS\_$domain.${fhr} wrfprs\_$domain.${fhr}* + +#. From a file: When WRF-ARW output is processed by *unipost*, a + text file, *copygb\_hwrf.txt*, is created. This file contain the + GRID GDS of a lat/lon grid similar in domain and grid spacing to the + one used to run the WRF-ARW model. The contents of this file can be + read into the variable “nav” and can be used as input to + *copygb.exe*. + + *copygb.exe -xg"$nav" input\_file output\_file* + + For example, when using *copygb\_hwrf.txt* for an application, + the steps include: + + *read nav < ’copygb\_hwrf.txt’* + + *export nav* + + *copygb.exe -xg"${nav}" WRFPRS\_$domain.${fhr}* + + *wrfprs\_$domain.${fhr}* + +It should be noted that copygb is a flexible program that can accept +several command line options specifying details of how the horizontal +interpolation from the native grid to the output grid should be +performed. Complete documentation of copygb can be found at: + +http://www.dtcenter.org/met/users/support/online_tutorial/METv5.0/copygb/copygb.txt + +Examples of wgrib2 +================== + +*Wgrib2* is a versatile program that has the ability to convert +grib2 files from one grid to another for various user-defined grids as +well as pre-defined NCEP grids. Complete documentation with examples of +re-gridding for all available grid definitions can be found at: + +http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/new_grid.html. + +Sample command line usage for calling wgrib2: + + *wgrib2 -new\_grid\_winds W -new\_grid A B C outfile* + +Where, + +**W** = earth or grid + + earth: winds oriented to the earths north and south directions + + grid: winds are rotated so that north is relative to the grid + +**A**, **B**, and **C** represent the output grid description + +Sample lat-lon grid description: + +**A** = latlon + +**B** = lon0:nlon:dlon + + lon0 is longitude of first grid point in degrees + + nlon is number of longitudes + + dlon is grid resolution in degrees of longitude + +**C** = lat0:nlat:dlat + + lat0 is latitude of first grid point + + nlat is number of latitudes + + dlat is grid resolution in degrees of latitude + +**Note:** *At this time, wgrib2 is not distributed within the UPP tar +file. Users may download and install from +http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/.* + +Visualization with UPP +====================== + +GEMPAK +------- + +The GEMPAK utility *nagrib* is able to decode GRIB files whose +navigation is on any non-staggered grid. Hence, GEMPAK is able to decode +GRIB files generated by the UPP package and plot horizontal fields or +vertical cross sections. + +A sample script named *run\_unipostandgempak*, which is included in +the scripts directory of the tar file, can be used to run *unipost*, +*copygb*, and plot the following fields using GEMPAK: + +- **Sfcmap\_dnn\_hh.gif**: mean SLP and 6 hourly precipitation + +- **PrecipType\_dnn\_hh.gif**: precipitation type (just snow and + rain) + +- **850mbRH\_dnn\_hh.gif**: 850 mb relative humidity + +- **850mbTempandWind\_dnn\_hh.gif**: 850 mb temperature and wind + vectors + +- **500mbHandVort\_dnn\_hh.gif**: 500 mb geopotential height and + vorticity + +- **250mbWindandH\_dnn\_hh.gif**: 250 mb wind speed isotacs and + geopotential height + +This script can be modified to customize fields for output. GEMPAK has +an online users guide at: + +http://www.unidata.ucar.edu/software/gempak/help_and_documentation/manual/. + +In order to use the script *run\_unipostandgempak*, it is necessary +to set the environment variable *GEMEXEC* to the path of the GEMPAK +executables. For example, + + *setenv GEMEXEC /usr/local/gempak/bin* + +GrADS +----- + +The GrADS utilities *grib2ctl.pl* (*g2ctl.pl*) and *gribmap* +are able to decode GRIB1 (GRIB2) files whose navigation is on any +non-staggered grid. These utilities and instructions on how to use them +to generate GrADS control files are available from: + +http://www.cpc.ncep.noaa.gov/products/wesley/grib2ctl.html (GRIB1) + +http://www.cpc.ncep.noaa.gov/products/wesley/g2ctl.html (GRIB2). + +The GrADS package is available from: +http://cola.gmu.edu/grads/gadoc/gadoc.php. + +GrADS has an online Users Guide at: +http://cola.gmu.edu/grads/gadoc/users.html + +A list of basic commands for GrADS can be found at: +http://cola.gmu.edu/grads/gadoc/reference_card.pdf. + +A sample script named *run\_unipostandgrads*, which is included in +the scripts directory of the Unified Post Processing package, can be +used to run *unipost*, *copygb*, and plot the following fields +using GrADS: + +- **Sfcmaphh\_dnn\_GRADS.png**: mean SLP and 6-hour accumulated + precipitation. + +- **850mbRHhh\_dnn\_GRADS.png**: 850 mb relative humidity + +- **850mbTempandWindhh\_dnn\_GRADS.png**: 850 mb temperature and wind + vectors + +- **500mbHandVorthh\_dnn\_GRADS.png**: 500 mb geopotential heights + and absolute vorticity + +- **250mbWindandHhh\_dnn\_GRADS.png**: 250 mb wind speed isotacs and + geopotential heights + +In order to use the script *run\_unipostandgrads*, it is necessary +to: + +#. Set the environmental variable GADDIR to the path of the GrADS fonts + and auxiliary files. For example: + + *setenv GADDIR /usr/local/grads/data* + +#. Add the location of the GrADS executables to the PATH. For example: + + *setenv PATH /usr/local/grads/bin:$PATH* + +#. Link script *cbar.gs* to the post-processor working directory. + (This scripts is provided in UPP package, and the + *run\_unipostandgrads* script makes a link from *scripts/* to + *postprd/*.) To generate the plots above, GrADS script + *cbar.gs* is invoked. This script can also be obtained from the + GrADS library of scripts at + http://cola.gmu.edu/grads/gadoc/library.html. + +Fields produced by unipost +========================== + +The 3 tables described below contain documentation regarding the fields +that are available for output by UPP for both GRIB1 and GRIB2. + +Grib1 Table: +------------ + +https://dtcenter.org/upp/users/docs/tables/UPP_GRIB1_Table.pdf + +This table lists basic and derived fields currently produced by unipost +for grib1. The abbreviated names listed in the second column of each +table describe how the fields should be entered in the +*wrf\_cntrl.parm*. + +Grib2 Table: +------------ + +https://dtcenter.org/upp/users/docs/tables/UPP_GRIB2_Table.pdf + +This table lists basic and derived fields currently produced by unipost +for grib2. The abbreviated names listed in the second column of each +table describe how the fields should be entered in the +*post\_cntrl.xml*. + +Grib2 Table (Extended): +----------------------- + +https://dtcenter.org/upp/users/docs/tables/UPP_GRIB2_Extended_Table.pdf + +This table lists basic and derived fields currently produced by +*unipost* for grib2 and includes the parameter information which UPP +uses for identifying fields for GRIB2. + +Appendix A: UPPV3.1+ Reflectivity field descriptions +==================================================== + +Reflectivities are filled/computed depending on the model core and +microphysics options. + +UPP uses model derived reflectivity (REFL\_10CM from WRF) for model runs +using the Thompson microphysics option (mp=8). Other combinations use +algorithms within UPP code. + +Work is underway to provide more user flexibility when selecting +reflectivity computations. For more information on model computed +reflectivity, e.g. REFL\_10CM, please see model documentation. + +Relevant routines for reflectivity. Some or all of these may need to be +modified if the user desires to change where/how reflectivity is +processed. It is recommended that the user have knowledge of the model +output and reflectivity computations before trying to modify the UPP +code. Email `upp-help@ucar.edu `__ for further questions. + +**INITPOST**\* - Separate routines for each different model core (e.g. +ARW, FV3, etc.). Reads model fields, e.g. REFL\_10CM, REFD\_MAX + +**MDLFLD.f** - Computes DBZ or fills DBZ arrays with model computed +Reflectivity. - Fills 3-D model level reflectivity array (UPP ID: 250) - +Fills 2-D composite reflectivity array (UPP ID: 252) + +**MDL2AGL.f** - Interpolates relevant DBZ array to AGL reflectivity +(UPP ID: 253) - Outputs model computed maximum hourly reflectivity +(REFD\_MAX; UPP ID: 421) + +**MDL2P.f** - Interpolates relevant DBZ array to pressure levels (UPP +ID: 251) + +Appendix B: Adding a new variable to the UPP code +================================================= + +*This document provides general procedures and an example of how to add +a new variable to the UPP code. Please keep in mind it may not be an +exhaustive step-by-step depending on your particular situation. While we +can provide general assistance for adding a new variable, users should +be aware that this requires good knowledge of Fortran and thorough +understanding of the code.* + +*We encourage users to contact us at upp-help@ucar.edu to make us aware +of modifications you are making. In some cases, if we determine the +changes you are making may be relevant for operational and/or community +purposes, we will be interested in incorporating your changes into the +code base for support and future release. We would then work with you to +make this possible.* + +**** + +#. Allocate the field: ALLOCATE.f + + *This file is the instantiation or allocation of the* **variable** + +#. Deallocate the field: DEALLOCATE.f + +#. Declare the new variable: VRBLS2D\_mod.f, VRBLS3D\_mod.f or + VRBLS4D\_mod.f + +#. Define field for grib1: RQSTFLD.f + +#. Read model output: INITPOST.F + +#. Determine routine for filling variable: e.g SURFCE.f, MDLFLD.f, + MDL2P.f, etc. + +#. Define table/grib2 parameters/ for grib2 output: + params\_grib2\_tbl\_new + +#. Define the field for grib2 output: post\_avlbflds.xml + +#. Define control file entry for output: postcntrl.xml & + postxconfig-NT.txt + +#. Define output control file: wrf\_cntrl.parm + + *This file is used for controlling which fields are output by UPP for + grib1.* + +**** + +- This example illustrates a new variable from the WRF output that will + be read into UPP and directly output into the grib output files (i.e. + no additional computations/calculations are needed for the field). + +- Note that while grib1 procedures are provided, we have moved to grib2 + almost exclusively. As such support for grib1 additions is limited. + +- Additions to each of the routines are highlighted in ````. + +- Locations of **** are in /UPPV3.2/src/unipost unless specified + otherwise. + +- A sample wrfout file for the following procedures is available for + download from: + + - https://dtcenter.org/upp/users/downloads/data/AddNewVariableData.tar.gz + + - This data is the 6-hr forecast of a WRF initialization of + 2009-12-17\_12:00:00 + +**** + +```` + +```` + +```` + +```` + +```` + +```` + +```` + +#. Allocate the new variable in **** This file is the instantiation or + allocation of the variable. Note that the variables are defined based + on the parallel processing capability of UPP - use an example from + the file. + + **** + + - Add in VRBLS2D section as: + + ````\ **** + +#. De-allocate the variable to give the resources back in **** All good + programmers give back their resources when they are done. Please + update this routine to return your resource to the system. + + **** + + - Add as: + + ````\ **** + +#. Declare the new variable in the appropriate file depending on its + dimensions; ****, **** or **** + + **** + + - **** is a 2-dimensional field, so declare it in **** + + - Add to the end of the first section of allocations as: + + ````\ **** + +#. List the new variable in **** which includes a list of all possible + fields to be output by UPP, as well as the corresponding key-word + character string the user places in **** file, the UPP ID for + internal code, and grib IDs. Be sure to pick a unique identifier that + is not already used for the new variable. The unique identifier or + index are typically assigned in groups - hopefully a community area + will be added in the future - or a defined method to avoid + overwriting others values. Right now we are using 900’s for community + contributions. + + **** + + ``! HWRF addition for v_flux as pass through variable:`` + + ``DATA ``\ ````\ ``(``\ ````\ ``),``\ ````\ ``(``\ ````\ ``),``\ ````\ ``(``\ ````\ ``),``\ ````\ ``(``\ ````\ ``),``\ ````\ ``(``\ ````\ ``) &`` + + ````\ ````\ ``,’``\ ````\ ``,``\ ````\ ``,``\ ````\ ``, &`` + + ````\ ````\ ``/`` + + Where: + + - **** + + - **** + + - **** + + - **** + + - **** + + - **** + + **** + + - A latent heat flux variable (LHTFL) was found in the GRIB1 + parameter tables, so add a new unused parameter number (237) using + Table 130 to define the new field. + + http://www.nco.ncep.noaa.gov/pmb/docs/on388/table2.html + + - Used level type surface, which is 001 + + http://www.nco.ncep.noaa.gov/pmb/docs/on388/table3.html + + - Add as: + + ```` + + ```` + + ````\ **** + +#. Read the model output field from the wrfout file by adding the new + variable into **** This file is used for reading the WRF-ARW model + output files in netcdf format. + + **** + + - Add using the 2D variable **** (snowfall accumulation), which is + also a 2D surface based accumulation field, as a template by + following it through the routine. + + - Add to top section of the routine in use vrbls2d to initiate the + new variable as: + + ```` + + - Read in the new variable as: + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + +#. Determine the correct routine to add the new variable to (e.g. ****, + ****, ****, etc). You will need to determine the correct routine to + add your field into; this is the place that you will fill the array + with the data and call gribit to output the field. The correct + routine will depend on what your field is. For example, if you have a + new diagnostic called foo, and you want it interpolated to pressure + levels, you would need to add it to ****. If foo was only a surface + variable, you would add it to ****. If you wanted foo on native model + levels, you would add it to ****. If youre not sure which routine to + add the new variable to, choose a similar variable as a template. + + *Note:* This is also where you would add any calculations needed for + your new variable, should it be required. + + **** + + - Treat ACLHF like a surface field (****) + + - Using the variable **** (accumulated depth of snowfall) as a + template which is also an accumulated field that is just being + read through and output, similar to what we want. + + - Add in top section in use vrbls2d, only to initiate the new + variable as: + + ```` + + - Add in main section using the template variable as a guide. + + - Note that ID(02), which is the ID for table version number, is + added and set to 130. This is the table that we are adding the + new variable to. + + - The block of code in ```` is for metadata for the accumulation + field being added in this example and the user does not need to + edit it and it is not always needed. For example, for an + instantaneous field, you would not need that block. + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + +#. For grib2 output, add the new variable to + /UPPV3.2/src/lib/g2tmpl/****. For all current UPP output fields, this + table lists, in order, the: + + - Discipline + (http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table0-0.shtml) + + - Category + (http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-1.shtml) + + - Parameter Number + (http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-2.shtml) + + - Table information (0 for parameters from the WMO table; 1 for + parameters from the local NCEP table) + + - Abbreviated Variable Name (from the parameters table) + + **** + + - Since there is already a latent heat flux (LHTFL) parameter in + this table, create a new Latent Heat Flux parameter so as to not + overwrite the current one, just in case you want both to be output + + - Latent heat flux is a meteorological field (discipline=0) + + - Latent heat flux is a temperature product (category=0) + + - Pick an unused parameter number from the table defined by + discipline=0 and category=0 (Table 4.2-0-0: + http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-2-0-0.shtml). + In this case, the unused parameter number 205 was chosen. + + - Add using the NCEP local table (table=1) + + - Choose an abbreviated parameter name to describe your field (e.g. + ACLHF) + + - Add as: + + ```` + +#. Add the new variable to the /UPPV3.2/parm/****, which lists all + fields available for output in GRIB2 format. + + - Post\_avblfldidx: the unique array number given in the RQSTFLD.f + routine. + + - Shortname: name describing the variable and level type + + - Pname: the abbreviation for your variable + + - Table info: table used if not standard WMO + + - Fixed\_sfc1\_type: level type + + - Scale: precision of data written out to grib2 file + + **** + + - Add as: + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + + ```` + +#. Add the new variable to the /UPPV3.2/parm/****, which lists all + fields and levels you wish to output for GRIB2. Remake the + /UPPV3.2/parm/**** file, which contains the information from the xml + that UPP reads. + + - See the Users guide on steps for creating the text control file + + **** + + - Add as: + + ```` + + ```` + + ```` + + ```` + + ```` + +#. Add the new variable to the /UPPV3.2/parm/**** file, which lists all + fields and levels you wish to output for GRIB1. + + **** + + - Add as: + + ```` + + ```` + + \*\* Note the first entry is turned from 0 to 1. This turns on the + first level. + +#. Run clean on the code and recompile the code to include the changes + before running your UPP run script. + + **** + +#. Assuming the modified code compiled successfully and you were able to + produce grib output, you can check the grib file for your new + variable. + + **** output of the new variable from this example procedure (using + the wgrib2 utility if available on your system). + + - The new variable will not be defined by the variable name. Instead + it will be defined using the grib2 parameter information you + entered into **** from step 7 of this procedure. + + ``456:43204412:vt=2009121718:``\ ````\ ``:6 hour fcst:var ``\ ````\ `` center=7 ``\ ````\ `` ``\ ````\ ``:`` + + ``ndata=121002:undef=0:mean=1.97108e+06:min=-1.12e+06:max=2.406e+07`` + + ``grid_template=30:winds(grid):`` + + ``Lambert Conformal: (402 x 301) input WE:SN output WE:SN res 8`` + + ``Lat1 14.807213 Lon1 231.818604 LoV 258.040009`` + + ``LatD 38.270000 Latin1 38.270000 Latin2 38.270000`` + + ``LatSP 0.000000 LonSP 0.000000`` + + **** output of the new variable from this example procedure (using + the wgrib utility if available on your system). + + - The new variable will not be defined by the variable name. Instead + it is defined by ```` (grib1 ID) and ```` (level type) you gave it + in **** in step 4. + + - For this particular variable, the accumulation period is shown, + due to the addition of the metadata block in the **** routine. + + ``rec 319:59903982:date 2009121712 ``\ ````\ `` ``\ ````\ `` kpds7=0 levels=(0,0) grid=255 sfc ``\ ````\ ``:`` + + ```` + + ``timerange 0 P1 6 P2 0 TimeU 1 nx 402 ny 301 GDS grid 3 num_in_ave 0 missing 0 center 7 subcenter 0 process 125 ``\ ````\ `` scan: WE:SN winds(grid)`` + + ``Lambert Conf: Lat1 14.807000 Lon1 231.819000 Lov 258.040000`` + + ``Latin1 38.270000 Latin2 38.270000 LatSP 0.000000 LonSP 0.000000`` + + ``North Pole (402 x 301) Dx 15.000000 Dy 15.000000 scan 64 mode 136`` + + ``min/max data -1.1217e+06 2.40583e+07 num bits 12 BDS_Ref -112.17 DecScale -4 BinScale ``\ 0 + +Acknowledgement + +If significant help was provided via the UPP helpdesk for work resulting +in a publication, please acknowledge the Developmental Testbed Center +Mesoscale Modeling Team. + +For referencing this document please use: + +UPP Users Guide V3.0, 34 pp. [available online at +http://www.dtcenter.org/upp/users/docs/user\_guide/V3/upp\_users\_guide.pdf +] From ce84b5df7ef47750d54c0046c28494163fe3bc23 Mon Sep 17 00:00:00 2001 From: Kate Fossell Date: Tue, 10 Dec 2019 13:12:26 -0700 Subject: [PATCH 14/85] Modifying introduction --- docs/UPP_Users_guide_V4.rst | 58 ++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/docs/UPP_Users_guide_V4.rst b/docs/UPP_Users_guide_V4.rst index 3391db17c..0c5ac7f21 100644 --- a/docs/UPP_Users_guide_V4.rst +++ b/docs/UPP_Users_guide_V4.rst @@ -31,28 +31,40 @@ NCEP Unified Post Processor (UPP) UPP Introduction ================ -The NCEP Unified Post Processor has replaced the WRF Post Processor -(WPP). The UPP software package is based on WPP but has enhanced -capabilities to post-process output from a variety of NWP models, -including WRF-NMM, WRF-ARW, Nonhydrostatic Multi-scale Model on the B -grid (NMMB), Global Forecast System (GFS), Climate Forecast System -(CFS), and the global Finite-Volume Cubed Sphere dynamical core (FV3). -At this time, community user support is only provided for the WRF-ARW -and FV3 systems. - -In addition to the option to output fields on the models native vertical -levels, UPP interpolates output from the models native grids to National -Weather Service (NWS) standard levels (pressure, height, etc.) and -standard output grids (AWIPS, Lambert Conformal, polar-stereographic, -etc.) in NWS and World Meteorological Organization (WMO) GRIB format. - -UPP incorporates the Joint Center for Satellite Data Assimilation -(JCSDA) Community Radiative Transfer Model (CRTM) to compute model -derived brightness temperature (TB) for various instruments and -channels. This additional feature enables the generation of a number of -simulated satellite products including GOES and AMSRE products for -WRF-NMM, Hurricane WRF (HWRF), WRF-ARW and GFS. For CRTM documentation, -refer to: +The Unified Post Processor (UPP) software package is a software package +designed to generate useful products from raw model output. The UPP is +currently used in operations with the Global Forecast System (GFS), GFS +Ensemble Forecast System (GEFS), North American Mesoscale (NAM), Rapid +Refresh (RAP), High Resolution Rapid Refresh (HRRR), Short Range Ensemble +Forecast (SREF), Hurricane WRF (HWRF) applications, and is also used in +Unified Forecasting System (UFS) applications. The UPP provides the capability +to compute a variety of diagnostic fields and interpolate to pressure levels +or other vertical coordinates. UPP also incorporates the Joint Center for +Satellite Data Assimilation (JCSDA) Community Radiative Transfer Model (CRTM) +to compute model derived brightness temperature (TB) for various instruments +and channels. This additional feature enables the generation of a number of +simulated satellite products including GOES products. Output from the UPP is +in National Weather Service (NWS) and World Meteorological Organization (WMO) +GRIB2 format and can be used directly by visualization, plotting, or verification +packages, or for further downstream post-processing, e.g. statistical +post-processing techniques. + + Examples of UPP products include: + + - T, Z, humidity, wind, cloud water, cloud ice, rain, and snow on pressure levels + - SLP, shelter level T, humidity, and wind fields + - Precipitation-related fields + - PBL-related fields + - Severe weather products (e.g. CAPE, Vorticity, Wind shear) + - Radiative/Surface fluxes + - Cloud related fields + - Aviation products + - Radar reflectivity products + - Satellite look-alike products + +Community user support is currently provided for FV3-based applications, and on +a limited basis, WRF-ARW applications. + http://www.dtcenter.org/upp/users/docs/user_guide/crtm_ug/CRTM_User_Guide.pdf. @@ -1560,7 +1572,7 @@ Acknowledgement If significant help was provided via the UPP helpdesk for work resulting in a publication, please acknowledge the Developmental Testbed Center -Mesoscale Modeling Team. +UPP Team. For referencing this document please use: From c7b0ec05dcb2c5a68ff4a8cc005ee01ac8d54b24 Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Wed, 11 Dec 2019 17:53:40 +0000 Subject: [PATCH 15/85] merged develop in and separated library from executable in build --- sorc/ncep_post.fd/CMakeLists.txt | 319 ++++++++++++++++--------------- 1 file changed, 160 insertions(+), 159 deletions(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index ac91e53a9..179a06ee6 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -3,163 +3,163 @@ cmake_minimum_required(VERSION 2.6) set(EXENAME ncep_post ) set(LIBNAME nceppost ) set(LIB_SRC -AllGETHERV_GSD.f -ALLOCATE_ALL.f -ASSIGNNEMSIOVAR.f -AVIATION.f -blockIO.c -BNDLYR.f -BOUND.f -CALCAPE.f -CALDRG.f -CALDWP.f -CALGUST.f -CALHEL.f -CALLCL.f -CALMCVG.f -CALMICT.f -CALPBL.f -CALPBLREGIME.f -CALPOT.f -CALPW.f -CALRAD_WCLOUD_newcrtm.f -CALRCH.f -CALRH.f -CALRH_GFS.f -CALRH_GSD.f -CALRH_PW.f -CALSTRM.f -CALTAU.f -CALTHTE.f -CALUPDHEL.f -CALVIS.f -CALVIS_GSD.f -CALVOR.f -CALWXT_BOURG.f -CALWXT_DOMINANT.f -CALWXT_EXPLICIT.f -CALWXT.f -CALWXT_RAMER.f -CALWXT_REVISED.f -CANRES.f -CLDFRAC_ZHAO.f -CLDRAD.f -CLMAX.f -CMASSI.f -COLLECT.f -COLLECT_LOC.f -CTLBLK.f -cuparm.f -DEALLOCATE.f -DEWPOINT.f -ETCALC.f -EXCH2.f -EXCH.f -FDLVL.f -FGAMMA.f -FILL_PSETFLD.f -FIXED.f -FRZLVL2.f -FRZLVL.f -GEO_ZENITH_ANGLE.f -GET_BITS.f -GETGBANDSCATTER.f -getIVariableN.f -GETNEMSNDSCATTER.f -get_postfilename.f -getVariable.f -GFIP3.f -GFSPOST.F -GPVS.f -grib2_module.f -GRIBIT.F -GRIDAVG.f -GRIDSPEC.f -gtg_algo.f90 -gtg_compute.f90 -gtg_config.f90 -gtg_ctlblk.f90 -gtg_filter.f90 -gtg_indices.f90 -gtg_smoothseams.f90 -ICAOHEIGHT.f -INITPOST.F -INITPOST_GFS.f -INITPOST_GFS_NEMS.f -INITPOST_GFS_NEMS_MPIIO.f -INITPOST_GFS_SIGIO.f -INITPOST_NEMS.f -INITPOST_NEMS_MPIIO.f -INITPOST_NETCDF.f -INITPOST_NMM.f -kinds_mod.F -LFMFLD.f -LFMFLD_GFS.f -LOOKUP.f -machine.f -map_routines.f90 -MAPSSLP.f -MASKS_mod.f -MDL2AGL.f -MDL2P.f -MDL2SIGMA2.f -MDL2SIGMA.f -MDL2THANDPV.f -MDLFLD.f -MICROINIT.F -MISCLN.f -MIXLEN.f -MPI_FIRST.f -MPI_LAST.f -MSFPS.f -native_endianness.f -NGMFLD.f -NGMSLP.f -OTLFT.f -OTLIFT.f -PARAMR.f -params.F -PARA_RANGE.f -physcons.f -PMICRPH.f -POLEAVG.f -PROCESS.f -READCNTRL.f -READ_xml.f -retrieve_index.f -RHGRD.f -RQSTFLD.f -SCLFLD.f -SELECT_CHANNELS.f -SERVER.f -SET_LVLSXML.f -SET_OUTFLDS.f -SETUP_SERVERS.f -SLP_new.f -SLP_NMM.f -SMOOTH.f -SNFRAC.f -SNFRAC_GFS.f -SOIL_mod.f -SPLINE.f -SURFCE.f -svptbl.f -TABLE.f -TABLEQ.f -TRPAUS.f -TTBLEX.f -VRBLS2D_mod.f -VRBLS3D_mod.f -VRBLS4D_mod.f -WETBULB.f -WETFRZLVL.f -wrf_io_flags.f -wrf_io_flags.h -WRFPOST.f -xml_perl_data.f -ZENSUN.f) -file(GLOB EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f ${CMAKE_CURRENT_SOURCE_DIR}/*.f90 ${CMAKE_CURRENT_SOURCE_DIR}/*.F) -file(GLOB EXE_C_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c) +${CMAKE_CURRENT_SOURCE_DIR}/AllGETHERV_GSD.f +${CMAKE_CURRENT_SOURCE_DIR}/ALLOCATE_ALL.f +${CMAKE_CURRENT_SOURCE_DIR}/ASSIGNNEMSIOVAR.f +${CMAKE_CURRENT_SOURCE_DIR}/AVIATION.f +${CMAKE_CURRENT_SOURCE_DIR}/blockIO.c +${CMAKE_CURRENT_SOURCE_DIR}/BNDLYR.f +${CMAKE_CURRENT_SOURCE_DIR}/BOUND.f +${CMAKE_CURRENT_SOURCE_DIR}/CALCAPE.f +${CMAKE_CURRENT_SOURCE_DIR}/CALDRG.f +${CMAKE_CURRENT_SOURCE_DIR}/CALDWP.f +${CMAKE_CURRENT_SOURCE_DIR}/CALGUST.f +${CMAKE_CURRENT_SOURCE_DIR}/CALHEL.f +${CMAKE_CURRENT_SOURCE_DIR}/CALLCL.f +${CMAKE_CURRENT_SOURCE_DIR}/CALMCVG.f +${CMAKE_CURRENT_SOURCE_DIR}/CALMICT.f +${CMAKE_CURRENT_SOURCE_DIR}/CALPBL.f +${CMAKE_CURRENT_SOURCE_DIR}/CALPBLREGIME.f +${CMAKE_CURRENT_SOURCE_DIR}/CALPOT.f +${CMAKE_CURRENT_SOURCE_DIR}/CALPW.f +${CMAKE_CURRENT_SOURCE_DIR}/CALRAD_WCLOUD_newcrtm.f +${CMAKE_CURRENT_SOURCE_DIR}/CALRCH.f +${CMAKE_CURRENT_SOURCE_DIR}/CALRH.f +${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GFS.f +${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GSD.f +${CMAKE_CURRENT_SOURCE_DIR}/CALRH_PW.f +${CMAKE_CURRENT_SOURCE_DIR}/CALSTRM.f +${CMAKE_CURRENT_SOURCE_DIR}/CALTAU.f +${CMAKE_CURRENT_SOURCE_DIR}/CALTHTE.f +${CMAKE_CURRENT_SOURCE_DIR}/CALUPDHEL.f +${CMAKE_CURRENT_SOURCE_DIR}/CALVIS.f +${CMAKE_CURRENT_SOURCE_DIR}/CALVIS_GSD.f +${CMAKE_CURRENT_SOURCE_DIR}/CALVOR.f +${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_BOURG.f +${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_DOMINANT.f +${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_EXPLICIT.f +${CMAKE_CURRENT_SOURCE_DIR}/CALWXT.f +${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_RAMER.f +${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_REVISED.f +${CMAKE_CURRENT_SOURCE_DIR}/CANRES.f +${CMAKE_CURRENT_SOURCE_DIR}/CLDFRAC_ZHAO.f +${CMAKE_CURRENT_SOURCE_DIR}/CLDRAD.f +${CMAKE_CURRENT_SOURCE_DIR}/CLMAX.f +${CMAKE_CURRENT_SOURCE_DIR}/CMASSI.f +${CMAKE_CURRENT_SOURCE_DIR}/COLLECT.f +${CMAKE_CURRENT_SOURCE_DIR}/COLLECT_LOC.f +${CMAKE_CURRENT_SOURCE_DIR}/CTLBLK.f +${CMAKE_CURRENT_SOURCE_DIR}/cuparm.f +${CMAKE_CURRENT_SOURCE_DIR}/DEALLOCATE.f +${CMAKE_CURRENT_SOURCE_DIR}/DEWPOINT.f +${CMAKE_CURRENT_SOURCE_DIR}/ETCALC.f +${CMAKE_CURRENT_SOURCE_DIR}/EXCH2.f +${CMAKE_CURRENT_SOURCE_DIR}/EXCH.f +${CMAKE_CURRENT_SOURCE_DIR}/FDLVL.f +${CMAKE_CURRENT_SOURCE_DIR}/FGAMMA.f +${CMAKE_CURRENT_SOURCE_DIR}/FILL_PSETFLD.f +${CMAKE_CURRENT_SOURCE_DIR}/FIXED.f +${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL2.f +${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL.f +${CMAKE_CURRENT_SOURCE_DIR}/GEO_ZENITH_ANGLE.f +${CMAKE_CURRENT_SOURCE_DIR}/GET_BITS.f +${CMAKE_CURRENT_SOURCE_DIR}/GETGBANDSCATTER.f +${CMAKE_CURRENT_SOURCE_DIR}/getIVariableN.f +${CMAKE_CURRENT_SOURCE_DIR}/GETNEMSNDSCATTER.f +${CMAKE_CURRENT_SOURCE_DIR}/get_postfilename.f +${CMAKE_CURRENT_SOURCE_DIR}/getVariable.f +${CMAKE_CURRENT_SOURCE_DIR}/GFIP3.f +${CMAKE_CURRENT_SOURCE_DIR}/GFSPOST.F +${CMAKE_CURRENT_SOURCE_DIR}/GPVS.f +${CMAKE_CURRENT_SOURCE_DIR}/grib2_module.f +${CMAKE_CURRENT_SOURCE_DIR}/GRIBIT.F +${CMAKE_CURRENT_SOURCE_DIR}/GRIDAVG.f +${CMAKE_CURRENT_SOURCE_DIR}/GRIDSPEC.f +${CMAKE_CURRENT_SOURCE_DIR}/gtg_algo.f90 +${CMAKE_CURRENT_SOURCE_DIR}/gtg_compute.f90 +${CMAKE_CURRENT_SOURCE_DIR}/gtg_config.f90 +${CMAKE_CURRENT_SOURCE_DIR}/gtg_ctlblk.f90 +${CMAKE_CURRENT_SOURCE_DIR}/gtg_filter.f90 +${CMAKE_CURRENT_SOURCE_DIR}/gtg_indices.f90 +${CMAKE_CURRENT_SOURCE_DIR}/gtg_smoothseams.f90 +${CMAKE_CURRENT_SOURCE_DIR}/ICAOHEIGHT.f +${CMAKE_CURRENT_SOURCE_DIR}/INITPOST.F +${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS.f +${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS.f +${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS_MPIIO.f +${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_SIGIO.f +${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS.f +${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS_MPIIO.f +${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NETCDF.f +${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NMM.f +${CMAKE_CURRENT_SOURCE_DIR}/kinds_mod.F +${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD.f +${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD_GFS.f +${CMAKE_CURRENT_SOURCE_DIR}/LOOKUP.f +${CMAKE_CURRENT_SOURCE_DIR}/machine.f +${CMAKE_CURRENT_SOURCE_DIR}/map_routines.f90 +${CMAKE_CURRENT_SOURCE_DIR}/MAPSSLP.f +${CMAKE_CURRENT_SOURCE_DIR}/MASKS_mod.f +${CMAKE_CURRENT_SOURCE_DIR}/MDL2AGL.f +${CMAKE_CURRENT_SOURCE_DIR}/MDL2P.f +${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA2.f +${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA.f +${CMAKE_CURRENT_SOURCE_DIR}/MDL2THANDPV.f +${CMAKE_CURRENT_SOURCE_DIR}/MDLFLD.f +${CMAKE_CURRENT_SOURCE_DIR}/MICROINIT.F +${CMAKE_CURRENT_SOURCE_DIR}/MISCLN.f +${CMAKE_CURRENT_SOURCE_DIR}/MIXLEN.f +${CMAKE_CURRENT_SOURCE_DIR}/MPI_FIRST.f +${CMAKE_CURRENT_SOURCE_DIR}/MPI_LAST.f +${CMAKE_CURRENT_SOURCE_DIR}/MSFPS.f +${CMAKE_CURRENT_SOURCE_DIR}/native_endianness.f +${CMAKE_CURRENT_SOURCE_DIR}/NGMFLD.f +${CMAKE_CURRENT_SOURCE_DIR}/NGMSLP.f +${CMAKE_CURRENT_SOURCE_DIR}/OTLFT.f +${CMAKE_CURRENT_SOURCE_DIR}/OTLIFT.f +${CMAKE_CURRENT_SOURCE_DIR}/PARAMR.f +${CMAKE_CURRENT_SOURCE_DIR}/params.F +${CMAKE_CURRENT_SOURCE_DIR}/PARA_RANGE.f +${CMAKE_CURRENT_SOURCE_DIR}/physcons.f +${CMAKE_CURRENT_SOURCE_DIR}/PMICRPH.f +${CMAKE_CURRENT_SOURCE_DIR}/POLEAVG.f +${CMAKE_CURRENT_SOURCE_DIR}/PROCESS.f +${CMAKE_CURRENT_SOURCE_DIR}/READCNTRL.F +${CMAKE_CURRENT_SOURCE_DIR}/READ_xml.f +${CMAKE_CURRENT_SOURCE_DIR}/retrieve_index.f +${CMAKE_CURRENT_SOURCE_DIR}/RHGRD.f +${CMAKE_CURRENT_SOURCE_DIR}/RQSTFLD.F +${CMAKE_CURRENT_SOURCE_DIR}/SCLFLD.f +${CMAKE_CURRENT_SOURCE_DIR}/SELECT_CHANNELS.f +${CMAKE_CURRENT_SOURCE_DIR}/SERVER.f +${CMAKE_CURRENT_SOURCE_DIR}/SET_LVLSXML.f +${CMAKE_CURRENT_SOURCE_DIR}/SET_OUTFLDS.f +${CMAKE_CURRENT_SOURCE_DIR}/SETUP_SERVERS.f +${CMAKE_CURRENT_SOURCE_DIR}/SLP_new.f +${CMAKE_CURRENT_SOURCE_DIR}/SLP_NMM.f +${CMAKE_CURRENT_SOURCE_DIR}/SMOOTH.f +${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC.f +${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC_GFS.f +${CMAKE_CURRENT_SOURCE_DIR}/SOIL_mod.f +${CMAKE_CURRENT_SOURCE_DIR}/SPLINE.f +${CMAKE_CURRENT_SOURCE_DIR}/SURFCE.f +${CMAKE_CURRENT_SOURCE_DIR}/svptbl.f +${CMAKE_CURRENT_SOURCE_DIR}/TABLE.f +${CMAKE_CURRENT_SOURCE_DIR}/TABLEQ.f +${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS.f +${CMAKE_CURRENT_SOURCE_DIR}/TTBLEX.f +${CMAKE_CURRENT_SOURCE_DIR}/VRBLS2D_mod.f +${CMAKE_CURRENT_SOURCE_DIR}/VRBLS3D_mod.f +${CMAKE_CURRENT_SOURCE_DIR}/VRBLS4D_mod.f +${CMAKE_CURRENT_SOURCE_DIR}/WETBULB.f +${CMAKE_CURRENT_SOURCE_DIR}/WETFRZLVL.f +${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.f +${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.h +${CMAKE_CURRENT_SOURCE_DIR}/xml_perl_data.f +${CMAKE_CURRENT_SOURCE_DIR}/ZENSUN.f) +file(GLOB EXE_SRC *.f *.f90 *.F) +file(GLOB EXE_C_SRC *.c) +list( REMOVE_ITEM EXE_SRC ${LIB_SRC}) list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) if(IntelComp) @@ -172,14 +172,15 @@ else() endif() add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) -add_library(${LIBNAME} ${EXE_SRC} ${EXE_C_SRC} ) +add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC} ) set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS -qopenmp ) +add_dependencies(${EXENAME} ${LIBNAME}) message("hey, g2 inc is ${G2TMPL_INCd}") include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ${CMAKE_INSTALL_PREFIX}/include_4 ) -target_link_libraries(${EXENAME} ${BACIO_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${SIGIO_LIB} ${NEMSIO_LIB} ${IP_LIB4} ${SFCIO_LIB} ${W3EMC_LIB4} ${ZLIB} ${G2TMPL_LIBd} ${G2_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIB4} ${CRTM_LIB} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIB4} ) +target_link_libraries(${EXENAME} ${LIBNAME} ${BACIO_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${SIGIO_LIB} ${NEMSIO_LIB} ${IP_LIB4} ${SFCIO_LIB} ${W3EMC_LIB4} ${ZLIB} ${G2TMPL_LIBd} ${G2_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIB4} ${CRTM_LIB} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIB4} ) install(TARGETS ${EXENAME} From 4fbc692c2f1e904d3916958e707776f4b30daf84 Mon Sep 17 00:00:00 2001 From: Dusan Jovic Date: Thu, 12 Dec 2019 19:44:31 +0000 Subject: [PATCH 16/85] Update CMakeLists.txt files to support GNU compilers --- CMakeLists.txt | 5 ++--- sorc/ncep_post.fd/CMakeLists.txt | 31 ++++++++++++++++++++----------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63b8cb3bd..0c93a9374 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ if(NOT BUILD_RELEASE ) STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) endif() STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEGUG" BUILD_DEBUG) +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEBUG" BUILD_DEBUG) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") @@ -57,8 +57,7 @@ find_package( NEMSIO ) find_package( GFSIO ) find_package( W3EMC ) find_package( CRTM ) +find_package( HDF5 COMPONENTS C Fortran HL ) find_package( NetCDF ) -include_directories(${CMAKE_INSTALL_PREFIX}/include_d ${CMAKE_INSTALL_PREFIX}/include ) - add_subdirectory(sorc/ncep_post.fd) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 179a06ee6..cd2c64103 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6) set(EXENAME ncep_post ) set(LIBNAME nceppost ) -set(LIB_SRC +set(LIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/AllGETHERV_GSD.f ${CMAKE_CURRENT_SOURCE_DIR}/ALLOCATE_ALL.f ${CMAKE_CURRENT_SOURCE_DIR}/ASSIGNNEMSIOVAR.f @@ -164,33 +164,42 @@ list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) if(IntelComp) message("setting intel flags") - set(CMAKE_Fortran_8_FLAGS " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) + set(CMAKE_Fortran_FLAGS " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") +elseif(GNUComp) + message("setting gnu flags") + set(CMAKE_Fortran_FLAGS "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g" CACHE INTERNAL "" ) +# set(CMAKE_Fortran_FLAGS "-O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check -ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) + if(APPLE) + set(CMAKE_C_FLAGS "-DAPPLE -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") + elseif(UNIX) + set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") + endif(APPLE) else() - message("unkown compiler!") + message("unknown compiler!") exit() endif() add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC} ) -set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) -set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) +set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_FLAGS} ) +set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_FLAGS} ) set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) -set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS -qopenmp ) +set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS} ) add_dependencies(${EXENAME} ${LIBNAME}) -message("hey, g2 inc is ${G2TMPL_INCd}") -include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ${CMAKE_INSTALL_PREFIX}/include_4 ) -target_link_libraries(${EXENAME} ${LIBNAME} ${BACIO_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${SIGIO_LIB} ${NEMSIO_LIB} ${IP_LIB4} ${SFCIO_LIB} ${W3EMC_LIB4} ${ZLIB} ${G2TMPL_LIBd} ${G2_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIB4} ${CRTM_LIB} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIB4} ) + +include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ) +target_link_libraries(${EXENAME} ${LIBNAME} ${SP_LIB4} ${SIGIO_LIB} ${SFCIO_LIB} ${GFSIO_LIB4} ${NEMSIO_LIB} ${IP_LIB4} ${W3EMC_LIB4} ${W3NCO_LIB4} ${G2TMPL_LIBd} ${G2_LIB4} ${CRTM_LIB} ${BACIO_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) install(TARGETS ${LIBNAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) install(DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/ DESTINATION include_4 ) From 1be54efd3a32ea03c87f8302656c79e63d7b75c4 Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Mon, 16 Dec 2019 16:03:21 +0000 Subject: [PATCH 17/85] applied patch from Dusan --- CMakeLists.txt | 5 ++--- sorc/ncep_post.fd/CMakeLists.txt | 28 +++++++++++++++++++--------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63b8cb3bd..0c93a9374 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ if(NOT BUILD_RELEASE ) STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) endif() STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEGUG" BUILD_DEBUG) +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEBUG" BUILD_DEBUG) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") @@ -57,8 +57,7 @@ find_package( NEMSIO ) find_package( GFSIO ) find_package( W3EMC ) find_package( CRTM ) +find_package( HDF5 COMPONENTS C Fortran HL ) find_package( NetCDF ) -include_directories(${CMAKE_INSTALL_PREFIX}/include_d ${CMAKE_INSTALL_PREFIX}/include ) - add_subdirectory(sorc/ncep_post.fd) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 179a06ee6..a63c60972 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6) set(EXENAME ncep_post ) set(LIBNAME nceppost ) -set(LIB_SRC +set(LIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/AllGETHERV_GSD.f ${CMAKE_CURRENT_SOURCE_DIR}/ALLOCATE_ALL.f ${CMAKE_CURRENT_SOURCE_DIR}/ASSIGNNEMSIOVAR.f @@ -164,23 +164,33 @@ list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) if(IntelComp) message("setting intel flags") - set(CMAKE_Fortran_8_FLAGS " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) + set(CMAKE_Fortran_FLAGS " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") +elseif(GNUComp) + message("setting gnu flags") + set(CMAKE_Fortran_FLAGS "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g" CACHE INTERNAL "" ) +# set(CMAKE_Fortran_FLAGS "-O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check -ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) + if(APPLE) + set(CMAKE_C_FLAGS "-DAPPLE -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") + elseif(UNIX) + set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") + endif(APPLE) else() - message("unkown compiler!") + message("unknown compiler!") exit() endif() add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC} ) -set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) -set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_8_FLAGS} ) +set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_FLAGS} ) +set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_FLAGS} ) set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) -set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS -qopenmp ) +set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS} ) add_dependencies(${EXENAME} ${LIBNAME}) -message("hey, g2 inc is ${G2TMPL_INCd}") -include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ${CMAKE_INSTALL_PREFIX}/include_4 ) -target_link_libraries(${EXENAME} ${LIBNAME} ${BACIO_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${SIGIO_LIB} ${NEMSIO_LIB} ${IP_LIB4} ${SFCIO_LIB} ${W3EMC_LIB4} ${ZLIB} ${G2TMPL_LIBd} ${G2_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIB4} ${CRTM_LIB} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIB4} ) + +include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ) + +target_link_libraries(${EXENAME} ${LIBNAME} ${SP_LIB4} ${SIGIO_LIB} ${SFCIO_LIB} ${GFSIO_LIB4} ${NEMSIO_LIB} ${IP_LIB4} ${W3EMC_LIB4} ${W3NCO_LIB4} ${G2TMPL_LIBd} ${G2_LIB4} ${CRTM_LIB} ${BACIO_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) install(TARGETS ${EXENAME} From 8cced035027868be83b0edf1bd0ec1c69cc080a8 Mon Sep 17 00:00:00 2001 From: Tracy Date: Mon, 16 Dec 2019 09:25:28 -0700 Subject: [PATCH 18/85] Add conf.py for upp documentation --- docs/conf.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 docs/conf.py diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..8b29cc76e --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,55 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'upp_docs' +copyright = '2019, Tracy Hertneky' +author = 'Tracy Hertneky' + +# The full version, including alpha/beta/rc tags +release = 'v1' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] From afa900c410abeacad78a38f7d9b7120a862fa890 Mon Sep 17 00:00:00 2001 From: Tracy Date: Mon, 16 Dec 2019 09:53:05 -0700 Subject: [PATCH 19/85] Add index.rst for upp documentation --- docs/index.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/index.rst diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..c347c3843 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,20 @@ +.. upp_docs documentation master file, created by + sphinx-quickstart on Wed Nov 13 10:17:56 2019. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to upp_docs's documentation! +==================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + UPP_Users_guide_V4_ufs + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` From 5baf0d9ade1d6d948c64cb29545a67c7997110ca Mon Sep 17 00:00:00 2001 From: Kate Fossell Date: Mon, 16 Dec 2019 11:35:32 -0700 Subject: [PATCH 20/85] Add readthedocs config file --- .readthedocs.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 000000000..286f0b31d --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,23 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Build documentation with MkDocs +#mkdocs: +# configuration: mkdocs.yml + +# Optionally build your docs in additional formats such as PDF and ePub +formats: all + +# Optionally set the version of Python and requirements required to build your docs +#python: +# version: 3.7 +# install: +# - requirements: docs/requirements.txt From 77b4376a16ff97d8434d65cd00779e51c8353d33 Mon Sep 17 00:00:00 2001 From: Kate Fossell Date: Mon, 16 Dec 2019 11:44:01 -0700 Subject: [PATCH 21/85] Modify name of main rst doc in index for readthedocs build test --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index c347c3843..27ff640ee 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,7 +10,7 @@ Welcome to upp_docs's documentation! :maxdepth: 2 :caption: Contents: - UPP_Users_guide_V4_ufs + UPP_Users_guide_V4.rst Indices and tables ================== From 862a1414dad0d9a756475d32515a9919a1441082 Mon Sep 17 00:00:00 2001 From: Kate Fossell Date: Mon, 16 Dec 2019 11:55:37 -0700 Subject: [PATCH 22/85] Change master file to index --- docs/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 8b29cc76e..ae4186a60 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,6 +41,8 @@ # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [] +# The master toctree document. +master_doc = 'index' # -- Options for HTML output ------------------------------------------------- From 325795b7ed2235d340c398606aa12df3fefbc838 Mon Sep 17 00:00:00 2001 From: Tracy Date: Tue, 17 Dec 2019 15:16:32 -0700 Subject: [PATCH 23/85] Edits for UFS documentation to remove WRF and grib1 references --- docs/UPP_Users_guide_V4.rst | 1129 +++++------------------------------ 1 file changed, 155 insertions(+), 974 deletions(-) diff --git a/docs/UPP_Users_guide_V4.rst b/docs/UPP_Users_guide_V4.rst index 3391db17c..507fe0ebe 100644 --- a/docs/UPP_Users_guide_V4.rst +++ b/docs/UPP_Users_guide_V4.rst @@ -7,9 +7,7 @@ User’s Guide for the NCEP Unified Post Processor (UPP) ====================================================== ---------- -Version 4 ---------- +**Version 4** *Acknowledgments:* @@ -37,8 +35,6 @@ capabilities to post-process output from a variety of NWP models, including WRF-NMM, WRF-ARW, Nonhydrostatic Multi-scale Model on the B grid (NMMB), Global Forecast System (GFS), Climate Forecast System (CFS), and the global Finite-Volume Cubed Sphere dynamical core (FV3). -At this time, community user support is only provided for the WRF-ARW -and FV3 systems. In addition to the option to output fields on the models native vertical levels, UPP interpolates output from the models native grids to National @@ -59,12 +55,10 @@ http://www.dtcenter.org/upp/users/docs/user_guide/crtm_ug/CRTM_User_Guide.pdf. Software Installation/Getting Started ===================================== -UPP Software Requirements -------------------------- - -The Community Unified Post Processor version 4 no longer requires users -to first build the WRF model. The WRF I/O libraries that UPP uses are -now included in the UPP build. +System Requirements, Libraries, and Compilers +--------------------------------------------- +UPP has been tested on LINUX platforms (with PGI, Intel and GFORTRAN +compilers). Before installing the UPP code, it is necessary to ensure that you have the required libraries available on your system. These libraries @@ -73,19 +67,21 @@ include: - Unidata’s NetCDF library https://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html + +- The NCEP libraries for the UPP application -- The JasPer, PNG, and Zlib libraries, required with the release of - UPPv2.0 and higher, due to the addition of GRIB2 capabilities. NCEP + https://github.com/NCAR/NCEPlibs + +- The JasPer, PNG, and Zlib libraries, required for GRIB2 capabilities. NCEP provides these necessary codes for download: http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/ - -- GNU M4 for UPPV4.0 only, which is used to build the WRF I/O libraries - now included in UPPV4.0. This is usually bundled with an operating - system or can be downloaded: + +- GNU M4, used to build the WRF I/O libraries included in UPPV4.0. + This is usually bundled with an operating system or can be downloaded: https://www.gnu.org/software/m4/ - + The UPP has some sample visualization scripts included to create graphics using: - GrADS (http://cola.gmu.edu/grads/gadoc/gadoc.php) @@ -95,24 +91,16 @@ The UPP has some sample visualization scripts included to create graphics using: **Note:** *These are not part of the UPP installation and need to be installed separately if one would like to use either plotting package.* -UPP has been tested on LINUX platforms (with PGI, Intel and GFORTRAN -compilers). +The UPP and all libraries required by the UPP need to be built with the same compiler. Obtaining the UPP Code ---------------------- -The UPP package can be downloaded from: - -http://www.dtcenter.org/upp/users/downloads/index.php - -**Note:** *Always obtain the latest version of the code if you -are not trying to continue a pre-existing project.* +The most recent release UPPV4.0.1 is available on github. To obtain the code, move to the diretory where you would like the repository to reside and enter on the command line: -Once the *tar* file is obtained, *gunzip* and *untar* the file. + git clone -b DTC_post --recurse-submodules https://github.com/NOAA-EMC/EMC_post -*tar zxvf UPPV4.0.tar.gz* - -This command will create a directory called **UPPV4.0**. +This will clone the DTC_post branch of EMC_post, including the CRTM submodule. UPP Directory Structure ----------------------- @@ -121,84 +109,54 @@ Under the main directory of **UPPV4.0** reside seven subdirectories (\* indicates directories that are created after the configuration step): -**arch**: Machine dependent configuration build scripts used to -construct *configure.upp* - -**bin**\*: Location of executables after compilation. - -**scripts**: contains sample running scripts to process *wrfout* and -*fv3* history files. +**docs**: -- **run\_unipost**: run *unipost*. +**exec**\*: Contains the *unipost* executable after successful compilation -**include**\*: Source include modules built/used during compilation of -UPP +**include**\*: Source include modules built/used during compilation of UPP -**lib**\*: Archived libraries built/used by UPP +**lib**\*: Libraries built/used by UPP not in NCEPlibs **parm**: Contains the parameter files, which can be modified by the user to control how the post processing is performed. -**src**: Contains source codes for: +**scripts**: contains sample running scripts to process model history files. -- **copygb**: Source code for *copygb* +- **run\_unipost**: runs *unipost*. -- **ndate**: Source code for *ndate* +**sorc**: Contains source codes for: -- **unipost**: Source code for *unipost* +- **arch**: Machine dependent configuration build scripts used to construct *configure.upp* -- **lib**: Contains source code subdirectories for the UPP libraries +- **ncep_post.fd**: Source code for *unipost* - - **bacio**: Binary I/O library +- **comlibs**: Contains source code subdirectories for the UPP libraries not included in NCEPlibs - **crtm2**: Community Radiative Transfer Model library - - **g2**: GRIB2 support library - - - **g2tmpl**: GRIB2 table support library - - - **gfsio**: GFS I/O routines - - - **ip**: General interpolation library (see *lib/ip/iplib.doc*) - - - **nemsio**: NEMS I/O routines - - - **sfcio**: API for performing I/O on the surface restart file of - the global spectral model - - - **sigio**: API for performing I/O on the sigma restart file of the - global spectral model - - - **sp**: Spectral transform library (see lib/sp/splib.doc) - - - **w3emc**: Library for coding and decoding data in GRIB1 format - - - **w3nco**: Library for coding and decoding data in GRIB1 format - - - **wrf\_io**: Library containing WRF I/O and netCDF interface code - - **wrfmpi\_stubs**: Contains some *C* and *FORTRAN* codes to generate *libmpi.a* library used to replace MPI calls for serial compilation. - - **xmlparse**: XML support GRIB2 parameter file + - **xml**: XML support for the GRIB2 parameter file Installing the UPP Code ----------------------- -UPP uses a build mechanism similar to that used by the WRF model. An -environment variable to a compatible version of netCDF must be set +Environment variables to compatible versions of the required libraries must be set before beginning the installation. To reference the netCDF libraries, the configure script checks for an -environment variable (*NETCDF*) first, then the system default -(*/user/local/netcdf*), and then a user supplied link +environment variable (**NETCDF**) first, then the system default +(**/user/local/netcdf**), and then a user supplied link (*./netcdf\_links*). If none of these resolve a path, the user will be prompted by the configure script to supply a path. +To reference the NCEP libraries, the configure script will also check that you set the environment variable **NCEPLIBS_DIR** to the location where the NCEPlibs were built. + Type configure, and provide the required info. For example: -*./configure* + *./configure* You will be given a list of choices for your computer. @@ -221,23 +179,18 @@ You will be given a list of choices for your computer. Choose one of the configure options listed. Check the *configure.upp* file created and edit for compile options/paths, if necessary. For debug flag settings, the configure script can be run with -a d switch or flag. +a *-d* switch or flag. To compile UPP, enter the following command: -*./compile >& compile\_upp.log &* + *./compile >& compile\_upp.log &* -When compiling with distributed memory (serial) this command should -create 14 (15) UPP libraries in *UPPV3.2/lib/* (*libbacio.a*, -*libCRTM.a*, *libg2.a*, *libg2tmpl.a*, *libgfsio.a*, -*libip.a*, (*libmpi.a*), *libnemsio.a*, *libsfcio.a*, -*libsigio.a*, *libsp.a*, *libw3emc.a*, *libw3nco.a*, -*libwrfio\_nf.a*, *libxmlparse.a*) and three UPP executables in -**bin/** (*unipost.exe*, *ndate.exe*, and *copygb.exe*). +When compiling UPP with distributed memory (serial) this command should +create 2 (3) libraries in **EMC_post/lib/** (*libCRTM.a*, (*libmpi.a*), *libxmlparse.a*) and the UPP executable in **exec/** (*unipost.exe*). To remove all built files, as well as the *configure.upp*, type: -*./clean* + *./clean* This action is recommended if a mistake is made during the installation process or a change is made to the configuration or build environment. @@ -249,8 +202,7 @@ UPP Functionalities The UPP, -- is compatible with WRF v3.7 and higher for Ferrier physics (UPPV3.0+) - or WRF v3.5 and higer (UPPV2.1). +- is compatible with WRF v3.7 and higher for Ferrier physics. - can be used to post-process WRF-ARW, WRF-NMM, NMMB, GFS, CFS, and FV3 forecasts (community support only provided for WRF-ARW and global FV3 @@ -258,12 +210,10 @@ The UPP, - can ingest WRF history files (wrfout\*) in netCDF format. -- can ingest FV3 history files (dyn\*/phy\* or gfs\*) in binarynemsio +- can ingest FV3 history files (dyn\*/phy\* or gfs\*) in binarynemsiompioo. format. -The UPP is divided into two parts: - -#. **Unipost** +**Unipost** - Interpolates the forecasts from the models native vertical coordinate to NWS standard output levels (e.g., pressure, height) @@ -273,18 +223,13 @@ The UPP is divided into two parts: - Computes diagnostic output quantities (e.g., convective available potential energy, helicity, relative humidity). A full list of - fields that can be generated by *unipost* is provided for - https://dtcenter.org/upp/users/docs/tables/UPP_GRIB1_Table.pdf and + fields that can be generated by *unipost* is provided in https://dtcenter.org/upp/users/docs/tables/UPP_GRIB2_Table.pdf. - - Outputs the results in NWS and WMO standard GRIB1 or GRIB2 format + - Outputs the results in NWS and WMO standard GRIB2 format (for GRIB documentation, see http://www.nco.ncep.noaa.gov/pmb/docs/). - - FV3 only available for GRIB2 output. - - - Destaggers the WRF-ARW forecasts from a C-grid to an A-grid. - - Except for new capabilities of post processing GFS/CFS and additions of many new variables, UPP uses the same algorithms to derive most existing variables as were used in WPP. The only three @@ -304,49 +249,25 @@ The UPP is divided into two parts: V3: Users Guide 8 temperature lapse rate of 2 K/km over three model layers. -#. **Copygb** - - - Interpolates the forecasts horizontally from their native grid to - a standard AWIPS or user-defined grid (for information on AWIPS - grids, see - http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html). - - - Outputs the results in NWS and WMO standard GRIB1 format (for GRIB - documentation, see http://www.nco.ncep.noaa.gov/pmb/docs/). - - **Note** *: Copygb only works with GRIB1 format; for GRIB2, use - wgrib2. (for downloading the source code and information on compiling - on your system, see:* - -In addition to *unipost* and *copygb*, a utility called -*ndate* is distributed with the UPP tarfile. This utility is used to -format the dates of the forecasts to be posted for ingestion by the -codes. - -Setting up the WRF or FV3 model to interface with UPP +Setting up the model to interface with UPP ----------------------------------------------------- The unipost program is currently set up to read a large number of fields -from the WRF and FV3 model history files. This configuration stems from +from the model history files. This configuration stems from NCEP’s need to generate all of its required operational products. When using the netCDF or NEMS binary read, this program is configured such that it will run successfully even if an expected input field is missing -from the WRF or FV3 history file as long as this field is not required +from the history file as long as this field is not required to produce a requested output field. If the pre-requisites for a -requested output field are missing from the WRF or FV3 history file, +requested output field are missing from the history file, unipost will abort at run time. -Take care not to remove fields from the wrfout or gfs files, which may +Take care not to remove fields from the model history files, which may be needed for diagnostic purposes by the UPP package. For example, if isobaric state fields are requested, but the pressure fields on model -interfaces (i.e. P\_HYD for WRF-ARW) are not available in the history +interfaces are not available in the history file, unipost will abort at run time. In general, the default fields -available in the wrfout or gfs files are sufficient to run UPP. The -fields written to the WRF history file are controlled by the settings in -the Registry . For WRF, see the Registry.EM, Registry.EM\_COMMON files -in the Registry subdirectory of the main WRFV4 directory. - -**Note** +available in the model history files are sufficient to run UPP. UPP is written to process a single forecast hour, therefore, having a single forecast per output file is optimal. However, for WRF based @@ -356,84 +277,54 @@ output file to extract a specified forecast hour. UPP Control File Overview ========================= -GRIB1 control file +GRIB2 control file ------------------ -**Note** - -The user interacts with unipost through the control file, -*parm/wrf\_cntrl.parm* for WRF runs. - -The control file is composed of a header and a body. The header -specifies the output file information. The body allows the user to -select which fields and levels to process. - -The header of the ***wrf\_cntrl.parm*** file contains the following -variables: - -- **KGTYPE**: defines output grid type, which should always be 255. - -- **IMDLTY**: identifies the process ID for AWIPS. - -- **DATSET**: defines the prefix used for the output file name. - Currently set to WRFPRS. Note: the run\_\* scripts assume WRFPRS is - used for WRF runs. - -The body of the *wrf\_cntrl.parm* file is composed of a series of -line pairs similar to the following: - -(PRESS ON MDL SFCS ) SCAL=( 3.0) - -L=(11000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 -00000 00000 00000) +- For outputting GRIB2 format using version 4.0, a preprocessing step + is required by the user to convert the xml file + *parm/postcntrl.xml* to a flat text file + *parm/postxconfig-NT.txt*. The flat file is quicker to process + than the xml file. The user will first need to edit the + *postcntrl.xml* file to declare which fields are to be output + from UPP. -where, +- In order to ensure that the user-edited xml files are error free, XML + stylesheets (*parm/EMC\_POST\_CTRL\_Schema.xsd* and + *EMC\_POST\_Avblflds\_Schema.xsd*) are used to validate both the + *postcntrl.xml* and *post\_avblflds.xml* files, respectively. + Confirmation of validation will be given (e.g. postcntrl.xml + validates) or otherwise return errors if it does not match the + schema. To run the validation: -- The top line specifies the variable (e.g. PRESS) to process, the - level type (e.g. ON MDL SFCS) a user is interested in, and the degree - of accuracy to be retained (SCAL=3.0) in the GRIB output. + *xmllint --noout --schema EMC\_POST\_CTRL\_Schema.xsd + postcntrl.xml* - - SCAL defines the precision of the data written out to the GRIB - format. Positive values denote decimal scaling (maintain that - number of significant digits), while negative values describe - binary scaling (precise to 2^{SCAL}; i.e., SCAL=-3.0 gives output - precise to the nearest 1/8). Because **copygb** is unable to - handle binary precision at this time, negative numbers are - discouraged. + *xmllint --noout --schema EMC\_POST\_Avblflds\_Schema.xsd + post\_avblflds.xml* - - A list of all possible output fields for **unipost** is provided - in the GRIB1 output table - https://dtcenter.org/upp/users/docs/tables/UPP_GRIB1_Table.pdf. - This table provides the full name of the variable in the first - column and an abbreviated name in the second column. The - abbreviated names are used in the control file. Note that the - variable names also contain the type of level on which they are - output. For instance, temperature is available on model surface - and pressure surface. +- Once the xmls are validated, the user will need to generate the flat + file. Edit the *parm/makefile* if necessary to point to the + desired flat file directory and xmls. The makefile will call the perl + program *parm/POSTXMLPreprocessor.pl* to generate the post flat + file *postxconfig-NT.txt*. Generate the flat file: -- The second line specifies the levels on which the variable is to be - posted. In this case, 0 indicates no output at this level and 1 - indicates output the variable specified on the top line at the level - specified by the position of the digit and the type of level defined - for this variable. For flight/wind energy fields, a 2 may be - specified, such that 2 requests AGL and 1 requests MSL. + *make* Controlling which variables unipost outputs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To output a field, the body of the control file needs to contain an -entry for the appropriate variable and output for this variable must be -turned on for at least one level (see next section: *Controlling which -levels unipost outputs*). If an entry for a particular field is not yet -available in the control file, two lines may be added to the control -file with the appropriate entries for that field. +entry for the appropriate variable. For variables found on isobaric or +height levels, the desired levels to be output must be listed (see next +section: *Controlling which levels unipost outputs*). If an entry for +a particular field is not yet available in the control file, it may be +added to the control file with the appropriate entries for that field. Controlling which levels unipost outputs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The second line of each pair determines which levels unipost will -output. Output on a given level is turned off by a 0 or turned on by a -1. +The tag in the postcntrl.xml is used to list the desired levels +for output. The following levels are currently available for output: - For isobaric output, 46 levels are possible, from 2 to 1000 hPa (*2, 5, 7, 10, 20, 30, 50, 70 mb and then every 25 mb from 75 to 1000 @@ -454,9 +345,7 @@ output. Output on a given level is turned off by a 0 or turned on by a 40-100 cm, and 100-200 cm. - When using the RUC LSM, the soil levels are 0 cm, 1 cm, 4 cm, 10 cm, - 30 cm, 60 cm, 100 cm, 160 cm, and 300 cm. For the RUC LSM, it is also - necessary to turn on five additional output levels in the - *wrf\_cntrl.parm* to output 9 instead of 4. (For the old RUC LSM, + 30 cm, 60 cm, 100 cm, 160 cm, and 300 cm. (For the old RUC LSM, there are only 6 layers and if using this, you will need to change “RUC LSM” from 9 to 6 in the WRFPOST.f routine.) @@ -475,104 +364,16 @@ output. Output on a given level is turned off by a 0 or turned on by a - For AGL radar reflectivity, the levels are 4000 and 1000 m (see Appendix A for details). -- For surface or shelter-level output, only the first position of the - line needs to be turned on. - - - For example, the sample control file *parm/wrf\_cntrl.parm* - has the following entry for surface dew point temperature: - - (SURFACE DEWPOINT ) SCAL=( 4.0) - - L=(00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 - 00000 00000 00000 00000) - - Based on this entry, surface dew point temperature will not be - output by unipost. To add this field to the output, modify the - entry to read: - - (SURFACE DEWPOINT ) SCAL=( 4.0) - - L=(10000 00000 00000 00000 00000 00000 00000 00000 00000 00000 - 00000 00000 00000 00000) - -GRIB2 control file ------------------- - -**Note** *: This section describes the control file for outputting -GRIB2 format.* - -Version 3.0 -~~~~~~~~~~~ - -- The xml file **parm/postcntrl.xml** replaces the **wrf\_cntrl.parm** - file to declare which fields you want to output from UPP. The samples - in **parm/wrfcnrtl.xml** are not exhaustive at this time and is - provided as a template only. Note that it will require edits by the - user to expand beyond the basic testing setup. - -- A list of available GRIB2 fields is in **parm/post\_avblflds.xml**. - UPP uses this file to define certain field parameters. Users may look - in this file to view a full list of available GRIB2 fields. Again, as - new fields are added or modified they will be provided. - -- To run grib2, copy a xml template to be named *postcntrl.xml* in - the *DOMAINPATH/parm/* directory as outlined below. Edit the xml - file as needed. - -Version 3.1 and Onward -~~~~~~~~~~~~~~~~~~~~~~ - -- For outputting GRIB2 format using version 3.1, a preprocessing step - is required by the user to convert the xml file - *parm/postcntrl.xml* to a flat text file - *postxconfig-NT.txt*. This new flat file is quicker to process - than the old xml file. The user will still need to edit the - *postcntrl.xml* file to declare which fields are to be output - from UPP. - -- In order to ensure that the user-edited xml files are error free, XML - stylesheets (*parm/EMC\_POST\_CTRL\_Schema.xsd* and - *EMC\_POST\_Avblflds\_Schema.xsd*) are used to validate both the - *postcntrl.xml* and *post\_avblflds.xml* files, respectively. - Confirmation of validation will be given (e.g. postcntrl.xml - validates) or otherwise return errors if it does not match the - schema. To run the validation: - - *xmllint --noout --schema EMC\_POST\_CTRL\_Schema.xsd - postcntrl.xml* - - *xmllint --noout --schema EMC\_POST\_Avblflds\_Schema.xsd - post\_avblflds.xml* - -- Once the xmls are validated, the user will need to generate the flat - file. Edit the *parm/makefile* if necessary to point to the - correct flat file directory and xmls. The makefile will call the perl - program *parm/POSTXMLPreprocessor.pl* to generate the post flat - file *postxconfig-NT.txt*. Generate the flat file: - - *make* - - **Note**\ *: The new flat file can only be used for running version - 3.1 and onward and is not backwards compatible with version 3.0.* +- For surface or shelter-level output, the is not necessary. Running UPP =========== -Seven scripts for running the UPP package are included in the tar file: - -**run\_unipost** - -**run\_unipostandgrads** - -**run\_unipostandgempak** +Scripts for running the UPP package are included in the tar file: -**run\_unipost\_frames** + *run\_unipost* -**run\_unipost\_gracet** - -**run\_unipost\_minute** - -**run\_unipostandgrads\_global** +Before running any of the above listed scripts, perform the following instructions: #. *cd* to your *DOMAINPATH* directory. @@ -580,41 +381,34 @@ Seven scripts for running the UPP package are included in the tar file: *mkdir postprd* -#. Make a directory to put a copy of *wrf\_cntrl.parm* file if - running grib1. If running grib2 copy *postcntrl.xml* for v3.0 or - *postxconfig-NT.txt* for v3.1+. +#. Make a directory to put a copy of *postxconfig-NT.txt*. *mkdir parm* #. Copy over the relevant control file to your working directory to customize *unipost* - For Grib1, copy the default *UPPV4.0/parm/wrf\_cntrl.parm* file. - - For Grib2, copy a template *UPPV3.0/parm/wrfcntrl.xml* if using - v3.0 or *UPPV4.0/parm/postxconfig-NT-WRF.txt* if using v3.1+. For - v4.0, a template *UPPV4.0/parm/postxconfig-NT-GFS.txt* **for FV3 - can be used.** + For WRF, copy the *UPPV4.0/parm/postxconfig-NT-WRF.txt* or for + FV3, copy the *UPPV4.0/parm/postxconfig-NT-GFS.txt*. -#. Edit the *wrf\_cntrl.parm* file to reflect the fields and levels - you want unipost to output. (For Grib2: Edit the *postcntrl.xml* - file for v3.0 or the *postxconfigNT.txt* file for v3.1+) + **Note:** *If you modified postcntrl.xml to reflect desired fields + and levels, you will need to be sure that you generated the new flat file + (please reference the section 'GRIB2 Control File' on how to do this)* -#. Copy over the (*UPPV4.0/scripts/run\_unipost*\*) script of your - choice to the *postprd/*. +#. Copy over the (*UPPV4.0/scripts/run\_unipost*) script to **postprd/**. #. Edit the run script as outlined below. Once these directories are set - up and the edits outlined below are complete, the scripts can be run - interactively from the *postprd* directory by simply typing the + up and the edits outlined below are complete, the script can be run + interactively from the **postprd** directory by simply typing the script name on the command line. Overview of the scripts to run the UPP -------------------------------------- **Note** *: It is recommended that the user refer to the -run\_unipost scripts in the script* +run\_unipost scripts in the script/ while reading this overview.* -Since V3.0, user modified variables are now all contained at the top of +User modified variables are all contained at the top of the *run\_unipost* script in one user-edit section, along with a brief description. Descriptions below follow the *run\_unipost* script. @@ -630,21 +424,16 @@ script. **POSTEXEC** : Location of the *UPPV4.0* executables **modelDataPath** : Location of the model output data files to be - processed (e.g. *wrfprd/* for WRF-based runs). - - **paramFile** : Name and location of cntrl.parm - (*wrf\_cntrl.parm*) text file that lists desired fields for GRIB1 - output. Template in *UPPV4.0/parm/* + processed (e.g. **wrfprd/** for WRF-based runs). **txtCntrlFile** : Name and location of *postxconfig-NT.txt* - file that lists desired fields for GRIB2 format for version 3.1+. + file that lists desired fields for GRIB2 format. This file is generated by the user following the steps listed above - in the GRIB2 Control File section. + in the *'GRIB2 Control File'* section. - **Note** *: For WRF, the scripts are configured such that + **Note:** *For WRF, the scripts are configured such that unipost expects the WRF history files (wrfout - files) to be in wrfprd/, the wrf\_cntrl.parm - (postcntrl.xml or postxconfig-NT.txt) file to be + files) to be in wrfprd/, the postxconfig-NT.txt file to be in parm/ and the postprocessor working directory to be called postprd/, all under DOMAINPATH* @@ -654,21 +443,18 @@ script. #. Specify dynamic core being run (ARW or FV3) - **dyncore** : What model core is used (ARW or FV3) + **dyncore**: What model core is used (ARW or FV3) #. Specify the format for the input model files and output UPP files. - **inFormat** : Format of the model data - - arw netcdf + **inFormat**: Format of the model data - fv3 binarynemsio + arw - "netcdf" + fv3 - "binarynemsiompiio" - **outFormat** : Format of output from UPP + **outFormat**: Format of output from UPP - grib - - grib2 + "grib2" #. Specify the forecast cycles to be post-processed @@ -680,7 +466,7 @@ script. **incrementhr** : Increment (in hours) between forecast files - Do not set to 0 or the script will loop continuously + \*Do not set to 0 or the script will loop continuously #. Set up how many domains will be post-processed @@ -702,139 +488,58 @@ script. >> LINUX-MPI systems: *mpirun -np N unipost.exe > outpost 2>&1* - (**Note** *: on some systems a host file also needs to be - specified: machinefile host*) + (**Note:** *on some systems a host file also needs to be + specified: -machinefile "host"*) >> IBM: *mpirun.lsf unipost.exe < itag > outpost* - >> SGI MPT: *mpiexec\_mpt* - -#. Set copygb grid definitions (optional - uncomment copygb section in - script to run) - - - copygb\_opt : Copygb grid option to regrid - - awips = Use a predefined awips grid, e.g. 212 \*\* Uncomment - export awips\_id= and add desired grid number. - - custom = Specify your own grid \*\* Uncomment export custom\_gds= - and add grid description. - - **Note** *: More information about copygb is provided - below under Examples of copygb. Copygb runs on - GRIB1 format only. For GRIB2 format, wgrib2 is required, with - more information provided below under "Examples of wgrib2"* + >> SGI MPT: *mpiexec\_mpt unipost.exe < itag > outpost* #. Set naming convention for prefix and extension of output file name - - **comsp** is the initial string of the output file name (by - default it is not set and the prefix of the output file will be - the string set in *wrf\_cntrl.parm DATSET*, if set it - will concatenate the setting to the front of the string specified - in *wrf\_cntrl.parm DATSET* + - **comsp** is the initial string of the output file name (by default + it is not setand the prefix of the output file will be the string set + in the tag of the *postcntrl.xml*). - **tmmark** is used for the file extension (in *run\_unipost*, *tmmark=tm00*, if not set, it is set to .GrbF) -Since V3.0, the itag that will be read in by *unipost.exe* from +The itag that will be read in by *unipost.exe* from stdin (unit 5) is generated automatically in the *run\_unipost* script based on the user-defined options above. It should not be necessary to edit this. For description purposes, the namelist -(*itag*) contains 5 (6) lines for WRF (FV3): +(*itag*) contains 6 lines for FV3: -#. Name of the WRF or FV3 (pressure level) output file to be posted. +#. Name of the FV3 (pressure level) output file to be posted. -#. Format of WRF or FV3 model output (netcdf, binarynemsio). +#. Format of FV3 model output (netcdf, binarynemsio). -#. Format of UPP output (GRIB1 or GRIB2) +#. Format of UPP output (GRIB2) -#. Forecast valid time (not model start time) in WRF or FV3 format (the +#. Forecast valid time (not model start time) in FV3 format (the forecast time desired to be post-processed). -#. Dynamic core used (NCAR or GFS). +#. Dynamic core used (GFS). #. Name of the FV3 (surface) output file to be post-processed. -**Note:** *If the third line (i.e., UPP output type) is not set, UPP will default the output le format to grib1. -This is only for WRF since UPP output for FV3 only supports GRIB2.* +**Note:** *If the third line (i.e., UPP output type) is not set, UPP will default the output file format to "grib1". +UPP output for FV3 only supports GRIB2.* If scripts *run\_unipostandgrads* or *run\_unipostandgempak* are used, additional steps are taken to create image files (see Visualization section below). -Upon a successful run, *unipost* and *copygb* (optional) will -generate output files *WRFPRS\_dnn.hh* (*GFSPRS.hh*) and -*wrfprs\_dnn.hh* (*gfsprs.hh*), respectively, in the -postprocessor working directory, where *nn* refers to the domain id and -*hh* denotes the forecast hour. In addition, the script +Upon a successful run, *unipost* will generate output files *GFSPRS.hh* in the postprocessor working directory, where *nn* refers to +the domain id and *hh* denotes the forecast hour. In addition, the script *run\_unipostandgrads* will produce a suite of png images named *variablehh\_GrADS.png*, and the script *run\_unipostandgempak* will produce a suite of gif images named *variablehh.gif*. If the run did not complete successfully, a log file in the -post-processor working directory called *unipost\_dnn.hh.out* -(*unipost.hh.out*), where *nn* is the domain id and *hh* is the +post-processor working directory called *unipost.hh.out*, where *nn* is the domain id and *hh* is the forecast hour, may be consulted for further information. -Examples of copygb -================== - -Sample command line for calling copygb: - - *copygb.exe -xg"grid [kgds]" input\_file output\_file* - -where *grid* refers to the output grid to which the native forecast -is being interpolated. - -The output grid can be specified in three ways: - -#. As the grid id of a pre-defined AWIPS grid number (gridno): - - *copygb.exe -g${gridno} -x input\_file output\_file - - For example, using grid 218: - - *copygb.exe -xg"218" WRFPRS_$domain.${fhr} wrfprs\_$domain.${fhr} - -#. As a user defined standard grid, such as for grid 255: - - *copygb.exe xg"255 kgds" input\_file output\_file* - - where the user defined grid is specified by a full set of kgds - parameters determining a GRIB GDS (grid description section) in the - *W3fi63* format. Details on how to specify the kgds parameters - are documented in file *lib/w3lib/w3fi71.f*. For example: - - *copygb.exe -xg" 255 3 109 91 37719 -77645 8 -71000 10433 9966 0 64 42000 42000" - WRFPRS\_$domain.${fhr} wrfprs\_$domain.${fhr}* - -#. From a file: When WRF-ARW output is processed by *unipost*, a - text file, *copygb\_hwrf.txt*, is created. This file contain the - GRID GDS of a lat/lon grid similar in domain and grid spacing to the - one used to run the WRF-ARW model. The contents of this file can be - read into the variable “nav” and can be used as input to - *copygb.exe*. - - *copygb.exe -xg"$nav" input\_file output\_file* - - For example, when using *copygb\_hwrf.txt* for an application, - the steps include: - - *read nav < ’copygb\_hwrf.txt’* - - *export nav* - - *copygb.exe -xg"${nav}" WRFPRS\_$domain.${fhr}* - - *wrfprs\_$domain.${fhr}* - -It should be noted that copygb is a flexible program that can accept -several command line options specifying details of how the horizontal -interpolation from the native grid to the output grid should be -performed. Complete documentation of copygb can be found at: - -http://www.dtcenter.org/met/users/support/online_tutorial/METv5.0/copygb/copygb.txt - Examples of wgrib2 ================== @@ -851,35 +556,35 @@ Sample command line usage for calling wgrib2: Where, -**W** = earth or grid + **W** = earth or grid - earth: winds oriented to the earths north and south directions + earth: winds oriented to the earths north and south directions - grid: winds are rotated so that north is relative to the grid + grid: winds are rotated so that north is relative to the grid -**A**, **B**, and **C** represent the output grid description + **A**, **B**, and **C** represent the output grid description -Sample lat-lon grid description: + Sample lat-lon grid description: -**A** = latlon + **A** = latlon -**B** = lon0:nlon:dlon + **B** = lon0:nlon:dlon - lon0 is longitude of first grid point in degrees + lon0 is longitude of first grid point in degrees - nlon is number of longitudes + nlon is number of longitudes - dlon is grid resolution in degrees of longitude + dlon is grid resolution in degrees of longitude -**C** = lat0:nlat:dlat + **C** = lat0:nlat:dlat - lat0 is latitude of first grid point + lat0 is latitude of first grid point - nlat is number of latitudes + nlat is number of latitudes - dlat is grid resolution in degrees of latitude + dlat is grid resolution in degrees of latitude -**Note:** *At this time, wgrib2 is not distributed within the UPP tar +**Note:** *wgrib2 is not distributed within the UPP tar file. Users may download and install from http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/.* @@ -895,8 +600,8 @@ GRIB files generated by the UPP package and plot horizontal fields or vertical cross sections. A sample script named *run\_unipostandgempak*, which is included in -the scripts directory of the tar file, can be used to run *unipost*, -*copygb*, and plot the following fields using GEMPAK: +the scripts directory of the tar file, can be used to run *unipost* +and plot the following fields using GEMPAK: - **Sfcmap\_dnn\_hh.gif**: mean SLP and 6 hourly precipitation @@ -928,13 +633,11 @@ executables. For example, GrADS ----- -The GrADS utilities *grib2ctl.pl* (*g2ctl.pl*) and *gribmap* -are able to decode GRIB1 (GRIB2) files whose navigation is on any +The GrADS utilities *g2ctl.pl* and *gribmap* +are able to decode GRIB2 files whose navigation is on any non-staggered grid. These utilities and instructions on how to use them to generate GrADS control files are available from: -http://www.cpc.ncep.noaa.gov/products/wesley/grib2ctl.html (GRIB1) - http://www.cpc.ncep.noaa.gov/products/wesley/g2ctl.html (GRIB2). The GrADS package is available from: @@ -948,8 +651,7 @@ http://cola.gmu.edu/grads/gadoc/reference_card.pdf. A sample script named *run\_unipostandgrads*, which is included in the scripts directory of the Unified Post Processing package, can be -used to run *unipost*, *copygb*, and plot the following fields -using GrADS: +used to run *unipost* and plot the following fields using GrADS: - **Sfcmaphh\_dnn\_GRADS.png**: mean SLP and 6-hour accumulated precipitation. @@ -979,8 +681,8 @@ to: #. Link script *cbar.gs* to the post-processor working directory. (This scripts is provided in UPP package, and the - *run\_unipostandgrads* script makes a link from *scripts/* to - *postprd/*.) To generate the plots above, GrADS script + *run\_unipostandgrads* script makes a link from **scripts/** to + **postprd/**.) To generate the plots above, GrADS script *cbar.gs* is invoked. This script can also be obtained from the GrADS library of scripts at http://cola.gmu.edu/grads/gadoc/library.html. @@ -988,18 +690,8 @@ to: Fields produced by unipost ========================== -The 3 tables described below contain documentation regarding the fields -that are available for output by UPP for both GRIB1 and GRIB2. - -Grib1 Table: ------------- - -https://dtcenter.org/upp/users/docs/tables/UPP_GRIB1_Table.pdf - -This table lists basic and derived fields currently produced by unipost -for grib1. The abbreviated names listed in the second column of each -table describe how the fields should be entered in the -*wrf\_cntrl.parm*. +The 2 tables described below contain documentation regarding the fields +that are available for output by UPP for GRIB2. Grib2 Table: ------------ @@ -1011,15 +703,6 @@ for grib2. The abbreviated names listed in the second column of each table describe how the fields should be entered in the *post\_cntrl.xml*. -Grib2 Table (Extended): ------------------------ - -https://dtcenter.org/upp/users/docs/tables/UPP_GRIB2_Extended_Table.pdf - -This table lists basic and derived fields currently produced by -*unipost* for grib2 and includes the parameter information which UPP -uses for identifying fields for GRIB2. - Appendix A: UPPV3.1+ Reflectivity field descriptions ==================================================== @@ -1054,507 +737,6 @@ Fills 2-D composite reflectivity array (UPP ID: 252) **MDL2P.f** - Interpolates relevant DBZ array to pressure levels (UPP ID: 251) -Appendix B: Adding a new variable to the UPP code -================================================= - -*This document provides general procedures and an example of how to add -a new variable to the UPP code. Please keep in mind it may not be an -exhaustive step-by-step depending on your particular situation. While we -can provide general assistance for adding a new variable, users should -be aware that this requires good knowledge of Fortran and thorough -understanding of the code.* - -*We encourage users to contact us at upp-help@ucar.edu to make us aware -of modifications you are making. In some cases, if we determine the -changes you are making may be relevant for operational and/or community -purposes, we will be interested in incorporating your changes into the -code base for support and future release. We would then work with you to -make this possible.* - -**** - -#. Allocate the field: ALLOCATE.f - - *This file is the instantiation or allocation of the* **variable** - -#. Deallocate the field: DEALLOCATE.f - -#. Declare the new variable: VRBLS2D\_mod.f, VRBLS3D\_mod.f or - VRBLS4D\_mod.f - -#. Define field for grib1: RQSTFLD.f - -#. Read model output: INITPOST.F - -#. Determine routine for filling variable: e.g SURFCE.f, MDLFLD.f, - MDL2P.f, etc. - -#. Define table/grib2 parameters/ for grib2 output: - params\_grib2\_tbl\_new - -#. Define the field for grib2 output: post\_avlbflds.xml - -#. Define control file entry for output: postcntrl.xml & - postxconfig-NT.txt - -#. Define output control file: wrf\_cntrl.parm - - *This file is used for controlling which fields are output by UPP for - grib1.* - -**** - -- This example illustrates a new variable from the WRF output that will - be read into UPP and directly output into the grib output files (i.e. - no additional computations/calculations are needed for the field). - -- Note that while grib1 procedures are provided, we have moved to grib2 - almost exclusively. As such support for grib1 additions is limited. - -- Additions to each of the routines are highlighted in ````. - -- Locations of **** are in /UPPV3.2/src/unipost unless specified - otherwise. - -- A sample wrfout file for the following procedures is available for - download from: - - - https://dtcenter.org/upp/users/downloads/data/AddNewVariableData.tar.gz - - - This data is the 6-hr forecast of a WRF initialization of - 2009-12-17\_12:00:00 - -**** - -```` - -```` - -```` - -```` - -```` - -```` - -```` - -#. Allocate the new variable in **** This file is the instantiation or - allocation of the variable. Note that the variables are defined based - on the parallel processing capability of UPP - use an example from - the file. - - **** - - - Add in VRBLS2D section as: - - ````\ **** - -#. De-allocate the variable to give the resources back in **** All good - programmers give back their resources when they are done. Please - update this routine to return your resource to the system. - - **** - - - Add as: - - ````\ **** - -#. Declare the new variable in the appropriate file depending on its - dimensions; ****, **** or **** - - **** - - - **** is a 2-dimensional field, so declare it in **** - - - Add to the end of the first section of allocations as: - - ````\ **** - -#. List the new variable in **** which includes a list of all possible - fields to be output by UPP, as well as the corresponding key-word - character string the user places in **** file, the UPP ID for - internal code, and grib IDs. Be sure to pick a unique identifier that - is not already used for the new variable. The unique identifier or - index are typically assigned in groups - hopefully a community area - will be added in the future - or a defined method to avoid - overwriting others values. Right now we are using 900’s for community - contributions. - - **** - - ``! HWRF addition for v_flux as pass through variable:`` - - ``DATA ``\ ````\ ``(``\ ````\ ``),``\ ````\ ``(``\ ````\ ``),``\ ````\ ``(``\ ````\ ``),``\ ````\ ``(``\ ````\ ``),``\ ````\ ``(``\ ````\ ``) &`` - - ````\ ````\ ``,’``\ ````\ ``,``\ ````\ ``,``\ ````\ ``, &`` - - ````\ ````\ ``/`` - - Where: - - - **** - - - **** - - - **** - - - **** - - - **** - - - **** - - **** - - - A latent heat flux variable (LHTFL) was found in the GRIB1 - parameter tables, so add a new unused parameter number (237) using - Table 130 to define the new field. - - http://www.nco.ncep.noaa.gov/pmb/docs/on388/table2.html - - - Used level type surface, which is 001 - - http://www.nco.ncep.noaa.gov/pmb/docs/on388/table3.html - - - Add as: - - ```` - - ```` - - ````\ **** - -#. Read the model output field from the wrfout file by adding the new - variable into **** This file is used for reading the WRF-ARW model - output files in netcdf format. - - **** - - - Add using the 2D variable **** (snowfall accumulation), which is - also a 2D surface based accumulation field, as a template by - following it through the routine. - - - Add to top section of the routine in use vrbls2d to initiate the - new variable as: - - ```` - - - Read in the new variable as: - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - -#. Determine the correct routine to add the new variable to (e.g. ****, - ****, ****, etc). You will need to determine the correct routine to - add your field into; this is the place that you will fill the array - with the data and call gribit to output the field. The correct - routine will depend on what your field is. For example, if you have a - new diagnostic called foo, and you want it interpolated to pressure - levels, you would need to add it to ****. If foo was only a surface - variable, you would add it to ****. If you wanted foo on native model - levels, you would add it to ****. If youre not sure which routine to - add the new variable to, choose a similar variable as a template. - - *Note:* This is also where you would add any calculations needed for - your new variable, should it be required. - - **** - - - Treat ACLHF like a surface field (****) - - - Using the variable **** (accumulated depth of snowfall) as a - template which is also an accumulated field that is just being - read through and output, similar to what we want. - - - Add in top section in use vrbls2d, only to initiate the new - variable as: - - ```` - - - Add in main section using the template variable as a guide. - - - Note that ID(02), which is the ID for table version number, is - added and set to 130. This is the table that we are adding the - new variable to. - - - The block of code in ```` is for metadata for the accumulation - field being added in this example and the user does not need to - edit it and it is not always needed. For example, for an - instantaneous field, you would not need that block. - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - -#. For grib2 output, add the new variable to - /UPPV3.2/src/lib/g2tmpl/****. For all current UPP output fields, this - table lists, in order, the: - - - Discipline - (http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table0-0.shtml) - - - Category - (http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-1.shtml) - - - Parameter Number - (http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-2.shtml) - - - Table information (0 for parameters from the WMO table; 1 for - parameters from the local NCEP table) - - - Abbreviated Variable Name (from the parameters table) - - **** - - - Since there is already a latent heat flux (LHTFL) parameter in - this table, create a new Latent Heat Flux parameter so as to not - overwrite the current one, just in case you want both to be output - - - Latent heat flux is a meteorological field (discipline=0) - - - Latent heat flux is a temperature product (category=0) - - - Pick an unused parameter number from the table defined by - discipline=0 and category=0 (Table 4.2-0-0: - http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-2-0-0.shtml). - In this case, the unused parameter number 205 was chosen. - - - Add using the NCEP local table (table=1) - - - Choose an abbreviated parameter name to describe your field (e.g. - ACLHF) - - - Add as: - - ```` - -#. Add the new variable to the /UPPV3.2/parm/****, which lists all - fields available for output in GRIB2 format. - - - Post\_avblfldidx: the unique array number given in the RQSTFLD.f - routine. - - - Shortname: name describing the variable and level type - - - Pname: the abbreviation for your variable - - - Table info: table used if not standard WMO - - - Fixed\_sfc1\_type: level type - - - Scale: precision of data written out to grib2 file - - **** - - - Add as: - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - - ```` - -#. Add the new variable to the /UPPV3.2/parm/****, which lists all - fields and levels you wish to output for GRIB2. Remake the - /UPPV3.2/parm/**** file, which contains the information from the xml - that UPP reads. - - - See the Users guide on steps for creating the text control file - - **** - - - Add as: - - ```` - - ```` - - ```` - - ```` - - ```` - -#. Add the new variable to the /UPPV3.2/parm/**** file, which lists all - fields and levels you wish to output for GRIB1. - - **** - - - Add as: - - ```` - - ```` - - \*\* Note the first entry is turned from 0 to 1. This turns on the - first level. - -#. Run clean on the code and recompile the code to include the changes - before running your UPP run script. - - **** - -#. Assuming the modified code compiled successfully and you were able to - produce grib output, you can check the grib file for your new - variable. - - **** output of the new variable from this example procedure (using - the wgrib2 utility if available on your system). - - - The new variable will not be defined by the variable name. Instead - it will be defined using the grib2 parameter information you - entered into **** from step 7 of this procedure. - - ``456:43204412:vt=2009121718:``\ ````\ ``:6 hour fcst:var ``\ ````\ `` center=7 ``\ ````\ `` ``\ ````\ ``:`` - - ``ndata=121002:undef=0:mean=1.97108e+06:min=-1.12e+06:max=2.406e+07`` - - ``grid_template=30:winds(grid):`` - - ``Lambert Conformal: (402 x 301) input WE:SN output WE:SN res 8`` - - ``Lat1 14.807213 Lon1 231.818604 LoV 258.040009`` - - ``LatD 38.270000 Latin1 38.270000 Latin2 38.270000`` - - ``LatSP 0.000000 LonSP 0.000000`` - - **** output of the new variable from this example procedure (using - the wgrib utility if available on your system). - - - The new variable will not be defined by the variable name. Instead - it is defined by ```` (grib1 ID) and ```` (level type) you gave it - in **** in step 4. - - - For this particular variable, the accumulation period is shown, - due to the addition of the metadata block in the **** routine. - - ``rec 319:59903982:date 2009121712 ``\ ````\ `` ``\ ````\ `` kpds7=0 levels=(0,0) grid=255 sfc ``\ ````\ ``:`` - - ```` - - ``timerange 0 P1 6 P2 0 TimeU 1 nx 402 ny 301 GDS grid 3 num_in_ave 0 missing 0 center 7 subcenter 0 process 125 ``\ ````\ `` scan: WE:SN winds(grid)`` - - ``Lambert Conf: Lat1 14.807000 Lon1 231.819000 Lov 258.040000`` - - ``Latin1 38.270000 Latin2 38.270000 LatSP 0.000000 LonSP 0.000000`` - - ``North Pole (402 x 301) Dx 15.000000 Dy 15.000000 scan 64 mode 136`` - - ``min/max data -1.1217e+06 2.40583e+07 num bits 12 BDS_Ref -112.17 DecScale -4 BinScale ``\ 0 Acknowledgement @@ -1565,5 +747,4 @@ Mesoscale Modeling Team. For referencing this document please use: UPP Users Guide V3.0, 34 pp. [available online at -http://www.dtcenter.org/upp/users/docs/user\_guide/V3/upp\_users\_guide.pdf -] +http://www.dtcenter.org/upp/users/docs/user\_guide/V3/upp\_users\_guide.pdf] From 0fe3bc574757b17306f115fff964a85933fde4e5 Mon Sep 17 00:00:00 2001 From: Tracy Date: Wed, 18 Dec 2019 12:41:10 -0700 Subject: [PATCH 24/85] Add a readthedocs config file --- .readthedocs.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 000000000..62c3cb027 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,23 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Build documentation with MkDocs +#mkdocs: +# configuration: mkdocs.yml + +# Optionally build your docs in additional formats such as PDF and ePub +formats: all + +# Optionally set the version of Python and requirements required to build your docs +#python: +# version: 3.7 +# install: +# - requirements: docs/requirements.txt \ No newline at end of file From cc6208c5dcbeac88f8fbe6ba5ecee13b1c79a220 Mon Sep 17 00:00:00 2001 From: Tracy Date: Wed, 18 Dec 2019 12:49:54 -0700 Subject: [PATCH 25/85] Mods to config and index files for use in readthedocs --- docs/conf.py | 2 ++ docs/index.rst | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 8b29cc76e..ae4186a60 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,6 +41,8 @@ # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [] +# The master toctree document. +master_doc = 'index' # -- Options for HTML output ------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index c347c3843..610e310d1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,7 +10,7 @@ Welcome to upp_docs's documentation! :maxdepth: 2 :caption: Contents: - UPP_Users_guide_V4_ufs + UPP_Users_guide_V4 Indices and tables ================== From 69174f46bb1455f57e004ac946573c07b4e6e0c0 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 23 Dec 2019 11:36:00 -0700 Subject: [PATCH 26/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index dc412e591..c4b0f3106 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit dc412e59146c8a04cc87867d5ac1e16d7926d5f4 +Subproject commit c4b0f3106d2b669a904c0bdb2fbb2146e97ebdde From 936859fa8a76a00f6bbb9addd4b2f34703b33aa9 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 23 Dec 2019 14:18:18 -0700 Subject: [PATCH 27/85] Remove old GNU makefiles with problematic names (only differing in case from existing files) --- sorc/ncep_post.fd/CMakeLists.txt | 6 +- sorc/ncep_post.fd/Makefile.dom.moveaside | 70 ----- sorc/ncep_post.fd/Makefile_lib.dom.moveaside | 74 ----- sorc/ncep_post.fd/makefile | 306 +++++++++++++++---- 4 files changed, 250 insertions(+), 206 deletions(-) delete mode 100644 sorc/ncep_post.fd/Makefile.dom.moveaside delete mode 100644 sorc/ncep_post.fd/Makefile_lib.dom.moveaside diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 92775a0fc..ad4fd0a21 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -186,10 +186,10 @@ set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_FLAGS} ) set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS} ) +add_dependencies(${EXENAME} ${LIBNAME}) -include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ${CMAKE_INSTALL_PREFIX}/include_4 ) -target_link_libraries(${EXENAME} ${BACIO_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${SIGIO_LIB} ${NEMSIO_LIB} ${IP_LIB4} ${SFCIO_LIB} ${W3EMC_LIB4} ${ZLIB} ${G2TMPL_LIBd} ${G2_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${GFSIO_LIB4} ${CRTM_LIB} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${BACIO_LIB4} ) - +include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ) +target_link_libraries(${EXENAME} ${LIBNAME} ${SP_LIB4} ${SIGIO_LIB} ${SFCIO_LIB} ${GFSIO_LIB4} ${NEMSIO_LIB} ${IP_LIB4} ${W3EMC_LIB4} ${W3NCO_LIB4} ${G2TMPL_LIBd} ${G2_LIB4} ${CRTM_LIB} ${BACIO_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin diff --git a/sorc/ncep_post.fd/Makefile.dom.moveaside b/sorc/ncep_post.fd/Makefile.dom.moveaside deleted file mode 100644 index be85a6c99..000000000 --- a/sorc/ncep_post.fd/Makefile.dom.moveaside +++ /dev/null @@ -1,70 +0,0 @@ -################################################################################ -# -# Makefile for NCEP Post -# -# Use: -# make - build the executable -# make clean - start with a clean slate -# -################################################################################# -# -# Define the name of the executable -# -TARGET = ncep_post -# - -OBJS = wrf_io_flags.o getVariable.o getIVariable.o getIVariableN.o \ - kinds_mod.o machine.o physcons.o \ - native_endianness.o blockIO.o initialize_byte_swap_wrf_binary_file.o \ - count_recs_wrf_binary_file.o inventory_wrf_binary_file.o \ - next_buf.o retrieve_index.o ZENSUN.o CLDFRAC_ZHAO.o \ - GFSPOST.o GETGBANDSCATTER.o \ - VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ - CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o xml_perl_data.o \ - cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o \ - SET_LVLSXML.o FILL_PSETFLD.o \ - BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ - CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o \ - CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ - CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALRH_PW.o \ - CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ - CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o DEWPOINT.o \ - FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ - GET_BITS.o GRIBIT.o INITPOST.o LFMFLD.o \ - MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o MPI_FIRST.o MPI_LAST.o \ - NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ - PARA_RANGE.o PROCESS.o INITPOST_NMM.o EXCH2.o \ - READCNTRL.o READ_xml.o SET_OUTFLDS.o SCLFLD.o SERVER.o SETUP_SERVERS.o \ - SMOOTH.o SURFCE.o \ - SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o WRFPOST.o \ - CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ - ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ - AVIATION.o DEALLOCATE.o INITPOST_NMM_BIN_MPIIO.o \ - CALPBL.o MDL2SIGMA2.o INITPOST_GFS.o CALRH_GFS.o LFMFLD_GFS.o \ - CALRAD_WCLOUD_newcrtm.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ - INITPOST_NEMS.o GETNEMSNDSCATTER.o ICAOHEIGHT.o INITPOST_GFS_NEMS.o \ - INITPOST_BIN_MPIIO.o GEO_ZENITH_ANGLE.o GFIP3.o GRIDAVG.o CALUPDHEL.o \ - INITPOST_GFS_SIGIO.o AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o INITPOST_NEMS_MPIIO.o ASSIGNNEMSIOVAR.o - -# - -.SUFFIXES: .F .f .o .f90 .c - -.F.f: - $(CPP) $(CPPFLAGS) $< > $*.f - -$(TARGET): $(OBJST) $(OBJS) - $(FC) -openmp -o $@ $(OBJST) $(OBJS) $(LIBS) - -.f.o: - $(FC) $(FFLAGS) -c $< - -.f90.o: - $(FC) $(FFLAGS) -c $< - -.c.o : - ${CC} ${CFLAGS} -c $< - -clean: - /bin/rm -f $(TARGET) *.lst *.o *.mod - diff --git a/sorc/ncep_post.fd/Makefile_lib.dom.moveaside b/sorc/ncep_post.fd/Makefile_lib.dom.moveaside deleted file mode 100644 index 6ea399e6a..000000000 --- a/sorc/ncep_post.fd/Makefile_lib.dom.moveaside +++ /dev/null @@ -1,74 +0,0 @@ -################################################################################ -# -# Makefile for NCEP Post -# -# Use: -# make - build the executable -# make clean - start with a clean slate -# -################################################################################# -# -# Define the name of the executable -# -TARGET = ${POSTLIBPATH}/libnceppost.a -INCMOD = ${POSTLIBPATH}/include/post_4 -AR = ar -ARFLAGS = ruv -# - -OBJS = wrf_io_flags.o getVariable.o getIVariable.o getIVariableN.o \ - kinds_mod.o machine.o physcons.o \ - native_endianness.o blockIO.o initialize_byte_swap_wrf_binary_file.o \ - count_recs_wrf_binary_file.o inventory_wrf_binary_file.o \ - next_buf.o retrieve_index.o ZENSUN.o CLDFRAC_ZHAO.o \ - GFSPOST.o GETGBANDSCATTER.o \ - VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ - CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o xml_perl_data.o \ - cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o \ - SET_LVLSXML.o FILL_PSETFLD.o \ - BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ - CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o \ - CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ - CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALRH_PW.o \ - CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ - CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o DEWPOINT.o \ - FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ - GET_BITS.o GRIBIT.o INITPOST.o LFMFLD.o \ - MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o MPI_FIRST.o MPI_LAST.o \ - NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ - PARA_RANGE.o PROCESS.o INITPOST_NMM.o EXCH2.o \ - READCNTRL.o READ_xml.o SET_OUTFLDS.o SCLFLD.o SERVER.o SETUP_SERVERS.o \ - SMOOTH.o SURFCE.o \ - SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o WRFPOST.o \ - CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ - ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ - AVIATION.o DEALLOCATE.o INITPOST_NMM_BIN_MPIIO.o \ - CALPBL.o MDL2SIGMA2.o INITPOST_GFS.o CALRH_GFS.o LFMFLD_GFS.o \ - CALRAD_WCLOUD_newcrtm.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ - INITPOST_NEMS.o GETNEMSNDSCATTER.o ICAOHEIGHT.o INITPOST_GFS_NEMS.o \ - INITPOST_BIN_MPIIO.o GEO_ZENITH_ANGLE.o GFIP3.o GRIDAVG.o CALUPDHEL.o \ - INITPOST_GFS_SIGIO.o AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o INITPOST_NEMS_MPIIO.o ASSIGNNEMSIOVAR.o - -# - -.SUFFIXES: .F .f .o .f90 .c - -.F.f: - $(CPP) $(CPPFLAGS) $< > $*.f - -$(TARGET): $(OBJST) $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJST) $(OBJS) - mv *.mod $(INCMOD) - -.f.o: - $(FC) $(FFLAGS) -c $< - -.f90.o: - $(FC) $(FFLAGS) -c $< - -.c.o : - ${CC} ${CFLAGS} -c $< - -clean: - /bin/rm -f $(TARGET) *.lst *.o *.mod - diff --git a/sorc/ncep_post.fd/makefile b/sorc/ncep_post.fd/makefile index be85a6c99..7a0a614d8 100644 --- a/sorc/ncep_post.fd/makefile +++ b/sorc/ncep_post.fd/makefile @@ -1,70 +1,258 @@ -################################################################################ -# -# Makefile for NCEP Post -# -# Use: -# make - build the executable -# make clean - start with a clean slate -# -################################################################################# -# -# Define the name of the executable -# -TARGET = ncep_post +#!/bin/ksh +set -x +mac=$(hostname | cut -c1-1) +mac2=$(hostname | cut -c1-2) +################################# options ############################################### +#export CLEAN=NO # comment this line to clean before compiling +#debug=YES # turn on debug mode - default - NO + make_post_lib=YES # create post library - default - NO + make_post_exec=YES # create post executable - default - YES +#make_nowrf=YES # compile with wrf stub instead of WRF lib +################################# options ############################################### # +if [ $mac2 = ga ] ; then # For GAEA + machine=gaea + center=${center:-ncep} + make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib +elif [ $mac2 = tf ] ; then # For Theia + machine=theia + make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib +elif [ $mac = z -o $mac = h -o $mac = f ] ; then # For ZEUS + machine=zeus + make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib +elif [ $mac = t -o $mac = e -o $mac = g ] ; then # For WCOSS + machine=wcoss +elif [ $mac = l -o $mac = s ] ; then # wcoss_c (i.e. luna and surge) + export machine=wcoss_c + make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib +fi +debug=${debug:-NO} +export make_post_lib=${make_post_lib:-NO} +export make_post_exec=${make_post_exec:-YES} +export make_nowrf=${make_nowrf:- NO} +if [ $machine = wcoss ] ; then + export NETCDFPATH="/usrx/local/NetCDF/3.6.3" + export WRFPATH="/nwprod/sorc/wrf_shared.v1.1.0" + export NWPROD="/nwprod" + export XMLPATH=$NWPROD + export IPPATH=$NWPROD + export SPPATH=/usrx/local/nceplibs + export BACIOPATH=/usrx/local/nceplibs + export ipv="" + export spv=_v2.0.2p + export crtmv=2.0.6 + export crtmv_inc=$crtmv + export xmlv=_v2.0.0 + export baciov=_v2.0.1p + export FC=mpiifort + export CPP="/lib/cpp -P" + export CPPFLAGS="-DLINUX" + export CC=cc + if [ $debug = YES ] ; then + export OPTS="-O0 -openmp " + export DEBUG="-g -traceback -convert big_endian -ftrapuv -check bounds -check format -check output_conversion -check pointers -check uninit -fp-stack-check" + else + export OPTS="-O3 -convert big_endian -fp-model source -openmp -xAVX" + export DEBUG="" + fi + export LIST="" + export FREE="-FR" + export TRAPS="" + export PROFILE="" +elif [ $machine = wcoss_c ] ; then + export FC=ftn + export CPP="/lib/cpp -P" + export CPPFLAGS="-DLINUX" + export CC=cc + if [ $debug = YES ] ; then + export OPTS="-O0 -openmp " + export DEBUG="-g -traceback -convert big_endian -ftrapuv -check bounds -check format -check output_conversion -check pointers -check uninit -fp-stack-check" + else + export OPTS="-O3 -convert big_endian -fp-model source -openmp -xAVX" + export DEBUG="" + fi + export LIST="" + export FREE="-FR" + export TRAPS="" + export PROFILE="" +elif [ $machine = zeus ] ; then + export NETCDFPATH="/apps/netcdf/3.6.3/intel" + export WRFPATH="/scratch2/portfolios/NCEPDEV/meso/save/Dusan.Jovic/WRFV3" + export NWPROD="/contrib/nceplibs/nwprod" + export XMLPATH="/home/Hui-Ya.Chuang" + export IPPATH=$NWPROD + export SPPATH=$NWPROD + export ipv="" + export spv=_v2.0.1 + export crtmv=2.0.7 + export FC="ifort -lmpi" + export CPP="/lib/cpp -P" + export CC=cc + export ARCH="" + export CPPFLAGS="-DLINUX" + if [ $debug = YES ] ; then + export OPTS="-O0 -openmp -g" + export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" + else + export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source -openmp" + export DEBUG="" + fi + export LIST="" + export FREE="-FR" + export TRAPS="" + export PROFILE="" +elif [ $machine = theia ] ; then + export NETCDFPATH="/apps/netcdf/4.3.0-intel" + export WRFPATH="/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/theia/nceplibs/nwprod/lib/sorc/WRFV3" + export NWPROD="/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/theia/nceplibs/nwprod" + export ipv=_v2.0.3 + export spv="" + export crtmv=2.0.7 + export gfsiov="" + export w3ev=_v2.1.0 + export w3nv="" + export xmlv=_v2.0.0 + export g2tv="" + export baciov=_v2.1.0 + export XMLPATH=$NWPROD + export IPPATH=$NWPROD + export SPPATH=$NWPROD + export BACIOPATH=$NWPROD/lib + export FC=mpiifort + export CPP="/lib/cpp -P" + export CC=cc + export ARCH="" + export CPPFLAGS="-DLINUX" + if [ $debug = YES ] ; then + export OPTS="-O0 -openmp -g" + export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" + else + export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source -openmp" + export DEBUG="" + fi + export LIST="" + export FREE="-FR" + export TRAPS="" + export PROFILE="" +elif [ $machine = gaea ] ; then + export NETCDFPATH="/opt/cray/netcdf/4.3.2/INTEL/140" + export WRFPATH="/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod/lib/sorc/WRFV3" + export NWPROD="/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod" + export IPPATH=$NWPROD + export SPPATH=$NWPROD + export baciov=_v2.1.0 + export BACIOPATH=/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod/lib/sorc/bacio_fast_byteswap/bacio${baciov}_4 + export ipv="" + export spv=_v2.0.1 + export xmlv=_v2.0.0 + export FC=ftn + export CPP="/lib/cpp -P" + export ARCH="" + export CPPFLAGS="-DLINUX" + export CC=icc + if [ $debug = YES ] ; then + export OPTS="-O0 -g" + export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" + else + export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source" + export DEBUG="" + fi + export LIST="" + export FREE=-FR + export TRAPS="" + export PROFILE="" -OBJS = wrf_io_flags.o getVariable.o getIVariable.o getIVariableN.o \ - kinds_mod.o machine.o physcons.o \ - native_endianness.o blockIO.o initialize_byte_swap_wrf_binary_file.o \ - count_recs_wrf_binary_file.o inventory_wrf_binary_file.o \ - next_buf.o retrieve_index.o ZENSUN.o CLDFRAC_ZHAO.o \ - GFSPOST.o GETGBANDSCATTER.o \ - VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ - CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o xml_perl_data.o \ - cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o \ - SET_LVLSXML.o FILL_PSETFLD.o \ - BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ - CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o \ - CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ - CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALRH_PW.o \ - CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ - CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o DEWPOINT.o \ - FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ - GET_BITS.o GRIBIT.o INITPOST.o LFMFLD.o \ - MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o MPI_FIRST.o MPI_LAST.o \ - NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ - PARA_RANGE.o PROCESS.o INITPOST_NMM.o EXCH2.o \ - READCNTRL.o READ_xml.o SET_OUTFLDS.o SCLFLD.o SERVER.o SETUP_SERVERS.o \ - SMOOTH.o SURFCE.o \ - SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o WRFPOST.o \ - CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ - ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ - AVIATION.o DEALLOCATE.o INITPOST_NMM_BIN_MPIIO.o \ - CALPBL.o MDL2SIGMA2.o INITPOST_GFS.o CALRH_GFS.o LFMFLD_GFS.o \ - CALRAD_WCLOUD_newcrtm.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ - INITPOST_NEMS.o GETNEMSNDSCATTER.o ICAOHEIGHT.o INITPOST_GFS_NEMS.o \ - INITPOST_BIN_MPIIO.o GEO_ZENITH_ANGLE.o GFIP3.o GRIDAVG.o CALUPDHEL.o \ - INITPOST_GFS_SIGIO.o AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o INITPOST_NEMS_MPIIO.o ASSIGNNEMSIOVAR.o + export gfsiov="" + export crtmv=2.0.7 + export w3ev=_v2.1.0 + export w3nv="" +fi +export crtmv=${crtmv:-2.0.7} +export crtmv_inc=${crtmv_inc:-v$crtmv} +export XMLPATH=${XMLPATH:-$NWPROD} +export BACIOPATH=${BACIOPATH:-$NWPROD/lib} +export xmlv=${xmlv:-""} +export w3ev=${w3ev:-_v2.0.3} +export ipv=${ipv:-""} +export spv=${spv:-""} -# +if [ ${CLEAN:-YES} = YES ] ; then make -f Makefile clean ; fi + +export CFLAGS="-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" +if [ $machine = wcoss_c ] ; then + + if [ $make_nowrf = YES ] ; then + WRF_INC= + WRF_LIB= + fi + NETCDF_LIB="${NETCDF}/lib/libnetcdf.a" + export FFLAGS="${OPTS} ${FREE} ${TRAPS} ${DEBUG} -I${XMLPARSE_INC} -I${G2_INC4} -I${G2TMPL_INC} -I${NEMSIO_INC} -I${SIGIO_INC4} -I${SFCIO_INC4} -I${GFSIO_INC4} -I${W3EMC_INC4} -I${CRTM_INC} -I${NETCDF_INCLUDE} -I${PNG_INC}" + + export LIBS="${WRF_LIB} ${XMLPARSE_LIB} ${G2_LIB4} ${G2TMPL_LIB} ${NEMSIO_LIB} ${GFSIO_LIB4} ${SIGIO_LIB4} ${SFCIO_LIB4} ${IP_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${W3EMC_LIB4} ${BACIO_LIB4} ${CRTM_LIB} ${NETCDF_LIB} ${PNG_LIB} ${JASPER_LIB} ${Z_LIB}" +else + SFCIO_INC="-I${NWPROD}/lib/incmod/sfcio_4" + SFCIO_LIB="${NWPROD}/lib/libsfcio_4.a" + + NEMSIO_INC="-I${NWPROD}/lib/incmod/nemsio" + NEMSIO_LIB="-L${NWPROD}/lib -lnemsio" + BACIO_LIB="-L${BACIOPATH} -lbacio${baciov}_4" + SIGIO_INC="-I${NWPROD}/lib/incmod/sigio_4" + SIGIO_LIB="${NWPROD}/lib/libsigio_4.a" + NCDLIBS="-L${NETCDFPATH} -lnetcdf" + NCDFFLAGS="-I${NETCDFPATH}" + if [ $make_nowrf = YES ] ; then + WRF_INC= + WRF_LIB= + else + WRF_INC="-I${WRFPATH}/external/io_quilt -I${WRFPATH}/frame" + WRF_LIB="${WRFPATH}/main/libwrflib.a ${WRFPATH}/frame/pack_utils.o ${WRFPATH}/frame/module_internal_header_util.o ${WRFPATH}/external/io_grib1/libio_grib1.a ${WRFPATH}/external/io_grib_share/libio_grib_share.a ${WRFPATH}/external/io_int/libwrfio_int.a ${WRFPATH}/external/io_netcdf/libwrfio_nf.a ${WRFPATH}/external/esmf_time_f90/libesmf_time.a ${WRFPATH}/external/RSL_LITE/librsl_lite.a" + fi + + G2_INC="-I${NWPROD}/lib/incmod/g2_4 -I${NWPROD}/lib/incmod/g2tmpl${g2tv}" + G2_LIB="-L${NWPROD}/lib -lg2tmpl${g2tv} -lg2_4 -ljasper -lpng -lz" + + GFSIO_INC="-I${NWPROD}/lib/incmod/gfsio${gfsiov}_4" + GFSIO_LIB="-L${NWPROD}/lib -lgfsio${gfsiov}_4" + + IP_LIB="-L${IPPATH}/lib -lip${ipv}_4" + SP_LIB="-L${SPPATH} -lsp${sp}_4" -.SUFFIXES: .F .f .o .f90 .c + W3_INC="-I${NWPROD}/lib/incmod/w3emc${w3ev}_4" + W3_LIB="-L${NWPROD}/lib -lw3nco${w3nv}_4 -lw3emc${w3ev}_4" -.F.f: - $(CPP) $(CPPFLAGS) $< > $*.f + CRTM_INC="-I${NWPROD}/lib/incmod/crtm_${crtmv_inc}" + CRTM_LIB="-L${NWPROD}/lib -lcrtm_v${crtmv}" + XML_INC="-I${XMLPATH}/lib/incmod/xmlparse${xmlv}" + XML_LIB="-L${XMLPATH}/lib -lxmlparse${xmlv}" -$(TARGET): $(OBJST) $(OBJS) - $(FC) -openmp -o $@ $(OBJST) $(OBJS) $(LIBS) + NETCDF_LIB="${NETCDFPATH}/lib/libnetcdf.a" + NETCDF_INC="-I${NETCDFPATH}/include" -.f.o: - $(FC) $(FFLAGS) -c $< + export FFLAGS="${OPTS} ${FREE} ${TRAPS} ${DEBUG} ${WRF_INC} ${XML_INC} ${G2_INC} ${NEMSIO_INC} ${GFSIO_INC} ${SIGIO_INC} ${SFCIO_INC} ${W3_INC} ${CRTM_INC} ${NETCDF_INC}" -.f90.o: - $(FC) $(FFLAGS) -c $< + export LIBS="${WRF_LIB} ${XML_LIB} ${G2_LIB} ${NEMSIO_LIB} ${GFSIO_LIB} ${SIGIO_LIB} ${SFCIO_LIB} ${IP_LIB} ${SP_LIB} ${W3_LIB} ${BACIO_LIB} ${CRTM_LIB} ${NETCDF_LIB}" -.c.o : - ${CC} ${CFLAGS} -c $< +fi +if [ $make_post_lib = NO ] ; then + if [ $make_post_exec = YES ] ; then + if [ $make_nowrf = YES ] ; then + _make -f Makefile_nowrf + else + make -f Makefile + fi + fi +else + if [ $make_post_exec = YES ] ; then + if [ $make_nowrf = YES ] ; then + make -f Makefile_nowrf + else + make -f Makefile + fi + fi + export POSTLIBPATH=${POSTLIBPATH:-$(pwd)} + if [ ${CLEAN:-YES} = YES ] ; then rm -rf $POSTLIBPATH/include/post_4 ; fi + mkdir -p $POSTLIBPATH/include/post_4 + make -f Makefile_lib +fi -clean: - /bin/rm -f $(TARGET) *.lst *.o *.mod From af09fb02ad6e3736675133c34170e409764f4f52 Mon Sep 17 00:00:00 2001 From: Tracy Date: Tue, 31 Dec 2019 08:31:33 -0700 Subject: [PATCH 28/85] Add files for GRIB2 table of fields --- docs/UPP_GRIB2_Table.csv | 438 +++++++++++++++++++++++++++++++++++++++ docs/UPP_GRIB2_Table.rst | 30 +++ 2 files changed, 468 insertions(+) create mode 100644 docs/UPP_GRIB2_Table.csv create mode 100644 docs/UPP_GRIB2_Table.rst diff --git a/docs/UPP_GRIB2_Table.csv b/docs/UPP_GRIB2_Table.csv new file mode 100644 index 000000000..d1aceef79 --- /dev/null +++ b/docs/UPP_GRIB2_Table.csv @@ -0,0 +1,438 @@ +Radar reflectivity on model surface*,REFD_ON_HYBRID_LVL,REFD,109,250 +Pressure on model surface,PRES_ON_HYBRID_LVL,PRES,109,1 +Height on model surface,HGT_ON_HYBRID_LVL,HGT,109,77 +Temperature on model surface,TMP_ON_HYBRID_LVL,TMP,109,2 +Potential temperature on model surface,POT_ON_HYBRID_LVL,POT,109,3 +Dew point temperature on model surface,DPT_ON_HYBRID_LVL,DPT,109,4 +Specific humidity on model surface,SPFH_ON_HYBRID_LVL,SPFH,109,5 +Relative humidity on model surface,RH_ON_HYBRID_LVL,RH,109,6 +Moisture convergence on model surface,MCONV_ON_HYBRID_LVL,MCONV,109,83 +U component wind on model surface,UGRD_ON_HYBRID_LVL,UGRD,109,7 +V component wind on model surface,VGRD_ON_HYBRID_LVL,VGRD,109,8 +Cloud water on model surface,CLWMR_ON_HYBRID_LVL,CLWMR,109,124 +Cloud ice on model surface,CICE_ON_HYBRID_LVL,CICE,109,125 +Rain on model surface,RWMR_ON_HYBRID_LVL,RWMR,109,181 +Snow on model surface,SNMR_ON_HYBRID_LVL,SNMR,109,182 +Cloud fraction on model surface,TCDC_ON_HYBRID_LVL,TCDC,109,145 +Omega on model surface,VVEL_ON_HYBRID_LVL,VVEL,109,9 +Absolute vorticity on model surface,ABSV_ON_HYBRID_LVL,ABSV,109,10 +Geostrophic streamfunction on model surface,STRM_ON_HYBRID_LVL,STRM,109,84 +Turbulent kinetic energy on model surface,TKE_ON_HYBRID_LVL,TKE,109,11 +Richardson number on model surface,RI_ON_HYBRID_LVL,RI,109,111 +Master length scale on model surface,BMIXL_ON_HYBRID_LVL,BMIXL,109,146 +Asymptotic length scale on model surface,AMIXL_ON_HYBRID_LVL,AMIXL,109,147 +Radar reflectivity on pressure surface*,REFD_ON_ISOBARIC_SFC,REFD,100,251 +Height on pressure surface,HGT_ON_ISOBARIC_SFC,HGT,100,12 +Temperature on pressure surface,TMP_ON_ISOBARIC_SFC,TMP,100,13 +Potential temperature on pressure surface,POT_ON_ISOBARIC_SFC,POT,100,14 +Dew point temperature on pressure surface,DPT_ON_ISOBARIC_SFC,DPT,100,15 +Specific humidity on pressure surface,SPFH_ON_ISOBARIC_SFC,SPFH,100,16 +Relative humidity on pressure surface,RH_ON_ISOBARIC_SFC,RH,100,17 +Moisture convergence on pressure surface,MCONV_ON_ISOBARIC_SFC,MCONV,100,85 +U component wind on pressure surface,UGRD_ON_ISOBARIC_SFC,UGRD,100,18 +V component wind on pressure surface,VGRD_ON_ISOBARIC_SFC,VGRD,100,19 +Omega on pressure surface,VVEL_ON_ISOBARIC_SFC,VVEL,100,20 +Absolute vorticity on pressure surface,ABSV_ON_ISOBARIC_SFC,ABSV,100,21 +Geostrophic streamfunction on pressure surface,STRM_ON_ISOBARIC_SFC,STRM,100,86 +Turbulent kinetic energy on pressure surface,TKE_ON_ISOBARIC_SFC,TKE,100,22 +Cloud water on pressure surface,CLWMR_ON_ISOBARIC_SFC,CLWMR,100,153 +Cloud ice on pressure surface,CICE_ON_ISOBARIC_SFC,CICE,100,166 +Rain on pressure surface,RWMR_ON_ISOBARIC_SFC,RWMR,100,183 +Snow water on pressure surface,SNMR_ON_ISOBARIC_SFC,SNMR,100,184 +Total condensate on pressure surface,TCOND_ON_ISOBARIC_SFC,TCOND,100,198 +Mesinger (Membrane) sea level pressure,MSLET_ON_MEAN_SEA_LVL,MSLET,102,23 +Shuell sea level pressure,PRES_ON_MEAN_SEA_LVL,PRMSL,102,105 +2 M pressure,PRES_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,PRES,105,138 +2 M temperature,TMP_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,TMP,105,106 +2 M specific humidity,SPFH_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,SPFH,105,112 +2 M mixing ratio,Not currently available for grib2,NA,105,414 +2 M dew point temperature,DPT_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,DPT,105,113 +2 M RH,RH_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,RH,105,114 +10 M u component wind,UGRD_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,UGRD,105,64 +10 M v component wind,VGRD_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,VGRD,105,65 +10 M potential temperature,POT_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,POT,105,158 +10 M specific humidity,SPFH_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,SPFH,105,159 +Surface pressure,PRES_ON_SURFACE,PRES,1,24 +Terrain height,HGT_ON_SURFACE,HGT,1,25 +Skin potential temperature,POT_ON_SURFACE,POT,1,27 +Skin specific humidity,SPFH_ON_SURFACE,SPFH,1,28 +Skin dew point temperature,DPT_ON_SURFACE,DPT,1,29 +Skin Relative humidity,RH_ON_SURFACE,RH,1,76 +Skin temperature,TMP_ON_SURFACE,TMP,1,26 +Soil temperature at the bottom of soil layers,TSOIL_ON_DEPTH_BEL_LAND_SFC_3m,TSOIL,111,115/571 +Soil temperature in between each of soil layers,TSOIL_ON_DEPTH_BEL_LAND_SFC,TSOIL,112,116 +Soil moisture in between each of soil layers,SOILW_ON_DEPTH_BEL_LAND_SFC,SOILW,112,117 +Snow water equivalent,WEASD_ON_SURFACE,WEASD,1,119 +Snow cover in percentage,SNOWC_ON_SURFACE,SNOWC,1,120 +Heat exchange coeff at surface,SFEXC_ON_SURFACE,SFEXC,1,169 +Vegetation cover,VEG_ON_SURFACE,VEG,1,170 +Soil moisture availability,MSTAV_ON_DEPTH_BEL_LAND_SFC,MSTAV,112,171 +Ground heat flux - instantaneous,INST_GFLUX_ON_SURFACE,GFLUX,1,152 +Lifted index—surface based,LFTX_ON_ISOBARIC_SFC_500-1000hpa,LFTX,101,30 +Lifted index—best,4LFTX_ON_SPEC_PRES_ABOVE_GRND,4LFTX,116,31 +Lifted index—from boundary layer,PLI_ON_SPEC_PRES_ABOVE_GRND,PLI,116,75 +CAPE (4 types) ***,CAPE_ON_SURFACE,CAPE,1,32 +CIN (4 types) ***,CIN_ON_SURFACE,CIN,1,107 +Column integrated precipitable water,PWAT_ON_ENTIRE_ATMOS_SINGLE_LYR,PWAT,200,80 +Column integrated cloud water,TCOLW_ON_ENTIRE_ATMOS,TCOLW,200,200 +Column integrated cloud ice,TCOLI_ON_ENTIRE_ATMOS,TCOLI,200,201 +Column integrated rain,TCOLR_ON_ENTIRE_ATMOS,TCOLR,200,202 +Column integrated snow,TCOLS_ON_ENTIRE_ATMOS,TCOLS,200,203 +Column integrated total condensate,TCOLC_ON_ENTIRE_ATMOS,TCOLC,200,204 +Column integrated cloud water,CWAT_ON_ENTIRE_ATMOS_SINGLE_LYR,CWAT,200,575 +Helicity,HLCY_ON_SPEC_HGT_LVL_ABOVE_GRND,HLCY,106,162 +U component storm motion,USTM_ON_SPEC_HGT_LVL_ABOVE_GRND,USTM,106,163 +V component storm motion,VSTM_ON_SPEC_HGT_LVL_ABOVE_GRND,VSTM,106,164 +Accumulated total precipitation,ACM_APCP_ON_SURFACE,APCP,1,87 +Accumulated convective precipitation,ACM_ACPCP_ON_SURFACE,ACPCP,1,33 +Accumulated grid-scale precipitation,ACM_NCPCP_ON_SURFACE,NCPCP,1,34 +Accumulated snowfall,ACM_WEASD_ON_SURFACE,WEASD,1,35 +Accumulated large scale snow,Not currently available for grib2,NA,1,244 +Accumulated total snow melt,ACM_SNOM_ON_SURFACE,SNOM,1,121 +Precipitation type (4 types) – instantaneous,INST_CRAIN_ON_SURFACE,CRAIN,1,160 +Precipitation rate - instantaneous,INST_PRATE_ON_SURFACE,PRATE,1,167 +Composite radar reflectivity*,REFC_ON_ENTIRE_ATMOS,REFC,200,252 +Low level cloud fraction,LCDC_ON_LOW_CLOUD_LYR,LCDC,214,37 +Mid level cloud fraction,MCDC_ON_MID_CLOUD_LYR,MCDC,224,38 +High level cloud fraction,HCDC_ON_HIGH_CLOUD_LYR,HCDC,234,39 +Total cloud fraction,INST_TCDC_ON_ENTIRE_ATMOS,TCDC,200,161 +Time-averaged total cloud fraction,AVE_TCDC_ON_ENTIRE_ATMOS,TCDC,200,144 +Time-averaged stratospheric cloud fraction,AVE_CDLYR_ON_ENTIRE_ATMOS,CDLYR,200,139 +Time-averaged convective cloud fraction,AVE_CDCON_ON_ENTIRE_ATMOS,CDCON,200,143 +Cloud bottom pressure,PRES_ON_CLOUD_BASE,PRES,2,148 +Cloud top pressure,PRES_ON_CLOUD_TOP,PRES,3,149 +Cloud bottom height (above MSL),HGT_ON_CLOUD_BASE,HGT,2,178 +Cloud top height (above MSL),HGT_ON_CLOUD_TOP,HGT,3,179 +Convective cloud bottom pressure,PRES_ON_CONVECTIVE_CLOUD_BOT_LVL,PRES,242,188 +Convective cloud top pressure,PRES_ON_CONVECTIVE_CLOUD_TOP_LVL,PRES,243,189 +Shallow convective cloud bottom pressure,PRES_ON_SHALL_CONVECTIVE_CLOUD_BOT_LVL,PRES,248,190 +Shallow convective cloud top pressure,PRES_ON_SHALL_CONVECTIVE_CLOUD_TOP_LVL,PRES,249,191 +Deep convective cloud bottom pressure,PRES_ON_DEEP_CONVECTIVE_CLOUD_BOT_LVL,PRES,251,192 +Deep convective cloud top pressure,PRES_ON_DEEP_CONVECTIVE_CLOUD_TOP_LVL,PRES,252,193 +Grid scale cloud bottom pressure,PRES_ON_GRID_SCALE_CLOUD_BOT_LVL,PRES,206,194 +Grid scale cloud top pressure,PRES_ON_GRID_SCALE_CLOUD_TOP_LVL,PRES,207,195 +Convective cloud fraction,CDCON_ON_ENTIRE_ATMOS,CDCON,200,196 +Convective cloud efficiency,CUEFI_ON_ENTIRE_ATMOS_SINGLE_LYR,CUEFI,200,197 +Above-ground height of LCL,HGT_ON_LVL_OF_ADIAB_COND_FROM_SFC,HGT,5,109 +Pressure of LCL,PRES_ON_LVL_OF_ADIAB_COND_FROM_SFC,PRES,5,110 +Cloud top temperature,TMP_ON_CLOUD_TOP,TMP,3,168 +Temperature tendency from radiative fluxes,TTRAD_ON_HYBRID_LVL,TTRAD,109,140 +Temperature tendency from shortwave radiative flux,SWHR_ON_HYBRID_LVL,SWHR,109,40 +Temperature tendency from longwave radiative flux,LWHR_ON_HYBRID_LVL,LWHR,109,41 +Outgoing surface shortwave radiation - instantaneous,INST_USWRF_ON_SURFACE,USWRF,1,141 +Outgoing surface longwave radiation - instantaneous,INST_ULWRF_ON_SURFACE,ULWRF,1,142 +Incoming surface shortwave radiation - time-averaged,AVE_DSWRF_ON_SURFACE,DSWRF,1,126 +Incoming surface longwave radiation - time-averaged,AVE_DLWRF_ON_SURFACE,DLWRF,1,127 +Outgoing surface shortwave radiation - time-averaged,AVE_USWRF_ON_SURFACE,USWRF,1,128 +Outgoing surface longwave radiation - time-averaged,AVE_ULWRF_ON_SURFACE,ULWRF,1,129 +Outgoing model top shortwave radiation - time-averaged,AVE_USWRF_ON_TOP_OF_ATMOS,USWRF,8,130 +Outgoing model top longwave radiation - time-averaged,AVE_ULWRF_ON_TOP_OF_ATMOS,ULWRF,8,131 +Incoming surface shortwave radiation - instantaneous,INST_DSWRF_ON_SURFACE,DSWRF,1,156 +Incoming surface longwave radiation - instantaneous,INST_DLWRF_ON_SURFACE,DLWRF,1,157 +Roughness length,SFCR_ON_SURFACE,SFCR,1,44 +Friction velocity,FRICV_ON_SURFACE,FRICV,1,45 +Surface drag coefficient,CD_ON_SURFACE,CD,1,132 +Surface u wind stress,UFLX_ON_SURFACE,UFLX,1,133 +Surface v wind stress,VFLX_ON_SURFACE,VFLX,1,134 +Surface sensible heat flux - time-averaged,AVE_SHTFL_ON_SURFACE,SHTFL,1,43 +Ground heat flux - time-averaged,AVE_GFLUX_ON_SURFACE,GFLUX,1,135 +Surface latent heat flux - time-averaged,AVE_LHTFL_ON_SURFACE,LHTFL,1,42 +Surface momentum flux - time-averaged,AVE_MFLX_ON_SURFACE,MFLX,1,46 +Accumulated surface evaporation,ACM_EVP_ON_SURFACE,EVP,1,47 +Surface sensible heat flux – instantaneous,INST_SHTFL_ON_SURFACE,SHTFL,1,154 +Surface latent heat flux - instantaneous,INST_LHTFL_ON_SURFACE,LHTFL,1,155 +Latitude,NLAT_ON_SURFACE,NLAT,1,48 +Longitude,ELON_ON_SURFACE,ELON,1,49 +Land sea mask (land=1 sea=0),LAND_ON_SURFACE,LAND,1,50 +Sea ice mask,ICEC_ON_SURFACE,ICEC,1,51 +Surface midday albedo,ALBDO_ON_SURFACE,ALBDO,1,150 +Sea surface temperature,WTMP_ON_SURFACE,WTMP,1,151 +Press at tropopause,PRES_ON_TROPOPAUSE,PRES,7,54 +Temperature at tropopause,TMP_ON_TROPOPAUSE,TMP,7,55 +Potential temperature at tropopause,POT_ON_TROPOPAUSE,POT,7,108 +U wind at tropopause,UGRD_ON_TROPOPAUSE,UGRD,7,56 +V wind at tropopause,VGRD_ON_TROPOPAUSE,VGRD,7,57 +Wind shear at tropopause,VWSH_ON_TROPOPAUSE,VWSH,7,58 +Height at tropopause,HGT_ON_TROPOPAUSE,HGT,7,177 +Temperature at flight levels,TMP_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,TMP,103,59 +U wind at flight levels,UGRD_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,UGRD,103,60 +V wind at flight levels,VGRD_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,VGRD,103,61 +Freezing level height (above mean sea level),HGT_ON_0C_ISOTHERM,HGT,4,62 +Freezing level RH,RH_ON_0C_ISOTHERM,RH,4,63 +Highest freezing level height,HGT_ON_HGHST_TROP_FRZ_LVL,HGT,204,165 +Pressure in boundary layer (30 mb mean),PRES_ON_SPEC_PRES_ABOVE_GRND,PRES,116,67 +Temperature in boundary layer (30 mb mean),TMP_ON_SPEC_PRES_ABOVE_GRND,TMP,116,68 +Potential temperature in boundary layers (30 mb mean),POT_ON_SPEC_PRES_ABOVE_GRND,POT,116,69 +Dew point temperature in boundary layer (30 mb mean),DPT_ON_SPEC_PRES_ABOVE_GRND,DPT,116,70 +Specific humidity in boundary layer (30 mb mean),SPFH_ON_SPEC_PRES_ABOVE_GRND,SPFH,116,71 +RH in boundary layer (30 mb mean),RH_ON_SPEC_PRES_ABOVE_GRND,RH,116,72 +Moisture convergence in boundary layer (30 mb mean),MCONV_ON_SPEC_PRES_ABOVE_GRND,MCONV,116,88 +Precipitable water in boundary layer (30 mb mean),PWAT_ON_SPEC_PRES_ABOVE_GRND,PWAT,116,89 +U wind in boundary layer (30 mb mean),UGRD_ON_SPEC_PRES_ABOVE_GRND,UGRD,116,73 +V wind in boundary layer (30 mb mean),VGRD_ON_SPEC_PRES_ABOVE_GRND,VGRD,116,74 +Omega in boundary layer (30 mb mean),VVEL_ON_SPEC_PRES_ABOVE_GRND,VVEL,116,90 +Visibility,VIS_ON_SURFACE,VIS,1,180 +Vegetation type,VGTYP_ON_SURFACE,VGTYP,1,218 +Soil type,SOTYP_ON_SURFACE,SOTYP,1,219 +Canopy conductance,CCOND_ON_SURFACE,CCOND,1,220 +PBL height,HPBL_ON_SURFACE,HPBL,1,221 +Slope type,SLTYP_ON_SURFACE,SLTYP,1,223 +Snow depth,SNOD_ON_SURFACE,SNOD,1,224 +Liquid soil moisture,SOILL_ON_DEPTH_BEL_LAND_SFC,SOILL,112,225 +Snow free albedo,SNFALB_ON_SURFACE,SNFALB,1,226 +Maximum snow albedo,MXSALB_ON_SURFACE,MXSALB,1,227 +Canopy water evaporation,EVCW_ON_SURFACE,EVCW,1,228 +Direct soil evaporation,EVBS_ON_SURFACE,EVBS,1,229 +Plant transpiration,TRANS_ON_SURFACE,TRANS,1,230 +Snow sublimation,SBSNO_ON_SURFACE,SBSNO,1,231 +Air dry soil moisture,SMDRY_ON_SURFACE,SMDRY,1,232 +Soil moist porosity,POROS_ON_SURFACE,POROS,1,233 +Minimum stomatal resistance,RSMIN_ON_SURFACE,RSMIN,1,234 +Number of root layers,RLYRS_ON_SURFACE,RLYRS,1,235 +Soil moist wilting point,WILT_ON_SURFACE,WILT,1,236 +Soil moist reference,SMREF_ON_SURFACE,SMREF,1,237 +Canopy conductance - solar component,RCS_ON_SURFACE,RCS,1,238 +Canopy conductance - temperature component,RCT_ON_SURFACE,RCT,1,239 +Canopy conductance - humidity component,RCQ_ON_SURFACE,RCQ,1,240 +Canopy conductance - soil component,RCSOL_ON_SURFACE,RCSOL,1,241 +Potential evaporation,PEVPR_ON_SURFACE,PEVPR,1,242 +Heat diffusivity on sigma surface,VEDH_ON_SIGMA_LVLS,VEDH,107,243 +Surface wind gust,GUST_ON_SURFACE,GUST,1,245 +Convective precipitation rate,CPRAT_ON_SURFACE,CPRAT,1,249 +Radar reflectivity at certain above ground heights*,REFD_ON_SPEC_HGT_LVL_ABOVE_GRND,REFD,105,253 +MAPS Sea Level Pressure,MAPS_PRMSL_ON_MEAN_SEA_LVL,PRMSL,102,445 +Total soil moisture,SOILM_ON_DEPTH_BEL_LAND_SFC,SOILM,112,36 +Plant canopy surface water,CNWAT_ON_SURFACE,CNWAT,1,118 +Accumulated storm surface runoff,ACM_SSRUN_ON_SURFACE,SSRUN,1,122 +Accumulated baseflow runoff,ACM_BGRUN_ON_SURFACE,BGRUN,1,123 +Fraction of frozen precipitation,CPOFP_ON_SURFACE,CPOFP,1,172 +GSD Cloud Base pressure,Not currently available for grib2,NA,2,787 +GSD Cloud Top pressure,GSD_PRES_ON_CLOUD_TOP,PRES,3,406 +Averaged temperature tendency from grid scale latent heat release,AVE_LRGHR_ON_HYBRID_LVL,LRGHR,109,78 +Averaged temperature tendency from convective latent heat release,AVE_CNVHR_ON_HYBRID_LVL,CNVHR,109,79 +Average snow phase change heat flux,AVE_SNOHF_ON_SURFACE,SNOHF,1,136 +Accumulated potential evaporation,ACM_PEVAP_ON_SURFACE,PEVAP,1,137 +Highest freezing level relative humidity,RH_ON_HGHST_TROP_FRZ_LVL,RH,204,350 +Maximum wind pressure level,PRES_ON_MAX_WIND,PRES,6,173 +Maximum wind height,HGT_ON_MAX_WIND,HGT,6,174 +U-component of maximum wind,UGRD_ON_MAX_WIND,UGRD,6,175 +V-component of maximum wind,VGRD_ON_MAX_WIND,VGRD,6,176 +GSD cloud base height,GSD_HGT_ON_CLOUD_BASE,HGT,2,408 +GSD cloud top height,GSD_HGT_ON_CLOUD_TOP,HGT,3,409 +GSD visibility,GSD_VIS_ON_CLOUD_TOP,VIS,3,410 +Wind energy potential,WMIXE_ON_SPEC_HGT_LVL_ABOVE_GRND,WMIXE,105,411 +U wind at 80 m above ground,UGRD_ON_SPEC_HGT_LVL_ABOVE_GRND,UGRD,105,412 +V wind at 80 m above ground,VGRD_ON_SPEC_HGT_LVL_ABOVE_GRND,VGRD,105,413 +Graupel on model surface,GRMR_ON_HYBRID_LVL,GRMR,109,415 +Graupel on pressure surface,GRMR_ON_ISOBARIC_SFC,GRMR,100,416 +Maximum updraft helicity,MAX_UPHL_ON_SPEC_HGT_LVL_ABOVE_GRND_2-5km,MXUPHL,106,420 +Maximum 1km reflectivity,MAX_REF_ON_SPEC_HGT_LVL_ABOVE_GRND_1km,MAXREF,105,421 +Maximum wind speed at 10m,MAX_WIND_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,WIND,105,422 +Maximum updraft vertical velocity,MAX_MAXUVV_ON_ISOBARIC_SFC_40-100hpa,MAXUVV,106,423 +Maximum downdraft vertical velocity,MAX_MAXDVV_ON_ISOBARIC_SFC_40-100hpa,MAXDVV,106,424 +Mean vertical velocity,AVE_DZDT_ON_SIGMA_LVL_0.5-0.8,DZDT,108,425 +Radar echo top in KDT,HGT_ON_SPEC_HGT_LVL_ABOVE_GRND,HGT,105,426 +Updraft helicity,UPHL_ON_SPEC_HGT_LVL_ABOVE_GRND_2-5km,MXUPHL,106,427 +Column integrated graupel,GRMR_ON_ENTIRE_ATMOS_SINGLE_LYR,GRMR,200,428 +Column integrated maximum graupel,MAXVIG_ON_ENTIRE_ATMOS_SINGLE_LYR,TCOLG,200,429 +U-component of 0-1km level wind shear,VUCSH_ON_SPEC_HGT_LVL_ABOVE_GRND_0-1km,VUCSH,106,430 +V-component of 0-1km level wind shear,VVCSH_ON_SPEC_HGT_LVL_ABOVE_GRND_0-1km,VVCSH,106,431 +U-component of 0-6km level wind shear,VUCSH_ON_SPEC_HGT_LVL_ABOVE_GRND_0-6km,VUCSH,106,432 +V-component of 0-6km level wind shear,VVCSH_ON_SPEC_HGT_LVL_ABOVE_GRND_0-6km,VVCSH,106,433 +Total precipitation accumulated over user-specified bucket,BUCKET_APCP_ON_SURFACE,APCP,1,434 +Convective precipitation accumulated over user-specified bucket,BUCKET_ACPCP_ON_SURFACE,ACPCP,1,435 +Grid-scale precipitation accumulated over user-specified bucket,BUCKET_NCPCP_ON_SURFACE,NCPCP,1,436 +Snow accumulated over user-specified bucket,BUCKET_WEASD_ON_SURFACE,WEASD,1,437 +Model level fraction of rain for Ferrier scheme,FRAIN_ON_HYBRID_LVL,FRAIN,109,185 +Model level fraction of ice for Ferrier scheme,FICE_ON_HYBRID_LVL,FICE,109,186 +Model level riming factor for Ferrier scheme,RIME_ON_HYBRID_LVL,RIME,109,187 +Model level total condensate for Ferrier scheme,TCOND_ON_HYBRID_LVL,TCOND,109,199 +Height of sigma surface,HGT_ON_SIGMA_LVLS,HGT,107,205 +Temperature on sigma surface,TMP_ON_SIGMA_LVLS,TMP,107,206 +Specific humidity on sigma surface,SPFH_ON_SIGMA_LVLS,SPFH,107,207 +U-wind on sigma surface,UGRD_ON_SIGMA_LVLS,UGRD,107,208 +V-wind on sigma surface,VGRD_ON_SIGMA_LVLS,VGRD,107,209 +Omega on sigma surface,VVEL_ON_SIGMA_LVLS,VVEL,107,210 +Cloud water on sigma surface,CLWMR_ON_SIGMA_LVLS,CLWMR,107,211 +Cloud ice on sigma surface,CICE_ON_SIGMA_LVLS,CICE,107,212 +Rain on sigma surface,RWMR_ON_SIGMA_LVLS,RWMR,107,213 +Snow on sigma surface,SNMR_ON_SIGMA_LVLS,SNMR,107,214 +Condensate on sigma surface,TCOND_ON_SIGMA_LVLS,TCOND,107,215 +Pressure on sigma surface,PRES_ON_SIGMA_LVLS,PRES,107,216 +Turbulent kinetic energy on sigma surface,TKE_ON_SIGMA_LVLS,TKE,107,217 +Cloud fraction on sigma surface,TCDC_ON_SIGMA_LVLS,TCDC,107,222 +Graupel on sigma surface,GRLE_ON_SIGMA_LVLS,GRLE,107,255 +LCL level pressure,PLPL_ON_SPEC_PRES_ABOVE_GRND,PLPL,116,246 +LOWEST WET BULB ZERO HEIGHT,HGT_ON_LWST_LVL_OF_WET_BULB_ZERO,HGT,245,247 +Leaf area index,LAI_ON_SURFACE,LAI,1,254 +Accumulated land surface model precipitation,ACM_LSPA_ON_SURFACE,LSPA,1,256 +In-flight icing,TIPD_ON_ISOBARIC_SFC,TIPD,100,257 +Clear air turbulence,TPFI_ON_ISOBARIC_SFC,TPFI,100,258 +Wind shear between shelter level and 2000 FT,VWSH_ON_SPEC_HGT_LVL_ABOVE_GRND,VWSH,106,259 +Ceiling,HGT_ON_CLOUD_CEILING,HGT,215,260 +Flight restriction,VIS_ON_CLOUD_BASE,VIS,2,261 +Instantaneous clear sky incoming surface shortwave,INST_CSDSF_ON_SURFACE,CSDSF,1,262 +Pressure level riming factor for Ferrier scheme,RIME_ON_ISOBARIC_SFC,RIME,100,263 +Model level vertical velocity,DZDT_ON_HYBRID_LVL,DZDT,109,264 +Brightness temperature,SBT122_ON_TOP_OF_ATMOS_FROM_LWRAD,SBT122,8,265 +Average albedo,AVE_ALBDO_ON_SURFACE,ALBDO,1,266 +Ozone on model surface,O3MR_ON_HYBRID_LVL,O3MR,109,267 +Ozone on pressure surface,O3MR_ON_ISOBARIC_SFC,O3MR,100,268 +Surface zonal momentum flux,AVE_UFLX_ON_SURFACE,UFLX,1,269 +Surface meridional momentum flux,AVE_VFLX_ON_SURFACE,VFLX,1,270 +Average precipitation rate,AVE_PRATE_ON_SURFACE,PRATE,1,271 +Average convective precipitation rate,AVE_CPRAT_ON_SURFACE,CPRAT,1,272 +Instantaneous outgoing longwave at top of atmosphere,INST_ULWRF_ON_TOP_OF_ATMOS,ULWRF,8,274 +Total spectrum brightness temperature,BRTMP_ON_TOP_OF_ATMOS,BRTMP,8,275 +Model top pressure,PRES_ON_TOP_OF_ATMOS,PRES,8,282 +Composite rain radar reflectivity,REFZR_ON_ENTIRE_ATMOS,REFZR,200,276 +Composite ice radar reflectivity,REFZI_ON_ENTIRE_ATMOS,REFZI,200,277 +Composite radar reflectivity from convection,REFZC_ON_ENTIRE_ATMOS,REFZC,200,278 +Rain radar reflecting angle,REFZR_ON_SPEC_HGT_LVL_ABOVE_GRND,REFZR,105,279 +Ice radar reflecting angle,REFZI_ON_SPEC_HGT_LVL_ABOVE_GRND,REFZI,105,280 +Convection radar reflecting angle,REFZC_ON_SPEC_HGT_LVL_ABOVE_GRND,REFZC,105,281 +Model level vertical velocity,DZDT_ON_ISOBARIC_SFC,DZDT,100,284 +Column integrated super cool liquid water,TCLSW_ON_ENTIRE_ATMOS,TCLSW,200,285 +Column integrated melting ice,TCOLM_ON_ENTIRE_ATMOS,TCOLM,200,286 +Height of lowest level super cool liquid water,HGT_ON_LWST_BOT_LVL_OF_SUPERCOOLED_LIQ_WATER_LYR,HGT,253,287 +Height of highest level super cool liquid water,HGT_ON_HGHST_TOP_LVL_OF_SUPERCOOLED_LIQ_WATER_LYR,HGT,254,288 +Richardson number planetary boundary layer height,HGT_ON_PLANETARY_BOUND_LYR,HGT,220,289 +Total column shortwave temperature tendency,SWHR_ON_ENTIRE_ATMOS,SWHR,200,290 +Total column longwave temperature tendency,LWHR_ON_ENTIRE_ATMOS,LWHR,200,291 +Total column gridded temperature tendency,AVE_LRGHR_ON_ENTIRE_ATMOS,LRGHR,200,292 +Total column convective temperature tendency,AVE_CNVHR_ON_ENTIRE_ATMOS,CNVHR,200,293 +Radiative flux temperature tendency on pressure level,TTRAD_ON_ISOBARIC_SFC,TTRAD,100,294 +Column integrated moisture convergence,MCONV_ON_ENTIRE_ATMOS,MCONV,200,295 +Time averaged clear sky incoming UV-B shortwave,AVE_CDUVB_ON_SURFACE,CDUVB,1,297 +Time averaged incoming UV-B shortwave,AVE_DUVB_ON_SURFACE,DUVB,1,298 +Total column ozone,TOZNE_ON_ENTIRE_ATMOS_SINGLE_LYR,TOZNE,200,299 +Average low cloud fraction,AVE_TCDC_ON_LOW_CLOUD_LYR,TCDC,214,300 +Average mid cloud fraction,AVE_TCDC_ON_MID_CLOUD_LYR,TCDC,224,301 +Average high cloud fraction,AVE_TCDC_ON_HIGH_CLOUD_LYR,TCDC,234,302 +Average low cloud bottom pressure,AVE_PRES_ON_LOW_CLOUD_BOT_LVL,PRES,212,303 +Average low cloud top pressure,AVE_PRES_ON_LOW_CLOUD_TOP_LVL,PRES,213,304 +Average low cloud top temperature,AVE_TMP_ON_LOW_CLOUD_TOP_LVL,TMP,213,305 +Average mid cloud bottom pressure,AVE_PRES_ON_MID_CLOUD_BOT_LVL,PRES,222,306 +Average mid cloud top pressure,AVE_PRES_ON_MID_CLOUD_TOP_LVL,PRES,223,307 +Average mid cloud top temperature,AVE_TMP_ON_MID_CLOUD_TOP_LVL,TMP,223,308 +Average high cloud bottom pressure,AVE_PRES_ON_HIGH_CLOUD_BOT_LVL,PRES,232,309 +Average high cloud top pressure,AVE_PRES_ON_HIGH_CLOUD_TOP_LVL,PRES,233,310 +Average high cloud top temperature,AVE_TMP_ON_HIGH_CLOUD_TOP_LVL,TMP,233,311 +Total column relative humidity,RH_ON_ENTIRE_ATMOS_SINGLE_LYR,RH,200,312 +Cloud work function,AVE_CWORK_ON_ENTIRE_ATMOS_SINGLE_LYR,CWORK,200,313 +Temperature at maximum wind level,TMP_ON_MAX_WIND,TMP,6,314 +Time averaged zonal gravity wave stress,AVE_U-GWD_ON_SURFACE,U-GWD,1,315 +Time averaged meridional gravity wave stress,AVE_V-GWD_ON_SURFACE,V-GWD,1,316 +Average precipitation type,AVE_CRAIN_ON_SURFACE,CRAIN,1,317 +Simulated GOES 12 channel 2 brightness temperature,SBT122_ON_TOP_OF_ATMOS,SBT122,8,327 +Simulated GOES 12 channel 3 brightness temperature,SBT123_ON_TOP_OF_ATMOS,SBT123,8,328 +Simulated GOES 12 channel 4 brightness temperature,SBT124_ON_TOP_OF_ATMOS,SBT124,8,329 +Simulated GOES 12 channel 5 brightness temperature,SBT126_ON_TOP_OF_ATMOS,SBT126,8,330 +Cloud fraction on pressure surface,TCDC_ON_ISOBARIC_SFC,TCDC,100,331 +U-wind on theta surface,UGRD_ON_ISENTROPIC_LVL,UGRD,113,332 +V-wind on theta surface,VGRD_ON_ISENTROPIC_LVL,VGRD,113,333 +Temperature on theta surface,TMP_ON_ISENTROPIC_LVL,TMP,113,334 +Potential vorticity on theta surface,PVORT_ON_ISENTROPIC_LVL,PVORT,113,335 +Montgomery streamfunction on theta surface,MNTSF_ON_ISENTROPIC_LVL,MNTSF,113,353 +Relative humidity on theta surface,RH_ON_ISENTROPIC_LVL,RH,113,352 +U wind on constant PV surface,UGRD_ON_POT_VORT_SFC,UGRD,117,336 +V wind on constant PV surface,VGRD_ON_POT_VORT_SFC,VGRD,117,337 +Temperature on constant PV surface,TMP_ON_POT_VORT_SFC,TMP,117,338 +Height on constant PV surface,HGT_ON_POT_VORT_SFC,HGT,117,339 +Pressure on constant PV surface,PRES_ON_POT_VORT_SFC,PRES,117,340 +Wind shear on constant PV surface,VWSH_ON_POT_VORT_SFC,VWSH,117,341 +Planetary boundary layer cloud fraction,AVE_TCDC_ON_BOUND_LYR_CLOUD_LYR,TCDC,211,342 +Average water runoff,ACM_WATR_ON_SURFACE,WATR,1,343 +Planetary boundary layer regime,PBLREG_ON_SURFACE,PBLREG,1,344 +Maximum 2m temperature,MAX_TMAX_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,TMAX,105,345 +Minimum 2m temperature,MIN_TMIN_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,TMIN,105,346 +Maximum 2m RH,MAX_MAXRH_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,MAXRH,105,347 +Minimum 2m RH,MIN_MINRH_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,MINRH,105,348 +Ice thickness,ICETK_ON_SURFACE,ICETK,1,349 +Shortwave tendency on pressure surface,SWHR_ON_ISOBARIC_SFC,SWHR,100,354 +Longwave tendency on pressure surface,LWHR_ON_ISOBARIC_SFC,LWHR,100,355 +Deep convective tendency on pressure surface,CNVHR_ON_ISOBARIC_SFC,CNVHR,100,357 +Shallow convective tendency on pressure surface,SHAHR_ON_ISOBARIC_SFC,SHAHR,100,358 +Grid scale tendency on pressure surface,LRGHR_ON_ISOBARIC_SFC,LRGHR,100,359 +Deep convective moisture on pressure surface,CNVMR_ON_ISOBARIC_SFC,CNVMR,100,361 +Shallow convective moisture on pressure surface,SHAMR_ON_ISOBARIC_SFC,SHAMR,100,362 +Ozone tendency on pressure surface,TOZ_ON_ISOBARIC_SFC,TOZ,100,366 +Mass weighted potential vorticity,PVMW_ON_ISOBARIC_SFC,PVMW,100,367 +Simulated GOES 12 channel 3 brightness count,SBC123_ON_TOP_OF_ATMOS,SBC123,8,376 +Simulated GOES 12 channel 4 brightness count,SBC124_ON_TOP_OF_ATMOS,SBC124,8,377 +Omega on theta surface,VVEL_ON_ISENTROPIC_LVL,VVEL,113,378 +Mixing height,MIXHT_ON_SURFACE,MIXHT,1,381 +Average clear-sky incoming longwave at surface,AVE_CSDLF_ON_SURFACE,CSDLF,1,382 +Average clear-sky incoming shortwave at surface,AVE_CSDSF_ON_SURFACE,CSDSF,1,383 +Average clear-sky outgoing longwave at surface,AVE_CSULF_ON_SURFACE,CSULF,1,384 +Average clear-sky outgoing longwave at top of atmosphere,AVE_CSULF_ON_TOP_OF_ATMOS,CSULF,8,385 +Average clear-sky outgoing shortwave at surface,AVE_CSUSF_ON_SURFACE,CSUSF,1,386 +Average clear-sky outgoing shortwave at top of atmosphere,AVE_CSUSF_ON_TOP_OF_ATMOS,CSUSF,8,387 +Average incoming shortwave at top of atmosphere,AVE_DSWRF_ON_TOP_OF_ATMOS,DSWRF,8,388 +Transport wind u component,UGRD_ON_PLANETARY_BOUND_LYR,UGRD,220,389 +Transport wind v component,VGRD_ON_PLANETARY_BOUND_LYR,VGRD,220,390 +Sunshine duration,SUNSD_ON_SURFACE,SUNSD,1,396 +Field capacity,FLDCP_ON_SURFACE,FLDCP,1,397 +ICAO height at maximum wind level,ICAHT_ON_MAX_WIND,ICAHT,6,398 +ICAO height at tropopause,ICAHT_ON_TROPOPAUSE,ICAHT,7,399 +Radar echo top,RETOP_ON_ENTIRE_ATMOS_SINGLE_LYR,RETOP,200,400 +Time averaged surface Visible beam downward solar flux,AVE_VBDSF_ON_SURFACE,VBDSF,1,401 +Time averaged surface Visible diffuse downward solar flux,AVE_VDDSF_ON_SURFACE,VDDSF,1,402 +Time averaged surface Near IR beam downward solar flux,AVE_NBDSF_ON_SURFACE,NBDSF,1,403 +Time averaged surface Near IR diffuse downward solar flux,AVE_NDDSF_ON_SURFACE,NDDSF,1,404 +Average snowfall rate,AVE_SRWEQ_ON_SURFACE,SRWEQ,1,405 +Dust 1 on pressure surface,DUST1_ON_ISOBARIC_LVL,MASSMR,100,438 +Dust 2 on pressure surface,DUST2_ON_ISOBARIC_LVL,MASSMR,100,439 +Dust 3 on pressure surface,DUST3_ON_ISOBARIC_LVL,MASSMR,100,440 +Dust 4 on pressure surface,DUST4_ON_ISOBARIC_LVL,MASSMR,100,441 +Dust 5 on pressure surface,DUST5_ON_ISOBARIC_LVL,MASSMR,100,442 +Equilibrium level height,HGT_ON_EQUIL_LVL,HGT,247,443 +Lightning,LTNG_ON_SURFACE,LTNG,1,444 +Goes west channel 2 brightness temperature,SBT112_ON_TOP_OF_ATMOS,SBT112,8,446 +Goes west channel 3 brightness temperature,SBT113_ON_TOP_OF_ATMOS,SBT113,8,447 +Goes west channel 4 brightness temperature,SBT114_ON_TOP_OF_ATMOS,SBT114,8,448 +Goes west channel 5 brightness temperature,SBT115_ON_TOP_OF_ATMOS,SBT115,8,449 +In flight icing from NCAR algorithm,ICIP_ON_ISOBARIC_SFC,ICIP,100,450 +Specific humidity at flight levels,SPFH_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,SPFH,103,451 +Virtual temperature based convective available potential energy,VTCAPE_ON_SURFACE,CAPE,1,452 +Virtual temperature based convective inhibition,VTCIN_ON_SURFACE,CIN,1,453 +Virtual temperature on model surfaces,Not currently available for grib2,NA,109,909 +Virtual temperature on pressure surfaces,Not currently available for grib2,NA,100,910 +Virtual temperature on flight levels,Not currently available for grib2,NA,103,911 +Ventilation rate,VRATE_ON_PLANETARY_BOUND_LYR,VRATE,220,454 +Haines index,HINDEX_ON_SURFACE,HINDEX,1,455 +Pressure at flight levels,PRES_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,PRES,103,482 +Time-averaged percentage snow cover,AVE_SNOWC_ON_SURFACE,SNOWC,1,500 +Time-averaged surface pressure,AVE_PRES_ON_SURFACE,PRES,1,501 +Time-averaged 10m temperature,AVE_TMP_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,TMP,105,502 +Time-averaged mass exchange coefficient,AVE_AKHS_ON_SURFACE,AKHS,1,503 +Time-averaged wind exchange coefficient,AVE_AKMS_ON_SURFACE,AKMS,1,504 +Temperature at 10m,TMP_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,TMP,105,505 +Maximum U-component wind at 10m,MAX_MAXUW_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,MAXUW,105,506 +Maximum V-component wind at 10m,MAX_MAXVW_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,MAXVW,105,507 +Simulated GOES 12 channel 2 brightness temperature with satellite angle correction,NON_NADIR_SBT122_ON_TOP_OF_ATMOS,SBT122,8,456 +Simulated GOES 12 channel 3 brightness temperature with satellite angle correction,NON_NADIR_SBT123_ON_TOP_OF_ATMOS,SBT123,8,457 +Simulated GOES 12 channel 4 brightness temperature with satellite angle correction,NON_NADIR_SBT124_ON_TOP_OF_ATMOS,SBT124,8,458 +Simulated GOES 12 channel 5 brightness temperature with satellite angle correction,NON_NADIR_SBT126_ON_TOP_OF_ATMOS,SBT126,8,459 +Simulated GOES 11 channel 2 brightness temperature with satellite angle correction,SBT112_ON_TOP_OF_ATMOS,SBT112,8,460 +Simulated GOES 11 channel 3 brightness temperature with satellite angle correction,SBT113_ON_TOP_OF_ATMOS,SBT113,8,461 +Simulated GOES 11 channel 4 brightness temperature with satellite angle correction,SBT114_ON_TOP_OF_ATMOS,SBT114,8,462 +Simulated GOES 11 channel 5 brightness temperature with satellite angle correction,SBT115_ON_TOP_OF_ATMOS,SBT115,8,463 +Simulated GOES 15 channel 5 brightness temperature with satellite angle correction,Not currently available for grib2,NA,109,872 +Simulated GOES 13 channel 2 brightness temperature with satellite angle correction,Not currently available for grib2,NA,109,868 +Simulated AMSR-E channel 9 brightness temperature,AMSRE9_ON_TOP_OF_ATMOS,AMSRE9,8,483 +Simulated AMSR-E channel 10 brightness temperature,AMSRE10_ON_TOP_OF_ATMOS,AMSRE10,8,484 +Simulated AMSR-E channel 11 brightness temperature,AMSRE11_ON_TOP_OF_ATMOS,AMSRE11,8,485 +Simulated AMSR-E channel 12 brightness temperature,AMSRE12_ON_TOP_OF_ATMOS,AMSRE12,8,486 +SSMI F13 (19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,800 +SSMI F14 (19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,806 +SSMI F15 (19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,812 +SSMIS F16 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,818 +SSMIS F17 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,825 +SSMIS F18 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,832 +SSMIS F19 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,839 +SSMIS F20 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,846 +MTSAT-1r imager channels 1-4 (backup for mtsat2),Not currently available for grib2,NA,109,864 +MTSAT2 imager channels 1-4,Not currently available for grib2,NA,109,860 +Seviri brightness temperature channels 5-11,Not currently available for grib2,NA,109,876 +Insat 3d brightness temperature IR channels 1-4,Not currently available for grib2,NA,109,865 diff --git a/docs/UPP_GRIB2_Table.rst b/docs/UPP_GRIB2_Table.rst new file mode 100644 index 000000000..13f6ef7c8 --- /dev/null +++ b/docs/UPP_GRIB2_Table.rst @@ -0,0 +1,30 @@ +================================ +GRIB2 Fields Produced by Unipost +================================ + +GRIB2 fields produced by *unipost* (column 1), abbreviated names +used in the *postcntrl.xml* file (column 2), corresponding standard +grib2 pname (column 3), corresponding grib identification number for the +vertical coordinate (column 4), and corresponding array location UPP +uses to store the variable in parallel arrays (column 5). + +.. csv-table:: + :file: /d1/hertneky/upp/docs/UPP_GRIB2_Table.csv + :header: "Field Description","Name in Grib2 Control File","Grib2 pname","Vertical Level","UPP ID" + :widths: 35,35,10,10,10 + +\*See Appendix A of the UPP Users Guid + +\***4 types of CAPE and CIN can be output with use of the Levels control +line in the wrf\_cntrl.parm (nmb\_cntrl.parm file). + +Surface based CAPE/CIN is output at one grib record, while the remaining +three types are output within one grib record in 3 levels. + + Level 1: Surface Based CAPE/CIN + + Level 2: Best Boundary Layer CAPE/CIN + + Level 3: Mixed Layer CAPE/CIN + + Level 4: Most Unstable CAPE/CIN From 2bade15ae79984147d263ab714b1240ed14d38ac Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 6 Jan 2020 07:53:21 -0700 Subject: [PATCH 29/85] Update .gitmodules, add branch = ufs_release_1.0 for cmake --- .gitmodules | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmodules b/.gitmodules index 2d2fcfbe3..4580dc21c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "cmake"] path = cmake url = https://github.com/NOAA-EMC/CMakeModules.git + branch = ufs_release_1.0 From 0b23ed4a436a2dd59045ab35754e5293fc703e6d Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 6 Jan 2020 09:29:16 -0700 Subject: [PATCH 30/85] Update .gitmodules for testing, code review and merging --- .gitmodules | 6 ++++-- cmake | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 4580dc21c..0187abd9c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,6 @@ [submodule "cmake"] path = cmake - url = https://github.com/NOAA-EMC/CMakeModules.git - branch = ufs_release_1.0 + #url = https://github.com/NOAA-EMC/CMakeModules.git + #branch = ufs_release_1.0 + url = https://github.com/climbfuji/CMakeModules.git + branch = dom_cleanup_work_20191206 diff --git a/cmake b/cmake index c4b0f3106..8cb156578 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit c4b0f3106d2b669a904c0bdb2fbb2146e97ebdde +Subproject commit 8cb156578620ce9ef8a20296717c3830b4f3762a From 54a260529d03424e8644a0bcecdba1b8e234e05f Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 6 Jan 2020 13:55:22 -0700 Subject: [PATCH 31/85] Update include/lib flags for sigio, sfcio, nemsio --- sorc/ncep_post.fd/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index ad4fd0a21..2eaf6fafc 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -188,8 +188,8 @@ set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLA set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS} ) add_dependencies(${EXENAME} ${LIBNAME}) -include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC} ${NEMSIO_INC} ${SFCIO_INC} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ) -target_link_libraries(${EXENAME} ${LIBNAME} ${SP_LIB4} ${SIGIO_LIB} ${SFCIO_LIB} ${GFSIO_LIB4} ${NEMSIO_LIB} ${IP_LIB4} ${W3EMC_LIB4} ${W3NCO_LIB4} ${G2TMPL_LIBd} ${G2_LIB4} ${CRTM_LIB} ${BACIO_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) +include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC4} ${NEMSIO_INC} ${SFCIO_INC4} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ) +target_link_libraries(${EXENAME} ${LIBNAME} ${SP_LIB4} ${SIGIO_LIB4} ${SFCIO_LIB4} ${GFSIO_LIB4} ${NEMSIO_LIB} ${IP_LIB4} ${W3EMC_LIB4} ${W3NCO_LIB4} ${G2TMPL_LIBd} ${G2_LIB4} ${CRTM_LIB} ${BACIO_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin From 8664d23043bc589f6b5716a2eafce72385bf507e Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 7 Jan 2020 13:47:27 -0700 Subject: [PATCH 32/85] Add REQUIRED attribute to find_package calls in CMakeLists.txt --- CMakeLists.txt | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d083e5938..ef42e3bb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,25 +39,25 @@ endif() if(POLICY CMP0012) cmake_policy(SET CMP0012 NEW) endif() -find_package( MPI ) -find_package( OpenMP ) -find_package( Jasper ) -find_package( LAPACK ) -find_package( SIGIO ) -find_package( PNG ) -find_package( ZLIB ) -find_package( W3NCO ) -find_package( G2 ) -find_package( G2TMPL ) -find_package( BACIO ) -find_package( IP ) -find_package( SP ) -find_package( SFCIO ) -find_package( NEMSIO ) -find_package( GFSIO ) -find_package( W3EMC ) -find_package( CRTM ) -find_package( HDF5 COMPONENTS C Fortran HL ) -find_package( NetCDF ) +find_package(MPI REQUIRED) +find_package(OpenMP) +find_package(LAPACK) +find_package(Jasper REQUIRED) +find_package(SIGIO REQUIRED) +find_package(PNG REQUIRED) +find_package(ZLIB REQUIRED) +find_package(W3NCO REQUIRED) +find_package(G2 REQUIRED) +find_package(G2TMPL REQUIRED) +find_package(BACIO REQUIRED) +find_package(IP REQUIRED) +find_package(SP REQUIRED) +find_package(SFCIO REQUIRED) +find_package(NEMSIO REQUIRED) +find_package(GFSIO REQUIRED) +find_package(W3EMC REQUIRED) +find_package(CRTM REQUIRED) +find_package(HDF5 COMPONENTS C Fortran HL REQUIRED) +find_package(NetCDF REQUIRED) add_subdirectory(sorc/ncep_post.fd) From e08626a59ccecb7415998207cdcecd9909181ba9 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 7 Jan 2020 13:56:19 -0700 Subject: [PATCH 33/85] Comment out LAPACK dependency in CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef42e3bb3..66a374115 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ if(POLICY CMP0012) endif() find_package(MPI REQUIRED) find_package(OpenMP) -find_package(LAPACK) +#find_package(LAPACK) find_package(Jasper REQUIRED) find_package(SIGIO REQUIRED) find_package(PNG REQUIRED) From c6c6bb45aa23ddde583a878d83fa2ffbc25f9fa0 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 8 Jan 2020 20:53:12 -0700 Subject: [PATCH 34/85] Revert change to .gitmodules, update submodule pointer for cmake --- .gitmodules | 6 ++---- cmake | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index 0187abd9c..4580dc21c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,4 @@ [submodule "cmake"] path = cmake - #url = https://github.com/NOAA-EMC/CMakeModules.git - #branch = ufs_release_1.0 - url = https://github.com/climbfuji/CMakeModules.git - branch = dom_cleanup_work_20191206 + url = https://github.com/NOAA-EMC/CMakeModules.git + branch = ufs_release_1.0 diff --git a/cmake b/cmake index 8cb156578..d4d73348a 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 8cb156578620ce9ef8a20296717c3830b4f3762a +Subproject commit d4d73348ae16ebb14ddf2c41d959675bbabf0f9e From cc9ac999f6f3e4cd052803ec793fb1928ddb4510 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 9 Jan 2020 07:58:17 -0700 Subject: [PATCH 35/85] sorc/ncep_post.fd/CMakeLists.txt: change GFSIO_INC to GFSIO_INC4 --- sorc/ncep_post.fd/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 2eaf6fafc..49daed143 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -188,7 +188,7 @@ set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLA set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS} ) add_dependencies(${EXENAME} ${LIBNAME}) -include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC4} ${NEMSIO_INC} ${SFCIO_INC4} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC} ${CRTM_INC} ) +include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC4} ${NEMSIO_INC} ${SFCIO_INC4} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC4} ${CRTM_INC} ) target_link_libraries(${EXENAME} ${LIBNAME} ${SP_LIB4} ${SIGIO_LIB4} ${SFCIO_LIB4} ${GFSIO_LIB4} ${NEMSIO_LIB} ${IP_LIB4} ${W3EMC_LIB4} ${W3NCO_LIB4} ${G2TMPL_LIBd} ${G2_LIB4} ${CRTM_LIB} ${BACIO_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) install(TARGETS ${EXENAME} From a4e0f3424433667074812ee748ac91c6e2752249 Mon Sep 17 00:00:00 2001 From: Wen Meng Date: Sat, 11 Jan 2020 02:01:05 +0000 Subject: [PATCH 36/85] Add capacity of detecting scaning mode north2south vs south2north in gaussian grid from Dusan. --- sorc/ncep_post.fd/grib2_module.f | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sorc/ncep_post.fd/grib2_module.f b/sorc/ncep_post.fd/grib2_module.f index 7d858ea13..d6b1ff93e 100644 --- a/sorc/ncep_post.fd/grib2_module.f +++ b/sorc/ncep_post.fd/grib2_module.f @@ -1389,6 +1389,11 @@ subroutine getgds(ldfgrd,len3,ifield3len,igds,ifield3) ifield3(16) = lonlast ifield3(17) = NINT(360./(IM)*1000000.) ifield3(18) = NINT(JM/2.0) + if( latstart < latlast ) then + ifield3(19) = 64 !for SN scan + else + ifield3(19) = 0 !for NS scan + endif ! !** Latlon grid ELSE IF(MAPTYPE == 0 ) THEN From 1fb2e174468bd21e4d984e8215d84070b9ddb919 Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser Date: Fri, 24 Jan 2020 10:11:00 -0500 Subject: [PATCH 37/85] Re-factor CMake --- CMakeLists.txt | 97 +++++--- sorc/ncep_post.fd/CMakeLists.txt | 385 ++++++++++++++++--------------- 2 files changed, 260 insertions(+), 222 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66a374115..3ccd6ee53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,21 +1,23 @@ -cmake_minimum_required(VERSION 2.6) -project(ncep_post) -set(VERSION v1.1.1) +cmake_minimum_required(VERSION 3.15) +project(ncep_post VERSION 1.1.1) +set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION} CACHE INTERNAL "${PROJECT_NAME} version number") + enable_language (Fortran) + if (NOT CMAKE_BUILD_TYPE) - set (CMAKE_BUILD_TYPE RELEASE CACHE STRING - "Choose the type of build, options are: PRODUCTION Debug Release." - FORCE) + set (CMAKE_BUILD_TYPE RELEASE CACHE STRING + "Choose the type of build, options are: PRODUCTION Debug Release." + FORCE) endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - message("setting intel true") set(IntelComp true ) elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang*") set(GNUComp true ) elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*") set(PGIComp true ) endif() -MESSAGE(${CMAKE_CURRENT_SOURCE_DIR}) + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE) if(NOT BUILD_RELEASE ) STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) @@ -24,40 +26,69 @@ STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEBUG" BUILD_DEBUG) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") -SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) -SET(ARCHIVE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set(CMAKE_INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include") -set(Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include") -set(CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include") -file(MAKE_DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) - if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) + cmake_policy(SET CMP0054 NEW) endif() if(POLICY CMP0012) - cmake_policy(SET CMP0012 NEW) + cmake_policy(SET CMP0012 NEW) endif() + find_package(MPI REQUIRED) find_package(OpenMP) -#find_package(LAPACK) -find_package(Jasper REQUIRED) -find_package(SIGIO REQUIRED) + find_package(PNG REQUIRED) find_package(ZLIB REQUIRED) -find_package(W3NCO REQUIRED) -find_package(G2 REQUIRED) -find_package(G2TMPL REQUIRED) -find_package(BACIO REQUIRED) -find_package(IP REQUIRED) -find_package(SP REQUIRED) -find_package(SFCIO REQUIRED) -find_package(NEMSIO REQUIRED) -find_package(GFSIO REQUIRED) -find_package(W3EMC REQUIRED) -find_package(CRTM REQUIRED) find_package(HDF5 COMPONENTS C Fortran HL REQUIRED) find_package(NetCDF REQUIRED) +find_package(Jasper REQUIRED) + +if(NOT TARGET sigio) + find_package(sigio REQUIRED) +endif() + +if(NOT TARGET w3nco_4) + find_package(w3nco REQUIRED) +endif() + +if(NOT TARGET g2_4) + find_package(g2 REQUIRED) +endif() + +if(NOT TARGET g2tmpl_d) + find_package(g2tmpl REQUIRED) +endif() + +if(NOT TARGET bacio_4) + find_package(bacio REQUIRED) +endif() + +if(NOT TARGET ip_4) + find_package(ip REQUIRED) +endif() + +if(NOT TARGET sp_4) + find_package(sp REQUIRED) +endif() + +if(NOT TARGET sfcio) + find_package(sfcio REQUIRED) +endif() + +if(NOT TARGET nemsio) + find_package(nemsio REQUIRED) +endif() + +if(NOT TARGET gfsio) + find_package(gfsio REQUIRED) +endif() + +if(NOT TARGET w3emc_4) + find_package(w3emc REQUIRED) +endif() + +if(NOT TARGET crtm) + find_package(CRTM REQUIRED) +endif() + add_subdirectory(sorc/ncep_post.fd) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 49daed143..214644e07 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -1,204 +1,211 @@ -cmake_minimum_required(VERSION 2.6) -set(EXENAME ncep_post ) -set(LIBNAME nceppost ) set(LIB_SRC -${CMAKE_CURRENT_SOURCE_DIR}/AllGETHERV_GSD.f -${CMAKE_CURRENT_SOURCE_DIR}/ALLOCATE_ALL.f -${CMAKE_CURRENT_SOURCE_DIR}/ASSIGNNEMSIOVAR.f -${CMAKE_CURRENT_SOURCE_DIR}/AVIATION.f -${CMAKE_CURRENT_SOURCE_DIR}/blockIO.c -${CMAKE_CURRENT_SOURCE_DIR}/BNDLYR.f -${CMAKE_CURRENT_SOURCE_DIR}/BOUND.f -${CMAKE_CURRENT_SOURCE_DIR}/CALCAPE.f -${CMAKE_CURRENT_SOURCE_DIR}/CALDRG.f -${CMAKE_CURRENT_SOURCE_DIR}/CALDWP.f -${CMAKE_CURRENT_SOURCE_DIR}/CALGUST.f -${CMAKE_CURRENT_SOURCE_DIR}/CALHEL.f -${CMAKE_CURRENT_SOURCE_DIR}/CALLCL.f -${CMAKE_CURRENT_SOURCE_DIR}/CALMCVG.f -${CMAKE_CURRENT_SOURCE_DIR}/CALMICT.f -${CMAKE_CURRENT_SOURCE_DIR}/CALPBL.f -${CMAKE_CURRENT_SOURCE_DIR}/CALPBLREGIME.f -${CMAKE_CURRENT_SOURCE_DIR}/CALPOT.f -${CMAKE_CURRENT_SOURCE_DIR}/CALPW.f -${CMAKE_CURRENT_SOURCE_DIR}/CALRAD_WCLOUD_newcrtm.f -${CMAKE_CURRENT_SOURCE_DIR}/CALRCH.f -${CMAKE_CURRENT_SOURCE_DIR}/CALRH.f -${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GFS.f -${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GSD.f -${CMAKE_CURRENT_SOURCE_DIR}/CALRH_PW.f -${CMAKE_CURRENT_SOURCE_DIR}/CALSTRM.f -${CMAKE_CURRENT_SOURCE_DIR}/CALTAU.f -${CMAKE_CURRENT_SOURCE_DIR}/CALTHTE.f -${CMAKE_CURRENT_SOURCE_DIR}/CALUPDHEL.f -${CMAKE_CURRENT_SOURCE_DIR}/CALVIS.f -${CMAKE_CURRENT_SOURCE_DIR}/CALVIS_GSD.f -${CMAKE_CURRENT_SOURCE_DIR}/CALVOR.f -${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_BOURG.f -${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_DOMINANT.f -${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_EXPLICIT.f -${CMAKE_CURRENT_SOURCE_DIR}/CALWXT.f -${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_RAMER.f -${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_REVISED.f -${CMAKE_CURRENT_SOURCE_DIR}/CANRES.f -${CMAKE_CURRENT_SOURCE_DIR}/CLDFRAC_ZHAO.f -${CMAKE_CURRENT_SOURCE_DIR}/CLDRAD.f -${CMAKE_CURRENT_SOURCE_DIR}/CLMAX.f -${CMAKE_CURRENT_SOURCE_DIR}/CMASSI.f -${CMAKE_CURRENT_SOURCE_DIR}/COLLECT.f -${CMAKE_CURRENT_SOURCE_DIR}/COLLECT_LOC.f -${CMAKE_CURRENT_SOURCE_DIR}/CTLBLK.f -${CMAKE_CURRENT_SOURCE_DIR}/cuparm.f -${CMAKE_CURRENT_SOURCE_DIR}/DEALLOCATE.f -${CMAKE_CURRENT_SOURCE_DIR}/DEWPOINT.f -${CMAKE_CURRENT_SOURCE_DIR}/ETCALC.f -${CMAKE_CURRENT_SOURCE_DIR}/EXCH2.f -${CMAKE_CURRENT_SOURCE_DIR}/EXCH.f -${CMAKE_CURRENT_SOURCE_DIR}/FDLVL.f -${CMAKE_CURRENT_SOURCE_DIR}/FGAMMA.f -${CMAKE_CURRENT_SOURCE_DIR}/FILL_PSETFLD.f -${CMAKE_CURRENT_SOURCE_DIR}/FIXED.f -${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL2.f -${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL.f -${CMAKE_CURRENT_SOURCE_DIR}/GEO_ZENITH_ANGLE.f -${CMAKE_CURRENT_SOURCE_DIR}/GET_BITS.f -${CMAKE_CURRENT_SOURCE_DIR}/GETGBANDSCATTER.f -${CMAKE_CURRENT_SOURCE_DIR}/getIVariableN.f -${CMAKE_CURRENT_SOURCE_DIR}/GETNEMSNDSCATTER.f -${CMAKE_CURRENT_SOURCE_DIR}/get_postfilename.f -${CMAKE_CURRENT_SOURCE_DIR}/getVariable.f -${CMAKE_CURRENT_SOURCE_DIR}/GFIP3.f -${CMAKE_CURRENT_SOURCE_DIR}/GFSPOST.F -${CMAKE_CURRENT_SOURCE_DIR}/GPVS.f -${CMAKE_CURRENT_SOURCE_DIR}/grib2_module.f -${CMAKE_CURRENT_SOURCE_DIR}/GRIBIT.F -${CMAKE_CURRENT_SOURCE_DIR}/GRIDAVG.f -${CMAKE_CURRENT_SOURCE_DIR}/GRIDSPEC.f -${CMAKE_CURRENT_SOURCE_DIR}/gtg_algo.f90 -${CMAKE_CURRENT_SOURCE_DIR}/gtg_compute.f90 -${CMAKE_CURRENT_SOURCE_DIR}/gtg_config.f90 -${CMAKE_CURRENT_SOURCE_DIR}/gtg_ctlblk.f90 -${CMAKE_CURRENT_SOURCE_DIR}/gtg_filter.f90 -${CMAKE_CURRENT_SOURCE_DIR}/gtg_indices.f90 -${CMAKE_CURRENT_SOURCE_DIR}/gtg_smoothseams.f90 -${CMAKE_CURRENT_SOURCE_DIR}/ICAOHEIGHT.f -${CMAKE_CURRENT_SOURCE_DIR}/INITPOST.F -${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS.f -${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS.f -${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS_MPIIO.f -${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_SIGIO.f -${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS.f -${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS_MPIIO.f -${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NETCDF.f -${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NMM.f -${CMAKE_CURRENT_SOURCE_DIR}/kinds_mod.F -${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD.f -${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD_GFS.f -${CMAKE_CURRENT_SOURCE_DIR}/LOOKUP.f -${CMAKE_CURRENT_SOURCE_DIR}/machine.f -${CMAKE_CURRENT_SOURCE_DIR}/map_routines.f90 -${CMAKE_CURRENT_SOURCE_DIR}/MAPSSLP.f -${CMAKE_CURRENT_SOURCE_DIR}/MASKS_mod.f -${CMAKE_CURRENT_SOURCE_DIR}/MDL2AGL.f -${CMAKE_CURRENT_SOURCE_DIR}/MDL2P.f -${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA2.f -${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA.f -${CMAKE_CURRENT_SOURCE_DIR}/MDL2THANDPV.f -${CMAKE_CURRENT_SOURCE_DIR}/MDLFLD.f -${CMAKE_CURRENT_SOURCE_DIR}/MICROINIT.F -${CMAKE_CURRENT_SOURCE_DIR}/MISCLN.f -${CMAKE_CURRENT_SOURCE_DIR}/MIXLEN.f -${CMAKE_CURRENT_SOURCE_DIR}/MPI_FIRST.f -${CMAKE_CURRENT_SOURCE_DIR}/MPI_LAST.f -${CMAKE_CURRENT_SOURCE_DIR}/MSFPS.f -${CMAKE_CURRENT_SOURCE_DIR}/native_endianness.f -${CMAKE_CURRENT_SOURCE_DIR}/NGMFLD.f -${CMAKE_CURRENT_SOURCE_DIR}/NGMSLP.f -${CMAKE_CURRENT_SOURCE_DIR}/OTLFT.f -${CMAKE_CURRENT_SOURCE_DIR}/OTLIFT.f -${CMAKE_CURRENT_SOURCE_DIR}/PARAMR.f -${CMAKE_CURRENT_SOURCE_DIR}/params.F -${CMAKE_CURRENT_SOURCE_DIR}/PARA_RANGE.f -${CMAKE_CURRENT_SOURCE_DIR}/physcons.f -${CMAKE_CURRENT_SOURCE_DIR}/PMICRPH.f -${CMAKE_CURRENT_SOURCE_DIR}/POLEAVG.f -${CMAKE_CURRENT_SOURCE_DIR}/PROCESS.f -${CMAKE_CURRENT_SOURCE_DIR}/READCNTRL.F -${CMAKE_CURRENT_SOURCE_DIR}/READ_xml.f -${CMAKE_CURRENT_SOURCE_DIR}/retrieve_index.f -${CMAKE_CURRENT_SOURCE_DIR}/RHGRD.f -${CMAKE_CURRENT_SOURCE_DIR}/RQSTFLD.F -${CMAKE_CURRENT_SOURCE_DIR}/SCLFLD.f -${CMAKE_CURRENT_SOURCE_DIR}/SELECT_CHANNELS.f -${CMAKE_CURRENT_SOURCE_DIR}/SERVER.f -${CMAKE_CURRENT_SOURCE_DIR}/SET_LVLSXML.f -${CMAKE_CURRENT_SOURCE_DIR}/SET_OUTFLDS.f -${CMAKE_CURRENT_SOURCE_DIR}/SETUP_SERVERS.f -${CMAKE_CURRENT_SOURCE_DIR}/SLP_new.f -${CMAKE_CURRENT_SOURCE_DIR}/SLP_NMM.f -${CMAKE_CURRENT_SOURCE_DIR}/SMOOTH.f -${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC.f -${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC_GFS.f -${CMAKE_CURRENT_SOURCE_DIR}/SOIL_mod.f -${CMAKE_CURRENT_SOURCE_DIR}/SPLINE.f -${CMAKE_CURRENT_SOURCE_DIR}/SURFCE.f -${CMAKE_CURRENT_SOURCE_DIR}/svptbl.f -${CMAKE_CURRENT_SOURCE_DIR}/TABLE.f -${CMAKE_CURRENT_SOURCE_DIR}/TABLEQ.f -${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS.f -${CMAKE_CURRENT_SOURCE_DIR}/TTBLEX.f -${CMAKE_CURRENT_SOURCE_DIR}/VRBLS2D_mod.f -${CMAKE_CURRENT_SOURCE_DIR}/VRBLS3D_mod.f -${CMAKE_CURRENT_SOURCE_DIR}/VRBLS4D_mod.f -${CMAKE_CURRENT_SOURCE_DIR}/WETBULB.f -${CMAKE_CURRENT_SOURCE_DIR}/WETFRZLVL.f -${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.f -${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.h -${CMAKE_CURRENT_SOURCE_DIR}/xml_perl_data.f -${CMAKE_CURRENT_SOURCE_DIR}/ZENSUN.f) + ${CMAKE_CURRENT_SOURCE_DIR}/AllGETHERV_GSD.f + ${CMAKE_CURRENT_SOURCE_DIR}/ALLOCATE_ALL.f + ${CMAKE_CURRENT_SOURCE_DIR}/ASSIGNNEMSIOVAR.f + ${CMAKE_CURRENT_SOURCE_DIR}/AVIATION.f + ${CMAKE_CURRENT_SOURCE_DIR}/blockIO.c + ${CMAKE_CURRENT_SOURCE_DIR}/BNDLYR.f + ${CMAKE_CURRENT_SOURCE_DIR}/BOUND.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALCAPE.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALDRG.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALDWP.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALGUST.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALHEL.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALLCL.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALMCVG.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALMICT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALPBL.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALPBLREGIME.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALPOT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALPW.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRAD_WCLOUD_newcrtm.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRCH.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRH.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GFS.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GSD.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_PW.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALSTRM.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALTAU.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALTHTE.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALUPDHEL.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALVIS.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALVIS_GSD.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALVOR.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_BOURG.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_DOMINANT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_EXPLICIT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_RAMER.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_REVISED.f + ${CMAKE_CURRENT_SOURCE_DIR}/CANRES.f + ${CMAKE_CURRENT_SOURCE_DIR}/CLDFRAC_ZHAO.f + ${CMAKE_CURRENT_SOURCE_DIR}/CLDRAD.f + ${CMAKE_CURRENT_SOURCE_DIR}/CLMAX.f + ${CMAKE_CURRENT_SOURCE_DIR}/CMASSI.f + ${CMAKE_CURRENT_SOURCE_DIR}/COLLECT.f + ${CMAKE_CURRENT_SOURCE_DIR}/COLLECT_LOC.f + ${CMAKE_CURRENT_SOURCE_DIR}/CTLBLK.f + ${CMAKE_CURRENT_SOURCE_DIR}/cuparm.f + ${CMAKE_CURRENT_SOURCE_DIR}/DEALLOCATE.f + ${CMAKE_CURRENT_SOURCE_DIR}/DEWPOINT.f + ${CMAKE_CURRENT_SOURCE_DIR}/ETCALC.f + ${CMAKE_CURRENT_SOURCE_DIR}/EXCH2.f + ${CMAKE_CURRENT_SOURCE_DIR}/EXCH.f + ${CMAKE_CURRENT_SOURCE_DIR}/FDLVL.f + ${CMAKE_CURRENT_SOURCE_DIR}/FGAMMA.f + ${CMAKE_CURRENT_SOURCE_DIR}/FILL_PSETFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/FIXED.f + ${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL2.f + ${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL.f + ${CMAKE_CURRENT_SOURCE_DIR}/GEO_ZENITH_ANGLE.f + ${CMAKE_CURRENT_SOURCE_DIR}/GET_BITS.f + ${CMAKE_CURRENT_SOURCE_DIR}/GETGBANDSCATTER.f + ${CMAKE_CURRENT_SOURCE_DIR}/getIVariableN.f + ${CMAKE_CURRENT_SOURCE_DIR}/GETNEMSNDSCATTER.f + ${CMAKE_CURRENT_SOURCE_DIR}/get_postfilename.f + ${CMAKE_CURRENT_SOURCE_DIR}/getVariable.f + ${CMAKE_CURRENT_SOURCE_DIR}/GFIP3.f + ${CMAKE_CURRENT_SOURCE_DIR}/GFSPOST.F + ${CMAKE_CURRENT_SOURCE_DIR}/GPVS.f + ${CMAKE_CURRENT_SOURCE_DIR}/grib2_module.f + ${CMAKE_CURRENT_SOURCE_DIR}/GRIBIT.F + ${CMAKE_CURRENT_SOURCE_DIR}/GRIDAVG.f + ${CMAKE_CURRENT_SOURCE_DIR}/GRIDSPEC.f + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_algo.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_compute.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_config.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_ctlblk.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_filter.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_indices.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_smoothseams.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/ICAOHEIGHT.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST.F + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS_MPIIO.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_SIGIO.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS_MPIIO.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NETCDF.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NMM.f + ${CMAKE_CURRENT_SOURCE_DIR}/kinds_mod.F + ${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD_GFS.f + ${CMAKE_CURRENT_SOURCE_DIR}/LOOKUP.f + ${CMAKE_CURRENT_SOURCE_DIR}/machine.f + ${CMAKE_CURRENT_SOURCE_DIR}/map_routines.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/MAPSSLP.f + ${CMAKE_CURRENT_SOURCE_DIR}/MASKS_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2AGL.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2P.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA2.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2THANDPV.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDLFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/MICROINIT.F + ${CMAKE_CURRENT_SOURCE_DIR}/MISCLN.f + ${CMAKE_CURRENT_SOURCE_DIR}/MIXLEN.f + ${CMAKE_CURRENT_SOURCE_DIR}/MPI_FIRST.f + ${CMAKE_CURRENT_SOURCE_DIR}/MPI_LAST.f + ${CMAKE_CURRENT_SOURCE_DIR}/MSFPS.f + ${CMAKE_CURRENT_SOURCE_DIR}/native_endianness.f + ${CMAKE_CURRENT_SOURCE_DIR}/NGMFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/NGMSLP.f + ${CMAKE_CURRENT_SOURCE_DIR}/OTLFT.f + ${CMAKE_CURRENT_SOURCE_DIR}/OTLIFT.f + ${CMAKE_CURRENT_SOURCE_DIR}/PARAMR.f + ${CMAKE_CURRENT_SOURCE_DIR}/params.F + ${CMAKE_CURRENT_SOURCE_DIR}/PARA_RANGE.f + ${CMAKE_CURRENT_SOURCE_DIR}/physcons.f + ${CMAKE_CURRENT_SOURCE_DIR}/PMICRPH.f + ${CMAKE_CURRENT_SOURCE_DIR}/POLEAVG.f + ${CMAKE_CURRENT_SOURCE_DIR}/PROCESS.f + ${CMAKE_CURRENT_SOURCE_DIR}/READCNTRL.F + ${CMAKE_CURRENT_SOURCE_DIR}/READ_xml.f + ${CMAKE_CURRENT_SOURCE_DIR}/retrieve_index.f + ${CMAKE_CURRENT_SOURCE_DIR}/RHGRD.f + ${CMAKE_CURRENT_SOURCE_DIR}/RQSTFLD.F + ${CMAKE_CURRENT_SOURCE_DIR}/SCLFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/SELECT_CHANNELS.f + ${CMAKE_CURRENT_SOURCE_DIR}/SERVER.f + ${CMAKE_CURRENT_SOURCE_DIR}/SET_LVLSXML.f + ${CMAKE_CURRENT_SOURCE_DIR}/SET_OUTFLDS.f + ${CMAKE_CURRENT_SOURCE_DIR}/SETUP_SERVERS.f + ${CMAKE_CURRENT_SOURCE_DIR}/SLP_new.f + ${CMAKE_CURRENT_SOURCE_DIR}/SLP_NMM.f + ${CMAKE_CURRENT_SOURCE_DIR}/SMOOTH.f + ${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC.f + ${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC_GFS.f + ${CMAKE_CURRENT_SOURCE_DIR}/SOIL_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/SPLINE.f + ${CMAKE_CURRENT_SOURCE_DIR}/SURFCE.f + ${CMAKE_CURRENT_SOURCE_DIR}/svptbl.f + ${CMAKE_CURRENT_SOURCE_DIR}/TABLE.f + ${CMAKE_CURRENT_SOURCE_DIR}/TABLEQ.f + ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS.f + ${CMAKE_CURRENT_SOURCE_DIR}/TTBLEX.f + ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS2D_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS3D_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS4D_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/WETBULB.f + ${CMAKE_CURRENT_SOURCE_DIR}/WETFRZLVL.f + ${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.f + ${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.h + ${CMAKE_CURRENT_SOURCE_DIR}/xml_perl_data.f + ${CMAKE_CURRENT_SOURCE_DIR}/ZENSUN.f) + file(GLOB EXE_SRC *.f *.f90 *.F) file(GLOB EXE_C_SRC *.c) -list( REMOVE_ITEM EXE_SRC ${LIB_SRC}) -list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) -list( REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) + +list(REMOVE_ITEM EXE_SRC ${LIB_SRC}) +list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) +list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) + if(IntelComp) - message("setting intel flags") - set(CMAKE_Fortran_FLAGS " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) - set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") + set(Cfortran_flags " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}") + set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") elseif(GNUComp) - message("setting gnu flags") - set(CMAKE_Fortran_FLAGS "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) -# set(CMAKE_Fortran_FLAGS "-O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check -ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}" CACHE INTERNAL "" ) - if(APPLE) - set(CMAKE_C_FLAGS "-DAPPLE -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") - elseif(UNIX) - set(CMAKE_C_FLAGS "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" CACHE INTERNAL "") - endif(APPLE) + set(fortran_flags "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}") + if(APPLE) + set(c_flags "-DAPPLE -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") + elseif(UNIX) + set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") + endif(APPLE) else() - message("unknown compiler!") - exit() + message("unknown compiler!") + exit() endif() -add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) -add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC} ) -set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_FLAGS} ) -set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_FLAGS} ) -set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) -set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS} ) -add_dependencies(${EXENAME} ${LIBNAME}) +set(EXENAME ncep_post) +set(LIBNAME nceppost) + +add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC}) +add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC}) + +set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) +set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) +set_source_files_properbties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${c_flags}) +set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) + +set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include") +set_target_properties(${EXENAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") +set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") + +target_include_directories(${EXENAME} ${MPI_Fortran_MODULE_DIR} + ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) -include_directories( ${MPI_Fortran_MODULE_DIR} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${SIGIO_INC4} ${NEMSIO_INC} ${SFCIO_INC4} ${W3EMC_INC4} ${G2_INC4} ${G2TMPL_INCd} ${GFSIO_INC4} ${CRTM_INC} ) -target_link_libraries(${EXENAME} ${LIBNAME} ${SP_LIB4} ${SIGIO_LIB4} ${SFCIO_LIB4} ${GFSIO_LIB4} ${NEMSIO_LIB} ${IP_LIB4} ${W3EMC_LIB4} ${W3NCO_LIB4} ${G2TMPL_LIBd} ${G2_LIB4} ${CRTM_LIB} ${BACIO_LIB4} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) +target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} sp_4 sigio sfcio gfsio_4 + nemsio ip_4 w3emc_4 w3nco_4 g2tmpl_d g2_4 crtm bacio_4 ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS}) install(TARGETS ${EXENAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) install(TARGETS ${LIBNAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) -install(DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/ DESTINATION include_4 ) +install(DIRECTORY ${module_dir} DESTINATION include_4 ) From 10b33436b65af7bebb684a3524a8ecd1af4bdb04 Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser Date: Fri, 24 Jan 2020 15:14:21 -0500 Subject: [PATCH 38/85] Fix library linking --- sorc/ncep_post.fd/CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 214644e07..b703a7dd4 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -183,20 +183,22 @@ set(LIBNAME nceppost) add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC}) add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC}) -set_source_files_properties( ${EXE_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) -set_source_files_properties( ${LIB_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) -set_source_files_properbties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${c_flags}) -set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) +set_source_files_properties(${EXE_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) +set_source_files_properties(${LIB_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) +set_source_files_properties(${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${c_flags}) +set_target_properties(${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include") set_target_properties(${EXENAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") -target_include_directories(${EXENAME} ${MPI_Fortran_MODULE_DIR} +target_include_directories(${LIBNAME} PUBLIC ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) -target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} sp_4 sigio sfcio gfsio_4 - nemsio ip_4 w3emc_4 w3nco_4 g2tmpl_d g2_4 crtm bacio_4 ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS}) +target_link_libraries(${LIBNAME} sp_4 sigio sfcio gfsio_4 + nemsio ip_4 w3emc_4 w3nco_4 g2tmpl_d g2_4 crtm bacio_4) + +target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS}) install(TARGETS ${EXENAME} RUNTIME DESTINATION bin From 94be3f3d035b26c40a551c2dc76d841a41567434 Mon Sep 17 00:00:00 2001 From: Mark Potts Date: Fri, 24 Jan 2020 18:00:33 -0500 Subject: [PATCH 39/85] small fix to kyles refactor --- CMakeLists.txt | 2 +- sorc/ncep_post.fd/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ccd6ee53..34a25ea20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,7 +78,7 @@ if(NOT TARGET nemsio) find_package(nemsio REQUIRED) endif() -if(NOT TARGET gfsio) +if(NOT TARGET gfsio_4) find_package(gfsio REQUIRED) endif() diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index b703a7dd4..43038d38a 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -196,9 +196,9 @@ target_include_directories(${LIBNAME} PUBLIC ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) target_link_libraries(${LIBNAME} sp_4 sigio sfcio gfsio_4 - nemsio ip_4 w3emc_4 w3nco_4 g2tmpl_d g2_4 crtm bacio_4) + nemsio ip_4 w3emc_4 w3nco_4 g2tmpl_d g2_4 crtm bacio_4 ${PNG_LIBRARIES}) -target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${PNG_LIBRARIES} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS}) +target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ${PNG_LIBRARIES}) install(TARGETS ${EXENAME} RUNTIME DESTINATION bin From 5ce8a62fe275dced9d9aaed8361349a359558bab Mon Sep 17 00:00:00 2001 From: Wen Meng Date: Sat, 11 Jan 2020 02:01:05 +0000 Subject: [PATCH 40/85] Add capacity of detecting scaning mode north2south vs south2north in gaussian grid from Dusan. --- sorc/ncep_post.fd/grib2_module.f | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sorc/ncep_post.fd/grib2_module.f b/sorc/ncep_post.fd/grib2_module.f index 7d858ea13..d6b1ff93e 100644 --- a/sorc/ncep_post.fd/grib2_module.f +++ b/sorc/ncep_post.fd/grib2_module.f @@ -1389,6 +1389,11 @@ subroutine getgds(ldfgrd,len3,ifield3len,igds,ifield3) ifield3(16) = lonlast ifield3(17) = NINT(360./(IM)*1000000.) ifield3(18) = NINT(JM/2.0) + if( latstart < latlast ) then + ifield3(19) = 64 !for SN scan + else + ifield3(19) = 0 !for NS scan + endif ! !** Latlon grid ELSE IF(MAPTYPE == 0 ) THEN From dec5cd986ce80febc855a8072e19fd6a94c2527f Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 29 Jan 2020 15:21:56 +0000 Subject: [PATCH 41/85] Fix typo in sorc/ncep_post.fd/CMakeLists.txt --- sorc/ncep_post.fd/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 43038d38a..0c2a64420 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -163,7 +163,7 @@ list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) if(IntelComp) - set(Cfortran_flags " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}") + set(fortran_flags " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}") set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") elseif(GNUComp) set(fortran_flags "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}") From be20754757ae1433f11d2ba06a8cc7489c3ea11c Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser Date: Wed, 29 Jan 2020 13:37:00 -0500 Subject: [PATCH 42/85] Fix how Intel compile options with spaces in them are handled --- sorc/ncep_post.fd/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 43038d38a..1fce11c64 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -163,7 +163,7 @@ list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) if(IntelComp) - set(Cfortran_flags " -free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}") + set(fortran_flags "-free" "-O3" "-convert" "big_endian" "-traceback" "-g" "-fp-model" "source" "${OpenMP_Fortran_FLAGS}") set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") elseif(GNUComp) set(fortran_flags "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}") From 8a258ac908a089496c0236e5e841c75fe408f303 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 30 Jan 2020 12:11:40 -0700 Subject: [PATCH 43/85] Update branch name for cmake submodule, update submodule pointer --- .gitmodules | 2 +- cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 4580dc21c..66d138b95 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "cmake"] path = cmake url = https://github.com/NOAA-EMC/CMakeModules.git - branch = ufs_release_1.0 + branch = release/public-v1 diff --git a/cmake b/cmake index d4d73348a..d23e21b64 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit d4d73348ae16ebb14ddf2c41d959675bbabf0f9e +Subproject commit d23e21b64878b11cf335676af9bcfcb83be6dd74 From 802eb269a065d05bb6e30a338ed905f5d450eb78 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 30 Jan 2020 12:22:28 -0700 Subject: [PATCH 44/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index d23e21b64..7f5b1b3f5 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit d23e21b64878b11cf335676af9bcfcb83be6dd74 +Subproject commit 7f5b1b3f51ddaf2d33b0e658587b978887c524f7 From bdd150ff0bedb259e7186df47cb5fa59e17945cb Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 3 Feb 2020 14:56:34 -0700 Subject: [PATCH 45/85] Update .gitmodules and submodule pointer for cmake, bugfixes for CMakeLists.txt --- .gitmodules | 6 ++++-- CMakeLists.txt | 6 +++--- cmake | 2 +- sorc/ncep_post.fd/CMakeLists.txt | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitmodules b/.gitmodules index 66d138b95..9a5be88bf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,6 @@ [submodule "cmake"] path = cmake - url = https://github.com/NOAA-EMC/CMakeModules.git - branch = release/public-v1 + #url = https://github.com/NOAA-EMC/CMakeModules + #branch = release/public-v1 + url = https://github.com/climbfuji/CMakeModules + branch = bugfixes_dom_20200202 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 34a25ea20..7b55358f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ find_package(HDF5 COMPONENTS C Fortran HL REQUIRED) find_package(NetCDF REQUIRED) find_package(Jasper REQUIRED) -if(NOT TARGET sigio) +if(NOT TARGET sigio_4) find_package(sigio REQUIRED) endif() @@ -70,11 +70,11 @@ if(NOT TARGET sp_4) find_package(sp REQUIRED) endif() -if(NOT TARGET sfcio) +if(NOT TARGET sfcio_4) find_package(sfcio REQUIRED) endif() -if(NOT TARGET nemsio) +if(NOT TARGET nemsio) find_package(nemsio REQUIRED) endif() diff --git a/cmake b/cmake index 7f5b1b3f5..01f67917d 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 7f5b1b3f51ddaf2d33b0e658587b978887c524f7 +Subproject commit 01f67917d0684f4ad5bc47557292f061a402423f diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index ee9c3501b..c87979342 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -196,7 +196,7 @@ set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_d target_include_directories(${LIBNAME} PUBLIC ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) -target_link_libraries(${LIBNAME} sp_4 sigio sfcio gfsio_4 +target_link_libraries(${LIBNAME} sp_4 sigio_4 sfcio_4 gfsio_4 nemsio ip_4 w3emc_4 w3nco_4 g2tmpl_d g2_4 crtm bacio_4 ${PNG_LIBRARIES}) target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ${PNG_LIBRARIES}) From 65bad662d685f57eb55b2a50fac30874888c7dfa Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 4 Feb 2020 08:18:43 -0700 Subject: [PATCH 46/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 01f67917d..d6d834fa1 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 01f67917d0684f4ad5bc47557292f061a402423f +Subproject commit d6d834fa1c2023248308643cffb4bb08fd3a9856 From 5c88ba122d2561628791dcfe6058743966898dc8 Mon Sep 17 00:00:00 2001 From: Mark Potts Date: Tue, 4 Feb 2020 14:11:50 -0500 Subject: [PATCH 47/85] fixes problem linking ncep_post with gnu/openmpi --- sorc/ncep_post.fd/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index ee9c3501b..4ba37d623 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -197,9 +197,9 @@ target_include_directories(${LIBNAME} PUBLIC ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) target_link_libraries(${LIBNAME} sp_4 sigio sfcio gfsio_4 - nemsio ip_4 w3emc_4 w3nco_4 g2tmpl_d g2_4 crtm bacio_4 ${PNG_LIBRARIES}) + nemsio ip_4 w3emc_4 w3nco_4 g2tmpl_d g2_4 crtm bacio_4 ${PNG_LIBRARIES} ${JASPER_LIBRARY}) -target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${JASPER_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ${PNG_LIBRARIES}) +target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) install(TARGETS ${EXENAME} RUNTIME DESTINATION bin From 4f89f38a64e53ff9c9f03c289089a570452f4584 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 4 Feb 2020 14:22:30 -0700 Subject: [PATCH 48/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index d6d834fa1..ee1eb50c8 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit d6d834fa1c2023248308643cffb4bb08fd3a9856 +Subproject commit ee1eb50c8b7260ce1cbff916dba40962b1d59d4f From ec62527526d9fa1d8bbc91872c8296cecb014267 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 4 Feb 2020 15:27:34 -0700 Subject: [PATCH 49/85] Revert .gitmodules change --- .gitmodules | 6 ++---- cmake | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9a5be88bf..5db8ad97a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,4 @@ [submodule "cmake"] path = cmake - #url = https://github.com/NOAA-EMC/CMakeModules - #branch = release/public-v1 - url = https://github.com/climbfuji/CMakeModules - branch = bugfixes_dom_20200202 \ No newline at end of file + url = https://github.com/NOAA-EMC/CMakeModules + branch = release/public-v1 diff --git a/cmake b/cmake index ee1eb50c8..2c03cb58e 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit ee1eb50c8b7260ce1cbff916dba40962b1d59d4f +Subproject commit 2c03cb58e3c571b42fbc2528c1f7f41c986d9f32 From 4ef08ba9022408faec76d59e50aede5dfc19bbda Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 12 Feb 2020 18:26:51 -0700 Subject: [PATCH 50/85] Bugfix: comment out debug print statement that can lead to out-of-bounds access; update submodule pointer for cmake --- cmake | 2 +- sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake b/cmake index 2c03cb58e..a9b2ef12c 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 2c03cb58e3c571b42fbc2528c1f7f41c986d9f32 +Subproject commit a9b2ef12c9ac924cbbff335078681ea8ca9d9fac diff --git a/sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f b/sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f index 17dd1651c..36557b75a 100644 --- a/sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f +++ b/sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f @@ -827,8 +827,8 @@ SUBROUTINE INITPOST_GFS_NETCDF(ncid3d) pint(i,j,l) = pint(i,j,l-1) + dpres(i,j,l-1) enddo enddo - if (me == 0) print*,'sample model pint,pmid' ,ii,jj,l & - ,pint(ii,jj,l),pmid(ii,jj,l) +! if (me == 0) print*,'sample model pint,pmid' ,ii,jj,l & +! ,pint(ii,jj,l),pmid(ii,jj,l) end do ! do l=lm,1,-1 From ddd72e7719282dfb8a90d193c75dd882f125c5d6 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 13 Feb 2020 15:04:22 -0700 Subject: [PATCH 51/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index a9b2ef12c..b7614b166 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit a9b2ef12c9ac924cbbff335078681ea8ca9d9fac +Subproject commit b7614b166417b85f8c71f508720cd65b7c159e34 From d1289cc6c057ac9cbfa993bf282ce0de4cdd022d Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 14 Feb 2020 13:32:37 -0700 Subject: [PATCH 52/85] OpenMP bugfix, use lowercase in find_package(CRTM) --- CMakeLists.txt | 9 ++++++--- cmake | 2 +- sorc/ncep_post.fd/CMakeLists.txt | 7 ++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b55358f1..621fdf4c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION} CACHE INTERNAL "${PROJECT_NAME} v enable_language (Fortran) +option(OPENMP "use OpenMP threading" OFF) + if (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: PRODUCTION Debug Release." @@ -34,8 +36,9 @@ if(POLICY CMP0012) endif() find_package(MPI REQUIRED) -find_package(OpenMP) - +if(OPENMP) + find_package(OpenMP) +endif() find_package(PNG REQUIRED) find_package(ZLIB REQUIRED) find_package(HDF5 COMPONENTS C Fortran HL REQUIRED) @@ -87,7 +90,7 @@ if(NOT TARGET w3emc_4) endif() if(NOT TARGET crtm) - find_package(CRTM REQUIRED) + find_package(crtm REQUIRED) endif() diff --git a/cmake b/cmake index b7614b166..207c78986 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit b7614b166417b85f8c71f508720cd65b7c159e34 +Subproject commit 207c7898658e147ca0032c6d81a25ac1001058e7 diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index be18cf1fa..d3da41851 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -163,8 +163,7 @@ list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) if(IntelComp) - set(fortran_flags "-free" "-O3" "-convert" "big_endian" "-traceback" - "-g" "-fp-model" "source" "${OpenMP_Fortran_FLAGS}") + set(fortran_flags "-free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}") set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") elseif(GNUComp) set(fortran_flags "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}") @@ -187,7 +186,9 @@ add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC}) set_source_files_properties(${EXE_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) set_source_files_properties(${LIB_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) set_source_files_properties(${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${c_flags}) -set_target_properties(${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) +if(OPENMP) + set_target_properties(${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) +endif() set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include") set_target_properties(${EXENAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") From ebacbe241f8fe114277ac8e3226724bd8de5f474 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 18 Feb 2020 16:17:02 -0700 Subject: [PATCH 53/85] Fix post crash on macOS: use allocatable array --- sorc/ncep_post.fd/GFSPOST.F | 2 +- sorc/ncep_post.fd/grib2_module.f | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sorc/ncep_post.fd/GFSPOST.F b/sorc/ncep_post.fd/GFSPOST.F index 226c6ad03..823aaf7ed 100644 --- a/sorc/ncep_post.fd/GFSPOST.F +++ b/sorc/ncep_post.fd/GFSPOST.F @@ -435,7 +435,7 @@ subroutine tpause(km,p,u,v,t,h,ptp,utp,vtp,ttp,htp,shrtp) ! call rsearch1(km-k-1,h(k+1),1,h(k)+hd,kd) call rsearch1(k-2,h(2),1,h(k)+hd,kd) ! td=t(k+kd)+(h(k)+hd-h(k+kd))/(h(k+kd+1)-h(k+kd))*(t(k+kd+1)-t(k+kd)) - td=t(kd+2)+(h(k)+hd-h(2+kd))/(h(kd+1)-h(2+kd))*(t(kd+1)-t(2+kd)) + td=t(kd+2)+(h(k)+hd-h(2+kd))/(h(kd+1)-h(2+kd))*(t(kd+1)-t(2+kd)) gami=(t(k)-td)/hd if(gami.le.gamtp) then ktp=k diff --git a/sorc/ncep_post.fd/grib2_module.f b/sorc/ncep_post.fd/grib2_module.f index d6b1ff93e..1ea0cb490 100644 --- a/sorc/ncep_post.fd/grib2_module.f +++ b/sorc/ncep_post.fd/grib2_module.f @@ -221,11 +221,12 @@ subroutine gribit2(post_fname) real,allocatable :: datafld(:,:) real,allocatable :: datafldtmp(:) ! - character(1) cgrib(max_bytes) + character(1), dimension(:), allocatable :: cgrib ! ! !---------------- code starts here -------------------------- ! + allocate(cgrib(max_bytes)) ! !******* part 1 resitribute data ******** ! @@ -328,9 +329,9 @@ subroutine gribit2(post_fname) ! call baclose(lunout,ierr) print *,'finish one grib file' - endif + endif ! if(me==0) ! -!for more fields, use pararrle i/o +!for more fields, use parallel i/o else ! ! print *,'in grib2,num_procs=',num_procs @@ -459,6 +460,7 @@ subroutine gribit2(post_fname) ! deallocate(datafld,bmap,mg) deallocate(nfld_pe,snfld_pe,enfld_pe,jsta_pe,jend_pe) + deallocate(cgrib) ! end subroutine gribit2 ! From 589b1a33d5dff1b0d3aaf843c83cb61dc10b1bba Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 19 Feb 2020 09:15:06 -0700 Subject: [PATCH 54/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 207c78986..50306eb25 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 207c7898658e147ca0032c6d81a25ac1001058e7 +Subproject commit 50306eb2502a525551aa076e95d6303af24c4208 From 13674894470cd77ce30376e56e9b7e6392cc2696 Mon Sep 17 00:00:00 2001 From: Tracy Date: Wed, 19 Feb 2020 10:20:03 -0700 Subject: [PATCH 55/85] Add UFS UPP rst documentation --- docs/Acknowledgments.rst | 27 ++ docs/BuildRunWithoutApp.rst | 7 + docs/CodeOverview.rst | 21 + docs/InputsOutputs.rst | 142 +++++++ docs/Introduction.rst | 19 + docs/Regridding.rst | 56 +++ docs/UPP_GRIB2_Table.csv | 438 --------------------- docs/UPP_GRIB2_Table.rst | 30 -- docs/UPP_Users_guide_V4.rst | 763 ------------------------------------ docs/conf.py | 17 +- docs/index.rst | 30 +- 11 files changed, 295 insertions(+), 1255 deletions(-) create mode 100644 docs/Acknowledgments.rst create mode 100644 docs/BuildRunWithoutApp.rst create mode 100644 docs/CodeOverview.rst create mode 100644 docs/InputsOutputs.rst create mode 100644 docs/Introduction.rst create mode 100644 docs/Regridding.rst delete mode 100644 docs/UPP_GRIB2_Table.csv delete mode 100644 docs/UPP_GRIB2_Table.rst delete mode 100644 docs/UPP_Users_guide_V4.rst diff --git a/docs/Acknowledgments.rst b/docs/Acknowledgments.rst new file mode 100644 index 000000000..5a08249b9 --- /dev/null +++ b/docs/Acknowledgments.rst @@ -0,0 +1,27 @@ +*************** +Acknowledgments +*************** + +The adaptation of the original WRF Post Processor package and Users +Guide (by Mike Baldwin of NSSL/CIMMS and Hui-Ya Chuang of NCEP/EMC) was +done by Lígia Bernardet (NOAA/ESRL/DTC) in collaboration with Dusan +Jovic (NCEP/EMC), Robert Rozumalski (COMET), Wesley Ebisuzaki +(NWS/HQTR), and Louisa Nance (NCAR/RAL/DTC). Upgrades to WRF Post +Processor versions 2.2 and higher were performed by Hui-Ya Chuang, Dusan +Jovic and Mathew Pyle (NCEP/EMC). Transitioning of the documentation +from the WRF Post Processor to the Unified Post Processor was performed +by Nicole McKee (NCEP/EMC), Hui-ya Chuang (NCEP/EMC), and Jamie Wolff +(NCAR/RAL/DTC). Implementation of the Community Unified Post Processor +was performed by Tricia Slovacek and Kate Fossell (NCAR/RAL/DTC). + +Acknowledgement + + +If significant help was provided via the UPP helpdesk for work resulting +in a publication, please acknowledge the Developmental Testbed Center +UPP Team. + +For referencing this document please use: + +UPP Users Guide V4, 24 pp. [available online at +https://dtcenter.org/sites/default/files/community-code/upp-users-guide-v4.pdf] diff --git a/docs/BuildRunWithoutApp.rst b/docs/BuildRunWithoutApp.rst new file mode 100644 index 000000000..81d1fbca5 --- /dev/null +++ b/docs/BuildRunWithoutApp.rst @@ -0,0 +1,7 @@ +*********************************************** +Building and Running UPP without an Application +*********************************************** + +Currently the UPP within the UFS application cannot be built as a standolone application. Please visit +the `UPP community code website `_ for +instructions on obtaining, building and running the UPP as a stand-alone application. diff --git a/docs/CodeOverview.rst b/docs/CodeOverview.rst new file mode 100644 index 000000000..a1b8fe399 --- /dev/null +++ b/docs/CodeOverview.rst @@ -0,0 +1,21 @@ +************* +Code Overview +************* + +The UPP can be used to post-process WRF-ARW, WRF-NMM, NMMB, GFS, CFS, and FV3 forecasts with current support within UFS available for FV3 only. It can ingest FV3 history files (dyn*/phy*) in netCDF and binarynemsiompiio format. + +Unipost Functionalities: + + - Interpolates the forecasts from the models native vertical + coordinate to NWS standard output levels (e.g., pressure, height) + and computes mean sea level pressure. If the requested parameter + is on a models native level, then no vertical interpolation is + performed. + + - Computes diagnostic output quantities (e.g., convective available + potential energy, helicity, relative humidity). A full list of + fields that can be generated by *unipost* is provided in + https://dtcenter.org/sites/default/files/community-code/upp-grib2-table_0.pdf. + + - Outputs the results in NWS and WMO standard GRIB2 format (for GRIB + documentation, see http://www.nco.ncep.noaa.gov/pmb/docs/). diff --git a/docs/InputsOutputs.rst b/docs/InputsOutputs.rst new file mode 100644 index 000000000..4e16c4590 --- /dev/null +++ b/docs/InputsOutputs.rst @@ -0,0 +1,142 @@ +****************** +Inputs and Outputs +****************** + +This section describes the input files used when running the UPP and the resulting output files + +=========== +Input files +=========== + +The UPP requires the following input files: + - The itag namelist + - The GRIB2 control file + - Additional data files (e.g. lookup tables, coefficient files for satellite) + +---- +ITAG +---- + +The *itag* namelist that is read in by *unipost.exe* from +stdin (unit 5) is generated automatically in the *run\_unipost* +script based on user-defined options. It should not be +necessary to edit this. For description purposes, the namelist +(*itag*) contains 7 lines for FV3: + +#. Name of the FV3 (pressure level) output file to be posted. + +#. Format of FV3 model output (netcdf, binarynemsio). + +#. Format of UPP output (GRIB2) + +#. Forecast valid time (not model start time) in FV3 format (the + forecast time desired to be post-processed). + +#. Dynamic core used (GFS). + +#. Name of the FV3 (surface) output file to be post-processed. + +#. Name of configuration file (postxconfig-NT.txt) + +------------ +Control File +------------ + +The user interacts with unipost through the control file to define what fields and levels to output. It is composed of a header and a body. The header specifies the output file information. The body includes which fields and levels to process. + +A default control file, *postxconfig-NT.txt*, is provided and read by unipost. For users wishing to customize the control file to add or remove fields and/or levels, they may do so by modyfying the postcntrl.xml and then remaking the text file required by unipost. + +The `GRIB2 Output Table `_ lists basic and derived fields currently produced by unipost +for grib2. + +Controlling which variables unipost outputs +------------------------------------------- + +To output a field, the body of the control file needs to contain an +entry for the appropriate variable. For variables found on isobaric or +height levels, the desired levels to be output must be listed (see next +section: *Controlling which levels unipost outputs*). If an entry for +a particular field is not yet available in the control file, it may be +added to the control file with the appropriate entries for that field. + +Controlling which levels unipost outputs +---------------------------------------- + +The tag in the postcntrl.xml is used to list the desired levels +for output. The following levels are currently available for output: + +- For isobaric output, 46 levels are possible, from 2 to 1000 hPa (*2, + 5, 7, 10, 20, 30, 50, 70 mb and then every 25 mb from 75 to 1000 + mb*). The complete list of levels is specified in *src/unipost/CTLBLK.f*. + + - Modify specification of variable LSMDEF to change the number of + pressure levels: LSMDEF=47 + - Modify specification of SPLDEF array to change the values of + pressure levels: (/200.,500.,700.,1000.,2000.,3000. + &,5000.,7000.,7500.,10000.,12500.,15000.,17500.,20000., …/) + +- For model-level output, all model levels are possible, from the + highest to the lowest. +- When using the Noah LSM, the soil layers are 0-10 cm, 10-40 cm, + 40-100 cm, and 100-200 cm. +- When using the RUC LSM, the soil levels are 0 cm, 1 cm, 4 cm, 10 cm, + 30 cm, 60 cm, 100 cm, 160 cm, and 300 cm. (For the old RUC LSM, + there are only 6 layers and if using this, you will need to change + “RUC LSM” from 9 to 6 in the WRFPOST.f routine.) +- When using Pliem-Xiu LSM, there are two layers: 0-1 cm, 1-100 cm +- For low, mid, and high cloud layers, the layers are :math:`\geq`\ 642 + hPa, :math:`\geq`\ 350 hPa, and <350 hPa, respectively. +- For PBL layer averages, the levels correspond to 6 layers with a + thickness of 30 hPa each. +- For flight level, the levels are 30 m, 50 m, 80 m, 100 m, 305 m, 457 + m, 610 m, 914 m, 1524 m, 1829 m, 2134 m, 2743 m, 3658 m, 4572 m, 6000 + m, 7010 m. +- For AGL radar reflectivity, the levels are 4000 and 1000 m (see + Appendix A for details). +- For surface or shelter-level output, the is not necessary. + +Creating the Flat Text File +--------------------------- + +For outputting GRIB2 format using version 4.0, a preprocessing step +is required by the user to convert the xml file +*parm/postcntrl.xml* to a flat text file +*parm/postxconfig-NT.txt*. The flat file is quicker to process +than the xml file. The user will first need to edit the +*postcntrl.xml* file to declare which fields are to be output +from UPP. + +In order to ensure that the user-edited xml files are error free, XML +stylesheets (*parm/EMC\_POST\_CTRL\_Schema.xsd* and +*EMC\_POST\_Avblflds\_Schema.xsd*) are used to validate both the +*postcntrl.xml* and *post\_avblflds.xml* files, respectively. +Confirmation of validation will be given (e.g. postcntrl.xml +validates) or otherwise return errors if it does not match the +schema. To run the validation: + + *xmllint --noout --schema EMC\_POST\_CTRL\_Schema.xsd + postcntrl.xml* + + *xmllint --noout --schema EMC\_POST\_Avblflds\_Schema.xsd + post\_avblflds.xml* + +Once the xmls are validated, the user will need to generate the flat +file. Edit the *parm/makefile* if necessary to point to the +desired flat file directory and xmls. The makefile will call the perl +program *parm/POSTXMLPreprocessor.pl* to generate the post flat +file *postxconfig-NT.txt*. Generate the flat file: + + *make* + +============ +Output Files +============ + +Upon a successful run, *unipost* will generate GRIB2 output files +*GFSPRS.hh* in the postprocessor working directory, where *hh* denotes +the forecast hour. These files will include all fields that were +requested in the control file. + +If the run did not complete successfully, a log file in the +post-processor working directory called *unipost.hh.out*, where *hh* +is the forecast hour, may be consulted for further information. diff --git a/docs/Introduction.rst b/docs/Introduction.rst new file mode 100644 index 000000000..9759f18db --- /dev/null +++ b/docs/Introduction.rst @@ -0,0 +1,19 @@ +************ +Introduction +************ + +The Unified Post Processor (UPP) software package is a software package designed to generate useful products from raw model output. The UPP is currently used in operations with the Global Forecast System (GFS), GFS Ensemble Forecast System (GEFS), North American Mesoscale (NAM), Rapid Refresh (RAP), High Resolution Rapid Refresh (HRRR), Short Range Ensemble Forecast (SREF), Hurricane WRF (HWRF) applications, and is also used in Unified Forecasting System (UFS) applications. The UPP provides the capability to compute a variety of diagnostic fields and interpolate to pressure levels or other vertical coordinates. UPP also incorporates the Joint Center for Satellite Data Assimilation (JCSDA) Community Radiative Transfer Model (CRTM) to compute model derived brightness temperature (TB) for various instruments and channels. This additional feature enables the generation of a number of simulated satellite products including GOES products. Output from the UPP is in National Weather Service (NWS) and World Meteorological Organization (WMO) GRIB2 format and can be used directly by visualization, plotting, or verification packages, or for further downstream post-processing, e.g. statistical post-processing techniques. +Examples of UPP products include: + +- T, Z, humidity, wind, cloud water, cloud ice, rain, and snow on pressure levels +- SLP, shelter level T, humidity, and wind fields +- Precipitation-related fields +- PBL-related fields +- Severe weather products (e.g. CAPE, Vorticity, Wind shear) +- Radiative/Surface fluxes +- Cloud related fields +- Aviation products +- Radar reflectivity products +- Satellite look-alike products + +Support for the UFS UPP is provided through the UFS Forum by the Developmental Testbed Center (DTC) for FV3-based applications. diff --git a/docs/Regridding.rst b/docs/Regridding.rst new file mode 100644 index 000000000..70c05bc12 --- /dev/null +++ b/docs/Regridding.rst @@ -0,0 +1,56 @@ +********** +Regridding +********** + +Users that wish to interpolate their unipost output to a different grid +may do so with the *wgrib2* utility. The general format for re-gridding +to a lat-lon grid is given in the example. + +================== +Examples of wgrib2 +================== + +*Wgrib2* is a versatile program that has the ability to convert +grib2 files from one grid to another for various user-defined grids as +well as pre-defined NCEP grids. Complete documentation with examples of +re-gridding for all available grid definitions can be found at: + +http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/new_grid.html. + +Sample command line usage for calling wgrib2: + + *wgrib2 -new\_grid\_winds W -new\_grid A B C outfile* + +Where, + + **W** = earth or grid + + earth: winds oriented to the earths north and south directions + + grid: winds are rotated so that north is relative to the grid + + **A**, **B**, and **C** represent the output grid description + + Sample lat-lon grid description: + + **A** = latlon + + **B** = lon0:nlon:dlon + + lon0 is longitude of first grid point in degrees + + nlon is number of longitudes + + dlon is grid resolution in degrees of longitude + + **C** = lat0:nlat:dlat + + lat0 is latitude of first grid point + + nlat is number of latitudes + + dlat is grid resolution in degrees of latitude + +**Note:** *wgrib2 is not distributed within the UFS weather +application. Users may download and install from +http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/.* diff --git a/docs/UPP_GRIB2_Table.csv b/docs/UPP_GRIB2_Table.csv deleted file mode 100644 index d1aceef79..000000000 --- a/docs/UPP_GRIB2_Table.csv +++ /dev/null @@ -1,438 +0,0 @@ -Radar reflectivity on model surface*,REFD_ON_HYBRID_LVL,REFD,109,250 -Pressure on model surface,PRES_ON_HYBRID_LVL,PRES,109,1 -Height on model surface,HGT_ON_HYBRID_LVL,HGT,109,77 -Temperature on model surface,TMP_ON_HYBRID_LVL,TMP,109,2 -Potential temperature on model surface,POT_ON_HYBRID_LVL,POT,109,3 -Dew point temperature on model surface,DPT_ON_HYBRID_LVL,DPT,109,4 -Specific humidity on model surface,SPFH_ON_HYBRID_LVL,SPFH,109,5 -Relative humidity on model surface,RH_ON_HYBRID_LVL,RH,109,6 -Moisture convergence on model surface,MCONV_ON_HYBRID_LVL,MCONV,109,83 -U component wind on model surface,UGRD_ON_HYBRID_LVL,UGRD,109,7 -V component wind on model surface,VGRD_ON_HYBRID_LVL,VGRD,109,8 -Cloud water on model surface,CLWMR_ON_HYBRID_LVL,CLWMR,109,124 -Cloud ice on model surface,CICE_ON_HYBRID_LVL,CICE,109,125 -Rain on model surface,RWMR_ON_HYBRID_LVL,RWMR,109,181 -Snow on model surface,SNMR_ON_HYBRID_LVL,SNMR,109,182 -Cloud fraction on model surface,TCDC_ON_HYBRID_LVL,TCDC,109,145 -Omega on model surface,VVEL_ON_HYBRID_LVL,VVEL,109,9 -Absolute vorticity on model surface,ABSV_ON_HYBRID_LVL,ABSV,109,10 -Geostrophic streamfunction on model surface,STRM_ON_HYBRID_LVL,STRM,109,84 -Turbulent kinetic energy on model surface,TKE_ON_HYBRID_LVL,TKE,109,11 -Richardson number on model surface,RI_ON_HYBRID_LVL,RI,109,111 -Master length scale on model surface,BMIXL_ON_HYBRID_LVL,BMIXL,109,146 -Asymptotic length scale on model surface,AMIXL_ON_HYBRID_LVL,AMIXL,109,147 -Radar reflectivity on pressure surface*,REFD_ON_ISOBARIC_SFC,REFD,100,251 -Height on pressure surface,HGT_ON_ISOBARIC_SFC,HGT,100,12 -Temperature on pressure surface,TMP_ON_ISOBARIC_SFC,TMP,100,13 -Potential temperature on pressure surface,POT_ON_ISOBARIC_SFC,POT,100,14 -Dew point temperature on pressure surface,DPT_ON_ISOBARIC_SFC,DPT,100,15 -Specific humidity on pressure surface,SPFH_ON_ISOBARIC_SFC,SPFH,100,16 -Relative humidity on pressure surface,RH_ON_ISOBARIC_SFC,RH,100,17 -Moisture convergence on pressure surface,MCONV_ON_ISOBARIC_SFC,MCONV,100,85 -U component wind on pressure surface,UGRD_ON_ISOBARIC_SFC,UGRD,100,18 -V component wind on pressure surface,VGRD_ON_ISOBARIC_SFC,VGRD,100,19 -Omega on pressure surface,VVEL_ON_ISOBARIC_SFC,VVEL,100,20 -Absolute vorticity on pressure surface,ABSV_ON_ISOBARIC_SFC,ABSV,100,21 -Geostrophic streamfunction on pressure surface,STRM_ON_ISOBARIC_SFC,STRM,100,86 -Turbulent kinetic energy on pressure surface,TKE_ON_ISOBARIC_SFC,TKE,100,22 -Cloud water on pressure surface,CLWMR_ON_ISOBARIC_SFC,CLWMR,100,153 -Cloud ice on pressure surface,CICE_ON_ISOBARIC_SFC,CICE,100,166 -Rain on pressure surface,RWMR_ON_ISOBARIC_SFC,RWMR,100,183 -Snow water on pressure surface,SNMR_ON_ISOBARIC_SFC,SNMR,100,184 -Total condensate on pressure surface,TCOND_ON_ISOBARIC_SFC,TCOND,100,198 -Mesinger (Membrane) sea level pressure,MSLET_ON_MEAN_SEA_LVL,MSLET,102,23 -Shuell sea level pressure,PRES_ON_MEAN_SEA_LVL,PRMSL,102,105 -2 M pressure,PRES_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,PRES,105,138 -2 M temperature,TMP_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,TMP,105,106 -2 M specific humidity,SPFH_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,SPFH,105,112 -2 M mixing ratio,Not currently available for grib2,NA,105,414 -2 M dew point temperature,DPT_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,DPT,105,113 -2 M RH,RH_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,RH,105,114 -10 M u component wind,UGRD_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,UGRD,105,64 -10 M v component wind,VGRD_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,VGRD,105,65 -10 M potential temperature,POT_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,POT,105,158 -10 M specific humidity,SPFH_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,SPFH,105,159 -Surface pressure,PRES_ON_SURFACE,PRES,1,24 -Terrain height,HGT_ON_SURFACE,HGT,1,25 -Skin potential temperature,POT_ON_SURFACE,POT,1,27 -Skin specific humidity,SPFH_ON_SURFACE,SPFH,1,28 -Skin dew point temperature,DPT_ON_SURFACE,DPT,1,29 -Skin Relative humidity,RH_ON_SURFACE,RH,1,76 -Skin temperature,TMP_ON_SURFACE,TMP,1,26 -Soil temperature at the bottom of soil layers,TSOIL_ON_DEPTH_BEL_LAND_SFC_3m,TSOIL,111,115/571 -Soil temperature in between each of soil layers,TSOIL_ON_DEPTH_BEL_LAND_SFC,TSOIL,112,116 -Soil moisture in between each of soil layers,SOILW_ON_DEPTH_BEL_LAND_SFC,SOILW,112,117 -Snow water equivalent,WEASD_ON_SURFACE,WEASD,1,119 -Snow cover in percentage,SNOWC_ON_SURFACE,SNOWC,1,120 -Heat exchange coeff at surface,SFEXC_ON_SURFACE,SFEXC,1,169 -Vegetation cover,VEG_ON_SURFACE,VEG,1,170 -Soil moisture availability,MSTAV_ON_DEPTH_BEL_LAND_SFC,MSTAV,112,171 -Ground heat flux - instantaneous,INST_GFLUX_ON_SURFACE,GFLUX,1,152 -Lifted index—surface based,LFTX_ON_ISOBARIC_SFC_500-1000hpa,LFTX,101,30 -Lifted index—best,4LFTX_ON_SPEC_PRES_ABOVE_GRND,4LFTX,116,31 -Lifted index—from boundary layer,PLI_ON_SPEC_PRES_ABOVE_GRND,PLI,116,75 -CAPE (4 types) ***,CAPE_ON_SURFACE,CAPE,1,32 -CIN (4 types) ***,CIN_ON_SURFACE,CIN,1,107 -Column integrated precipitable water,PWAT_ON_ENTIRE_ATMOS_SINGLE_LYR,PWAT,200,80 -Column integrated cloud water,TCOLW_ON_ENTIRE_ATMOS,TCOLW,200,200 -Column integrated cloud ice,TCOLI_ON_ENTIRE_ATMOS,TCOLI,200,201 -Column integrated rain,TCOLR_ON_ENTIRE_ATMOS,TCOLR,200,202 -Column integrated snow,TCOLS_ON_ENTIRE_ATMOS,TCOLS,200,203 -Column integrated total condensate,TCOLC_ON_ENTIRE_ATMOS,TCOLC,200,204 -Column integrated cloud water,CWAT_ON_ENTIRE_ATMOS_SINGLE_LYR,CWAT,200,575 -Helicity,HLCY_ON_SPEC_HGT_LVL_ABOVE_GRND,HLCY,106,162 -U component storm motion,USTM_ON_SPEC_HGT_LVL_ABOVE_GRND,USTM,106,163 -V component storm motion,VSTM_ON_SPEC_HGT_LVL_ABOVE_GRND,VSTM,106,164 -Accumulated total precipitation,ACM_APCP_ON_SURFACE,APCP,1,87 -Accumulated convective precipitation,ACM_ACPCP_ON_SURFACE,ACPCP,1,33 -Accumulated grid-scale precipitation,ACM_NCPCP_ON_SURFACE,NCPCP,1,34 -Accumulated snowfall,ACM_WEASD_ON_SURFACE,WEASD,1,35 -Accumulated large scale snow,Not currently available for grib2,NA,1,244 -Accumulated total snow melt,ACM_SNOM_ON_SURFACE,SNOM,1,121 -Precipitation type (4 types) – instantaneous,INST_CRAIN_ON_SURFACE,CRAIN,1,160 -Precipitation rate - instantaneous,INST_PRATE_ON_SURFACE,PRATE,1,167 -Composite radar reflectivity*,REFC_ON_ENTIRE_ATMOS,REFC,200,252 -Low level cloud fraction,LCDC_ON_LOW_CLOUD_LYR,LCDC,214,37 -Mid level cloud fraction,MCDC_ON_MID_CLOUD_LYR,MCDC,224,38 -High level cloud fraction,HCDC_ON_HIGH_CLOUD_LYR,HCDC,234,39 -Total cloud fraction,INST_TCDC_ON_ENTIRE_ATMOS,TCDC,200,161 -Time-averaged total cloud fraction,AVE_TCDC_ON_ENTIRE_ATMOS,TCDC,200,144 -Time-averaged stratospheric cloud fraction,AVE_CDLYR_ON_ENTIRE_ATMOS,CDLYR,200,139 -Time-averaged convective cloud fraction,AVE_CDCON_ON_ENTIRE_ATMOS,CDCON,200,143 -Cloud bottom pressure,PRES_ON_CLOUD_BASE,PRES,2,148 -Cloud top pressure,PRES_ON_CLOUD_TOP,PRES,3,149 -Cloud bottom height (above MSL),HGT_ON_CLOUD_BASE,HGT,2,178 -Cloud top height (above MSL),HGT_ON_CLOUD_TOP,HGT,3,179 -Convective cloud bottom pressure,PRES_ON_CONVECTIVE_CLOUD_BOT_LVL,PRES,242,188 -Convective cloud top pressure,PRES_ON_CONVECTIVE_CLOUD_TOP_LVL,PRES,243,189 -Shallow convective cloud bottom pressure,PRES_ON_SHALL_CONVECTIVE_CLOUD_BOT_LVL,PRES,248,190 -Shallow convective cloud top pressure,PRES_ON_SHALL_CONVECTIVE_CLOUD_TOP_LVL,PRES,249,191 -Deep convective cloud bottom pressure,PRES_ON_DEEP_CONVECTIVE_CLOUD_BOT_LVL,PRES,251,192 -Deep convective cloud top pressure,PRES_ON_DEEP_CONVECTIVE_CLOUD_TOP_LVL,PRES,252,193 -Grid scale cloud bottom pressure,PRES_ON_GRID_SCALE_CLOUD_BOT_LVL,PRES,206,194 -Grid scale cloud top pressure,PRES_ON_GRID_SCALE_CLOUD_TOP_LVL,PRES,207,195 -Convective cloud fraction,CDCON_ON_ENTIRE_ATMOS,CDCON,200,196 -Convective cloud efficiency,CUEFI_ON_ENTIRE_ATMOS_SINGLE_LYR,CUEFI,200,197 -Above-ground height of LCL,HGT_ON_LVL_OF_ADIAB_COND_FROM_SFC,HGT,5,109 -Pressure of LCL,PRES_ON_LVL_OF_ADIAB_COND_FROM_SFC,PRES,5,110 -Cloud top temperature,TMP_ON_CLOUD_TOP,TMP,3,168 -Temperature tendency from radiative fluxes,TTRAD_ON_HYBRID_LVL,TTRAD,109,140 -Temperature tendency from shortwave radiative flux,SWHR_ON_HYBRID_LVL,SWHR,109,40 -Temperature tendency from longwave radiative flux,LWHR_ON_HYBRID_LVL,LWHR,109,41 -Outgoing surface shortwave radiation - instantaneous,INST_USWRF_ON_SURFACE,USWRF,1,141 -Outgoing surface longwave radiation - instantaneous,INST_ULWRF_ON_SURFACE,ULWRF,1,142 -Incoming surface shortwave radiation - time-averaged,AVE_DSWRF_ON_SURFACE,DSWRF,1,126 -Incoming surface longwave radiation - time-averaged,AVE_DLWRF_ON_SURFACE,DLWRF,1,127 -Outgoing surface shortwave radiation - time-averaged,AVE_USWRF_ON_SURFACE,USWRF,1,128 -Outgoing surface longwave radiation - time-averaged,AVE_ULWRF_ON_SURFACE,ULWRF,1,129 -Outgoing model top shortwave radiation - time-averaged,AVE_USWRF_ON_TOP_OF_ATMOS,USWRF,8,130 -Outgoing model top longwave radiation - time-averaged,AVE_ULWRF_ON_TOP_OF_ATMOS,ULWRF,8,131 -Incoming surface shortwave radiation - instantaneous,INST_DSWRF_ON_SURFACE,DSWRF,1,156 -Incoming surface longwave radiation - instantaneous,INST_DLWRF_ON_SURFACE,DLWRF,1,157 -Roughness length,SFCR_ON_SURFACE,SFCR,1,44 -Friction velocity,FRICV_ON_SURFACE,FRICV,1,45 -Surface drag coefficient,CD_ON_SURFACE,CD,1,132 -Surface u wind stress,UFLX_ON_SURFACE,UFLX,1,133 -Surface v wind stress,VFLX_ON_SURFACE,VFLX,1,134 -Surface sensible heat flux - time-averaged,AVE_SHTFL_ON_SURFACE,SHTFL,1,43 -Ground heat flux - time-averaged,AVE_GFLUX_ON_SURFACE,GFLUX,1,135 -Surface latent heat flux - time-averaged,AVE_LHTFL_ON_SURFACE,LHTFL,1,42 -Surface momentum flux - time-averaged,AVE_MFLX_ON_SURFACE,MFLX,1,46 -Accumulated surface evaporation,ACM_EVP_ON_SURFACE,EVP,1,47 -Surface sensible heat flux – instantaneous,INST_SHTFL_ON_SURFACE,SHTFL,1,154 -Surface latent heat flux - instantaneous,INST_LHTFL_ON_SURFACE,LHTFL,1,155 -Latitude,NLAT_ON_SURFACE,NLAT,1,48 -Longitude,ELON_ON_SURFACE,ELON,1,49 -Land sea mask (land=1 sea=0),LAND_ON_SURFACE,LAND,1,50 -Sea ice mask,ICEC_ON_SURFACE,ICEC,1,51 -Surface midday albedo,ALBDO_ON_SURFACE,ALBDO,1,150 -Sea surface temperature,WTMP_ON_SURFACE,WTMP,1,151 -Press at tropopause,PRES_ON_TROPOPAUSE,PRES,7,54 -Temperature at tropopause,TMP_ON_TROPOPAUSE,TMP,7,55 -Potential temperature at tropopause,POT_ON_TROPOPAUSE,POT,7,108 -U wind at tropopause,UGRD_ON_TROPOPAUSE,UGRD,7,56 -V wind at tropopause,VGRD_ON_TROPOPAUSE,VGRD,7,57 -Wind shear at tropopause,VWSH_ON_TROPOPAUSE,VWSH,7,58 -Height at tropopause,HGT_ON_TROPOPAUSE,HGT,7,177 -Temperature at flight levels,TMP_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,TMP,103,59 -U wind at flight levels,UGRD_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,UGRD,103,60 -V wind at flight levels,VGRD_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,VGRD,103,61 -Freezing level height (above mean sea level),HGT_ON_0C_ISOTHERM,HGT,4,62 -Freezing level RH,RH_ON_0C_ISOTHERM,RH,4,63 -Highest freezing level height,HGT_ON_HGHST_TROP_FRZ_LVL,HGT,204,165 -Pressure in boundary layer (30 mb mean),PRES_ON_SPEC_PRES_ABOVE_GRND,PRES,116,67 -Temperature in boundary layer (30 mb mean),TMP_ON_SPEC_PRES_ABOVE_GRND,TMP,116,68 -Potential temperature in boundary layers (30 mb mean),POT_ON_SPEC_PRES_ABOVE_GRND,POT,116,69 -Dew point temperature in boundary layer (30 mb mean),DPT_ON_SPEC_PRES_ABOVE_GRND,DPT,116,70 -Specific humidity in boundary layer (30 mb mean),SPFH_ON_SPEC_PRES_ABOVE_GRND,SPFH,116,71 -RH in boundary layer (30 mb mean),RH_ON_SPEC_PRES_ABOVE_GRND,RH,116,72 -Moisture convergence in boundary layer (30 mb mean),MCONV_ON_SPEC_PRES_ABOVE_GRND,MCONV,116,88 -Precipitable water in boundary layer (30 mb mean),PWAT_ON_SPEC_PRES_ABOVE_GRND,PWAT,116,89 -U wind in boundary layer (30 mb mean),UGRD_ON_SPEC_PRES_ABOVE_GRND,UGRD,116,73 -V wind in boundary layer (30 mb mean),VGRD_ON_SPEC_PRES_ABOVE_GRND,VGRD,116,74 -Omega in boundary layer (30 mb mean),VVEL_ON_SPEC_PRES_ABOVE_GRND,VVEL,116,90 -Visibility,VIS_ON_SURFACE,VIS,1,180 -Vegetation type,VGTYP_ON_SURFACE,VGTYP,1,218 -Soil type,SOTYP_ON_SURFACE,SOTYP,1,219 -Canopy conductance,CCOND_ON_SURFACE,CCOND,1,220 -PBL height,HPBL_ON_SURFACE,HPBL,1,221 -Slope type,SLTYP_ON_SURFACE,SLTYP,1,223 -Snow depth,SNOD_ON_SURFACE,SNOD,1,224 -Liquid soil moisture,SOILL_ON_DEPTH_BEL_LAND_SFC,SOILL,112,225 -Snow free albedo,SNFALB_ON_SURFACE,SNFALB,1,226 -Maximum snow albedo,MXSALB_ON_SURFACE,MXSALB,1,227 -Canopy water evaporation,EVCW_ON_SURFACE,EVCW,1,228 -Direct soil evaporation,EVBS_ON_SURFACE,EVBS,1,229 -Plant transpiration,TRANS_ON_SURFACE,TRANS,1,230 -Snow sublimation,SBSNO_ON_SURFACE,SBSNO,1,231 -Air dry soil moisture,SMDRY_ON_SURFACE,SMDRY,1,232 -Soil moist porosity,POROS_ON_SURFACE,POROS,1,233 -Minimum stomatal resistance,RSMIN_ON_SURFACE,RSMIN,1,234 -Number of root layers,RLYRS_ON_SURFACE,RLYRS,1,235 -Soil moist wilting point,WILT_ON_SURFACE,WILT,1,236 -Soil moist reference,SMREF_ON_SURFACE,SMREF,1,237 -Canopy conductance - solar component,RCS_ON_SURFACE,RCS,1,238 -Canopy conductance - temperature component,RCT_ON_SURFACE,RCT,1,239 -Canopy conductance - humidity component,RCQ_ON_SURFACE,RCQ,1,240 -Canopy conductance - soil component,RCSOL_ON_SURFACE,RCSOL,1,241 -Potential evaporation,PEVPR_ON_SURFACE,PEVPR,1,242 -Heat diffusivity on sigma surface,VEDH_ON_SIGMA_LVLS,VEDH,107,243 -Surface wind gust,GUST_ON_SURFACE,GUST,1,245 -Convective precipitation rate,CPRAT_ON_SURFACE,CPRAT,1,249 -Radar reflectivity at certain above ground heights*,REFD_ON_SPEC_HGT_LVL_ABOVE_GRND,REFD,105,253 -MAPS Sea Level Pressure,MAPS_PRMSL_ON_MEAN_SEA_LVL,PRMSL,102,445 -Total soil moisture,SOILM_ON_DEPTH_BEL_LAND_SFC,SOILM,112,36 -Plant canopy surface water,CNWAT_ON_SURFACE,CNWAT,1,118 -Accumulated storm surface runoff,ACM_SSRUN_ON_SURFACE,SSRUN,1,122 -Accumulated baseflow runoff,ACM_BGRUN_ON_SURFACE,BGRUN,1,123 -Fraction of frozen precipitation,CPOFP_ON_SURFACE,CPOFP,1,172 -GSD Cloud Base pressure,Not currently available for grib2,NA,2,787 -GSD Cloud Top pressure,GSD_PRES_ON_CLOUD_TOP,PRES,3,406 -Averaged temperature tendency from grid scale latent heat release,AVE_LRGHR_ON_HYBRID_LVL,LRGHR,109,78 -Averaged temperature tendency from convective latent heat release,AVE_CNVHR_ON_HYBRID_LVL,CNVHR,109,79 -Average snow phase change heat flux,AVE_SNOHF_ON_SURFACE,SNOHF,1,136 -Accumulated potential evaporation,ACM_PEVAP_ON_SURFACE,PEVAP,1,137 -Highest freezing level relative humidity,RH_ON_HGHST_TROP_FRZ_LVL,RH,204,350 -Maximum wind pressure level,PRES_ON_MAX_WIND,PRES,6,173 -Maximum wind height,HGT_ON_MAX_WIND,HGT,6,174 -U-component of maximum wind,UGRD_ON_MAX_WIND,UGRD,6,175 -V-component of maximum wind,VGRD_ON_MAX_WIND,VGRD,6,176 -GSD cloud base height,GSD_HGT_ON_CLOUD_BASE,HGT,2,408 -GSD cloud top height,GSD_HGT_ON_CLOUD_TOP,HGT,3,409 -GSD visibility,GSD_VIS_ON_CLOUD_TOP,VIS,3,410 -Wind energy potential,WMIXE_ON_SPEC_HGT_LVL_ABOVE_GRND,WMIXE,105,411 -U wind at 80 m above ground,UGRD_ON_SPEC_HGT_LVL_ABOVE_GRND,UGRD,105,412 -V wind at 80 m above ground,VGRD_ON_SPEC_HGT_LVL_ABOVE_GRND,VGRD,105,413 -Graupel on model surface,GRMR_ON_HYBRID_LVL,GRMR,109,415 -Graupel on pressure surface,GRMR_ON_ISOBARIC_SFC,GRMR,100,416 -Maximum updraft helicity,MAX_UPHL_ON_SPEC_HGT_LVL_ABOVE_GRND_2-5km,MXUPHL,106,420 -Maximum 1km reflectivity,MAX_REF_ON_SPEC_HGT_LVL_ABOVE_GRND_1km,MAXREF,105,421 -Maximum wind speed at 10m,MAX_WIND_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,WIND,105,422 -Maximum updraft vertical velocity,MAX_MAXUVV_ON_ISOBARIC_SFC_40-100hpa,MAXUVV,106,423 -Maximum downdraft vertical velocity,MAX_MAXDVV_ON_ISOBARIC_SFC_40-100hpa,MAXDVV,106,424 -Mean vertical velocity,AVE_DZDT_ON_SIGMA_LVL_0.5-0.8,DZDT,108,425 -Radar echo top in KDT,HGT_ON_SPEC_HGT_LVL_ABOVE_GRND,HGT,105,426 -Updraft helicity,UPHL_ON_SPEC_HGT_LVL_ABOVE_GRND_2-5km,MXUPHL,106,427 -Column integrated graupel,GRMR_ON_ENTIRE_ATMOS_SINGLE_LYR,GRMR,200,428 -Column integrated maximum graupel,MAXVIG_ON_ENTIRE_ATMOS_SINGLE_LYR,TCOLG,200,429 -U-component of 0-1km level wind shear,VUCSH_ON_SPEC_HGT_LVL_ABOVE_GRND_0-1km,VUCSH,106,430 -V-component of 0-1km level wind shear,VVCSH_ON_SPEC_HGT_LVL_ABOVE_GRND_0-1km,VVCSH,106,431 -U-component of 0-6km level wind shear,VUCSH_ON_SPEC_HGT_LVL_ABOVE_GRND_0-6km,VUCSH,106,432 -V-component of 0-6km level wind shear,VVCSH_ON_SPEC_HGT_LVL_ABOVE_GRND_0-6km,VVCSH,106,433 -Total precipitation accumulated over user-specified bucket,BUCKET_APCP_ON_SURFACE,APCP,1,434 -Convective precipitation accumulated over user-specified bucket,BUCKET_ACPCP_ON_SURFACE,ACPCP,1,435 -Grid-scale precipitation accumulated over user-specified bucket,BUCKET_NCPCP_ON_SURFACE,NCPCP,1,436 -Snow accumulated over user-specified bucket,BUCKET_WEASD_ON_SURFACE,WEASD,1,437 -Model level fraction of rain for Ferrier scheme,FRAIN_ON_HYBRID_LVL,FRAIN,109,185 -Model level fraction of ice for Ferrier scheme,FICE_ON_HYBRID_LVL,FICE,109,186 -Model level riming factor for Ferrier scheme,RIME_ON_HYBRID_LVL,RIME,109,187 -Model level total condensate for Ferrier scheme,TCOND_ON_HYBRID_LVL,TCOND,109,199 -Height of sigma surface,HGT_ON_SIGMA_LVLS,HGT,107,205 -Temperature on sigma surface,TMP_ON_SIGMA_LVLS,TMP,107,206 -Specific humidity on sigma surface,SPFH_ON_SIGMA_LVLS,SPFH,107,207 -U-wind on sigma surface,UGRD_ON_SIGMA_LVLS,UGRD,107,208 -V-wind on sigma surface,VGRD_ON_SIGMA_LVLS,VGRD,107,209 -Omega on sigma surface,VVEL_ON_SIGMA_LVLS,VVEL,107,210 -Cloud water on sigma surface,CLWMR_ON_SIGMA_LVLS,CLWMR,107,211 -Cloud ice on sigma surface,CICE_ON_SIGMA_LVLS,CICE,107,212 -Rain on sigma surface,RWMR_ON_SIGMA_LVLS,RWMR,107,213 -Snow on sigma surface,SNMR_ON_SIGMA_LVLS,SNMR,107,214 -Condensate on sigma surface,TCOND_ON_SIGMA_LVLS,TCOND,107,215 -Pressure on sigma surface,PRES_ON_SIGMA_LVLS,PRES,107,216 -Turbulent kinetic energy on sigma surface,TKE_ON_SIGMA_LVLS,TKE,107,217 -Cloud fraction on sigma surface,TCDC_ON_SIGMA_LVLS,TCDC,107,222 -Graupel on sigma surface,GRLE_ON_SIGMA_LVLS,GRLE,107,255 -LCL level pressure,PLPL_ON_SPEC_PRES_ABOVE_GRND,PLPL,116,246 -LOWEST WET BULB ZERO HEIGHT,HGT_ON_LWST_LVL_OF_WET_BULB_ZERO,HGT,245,247 -Leaf area index,LAI_ON_SURFACE,LAI,1,254 -Accumulated land surface model precipitation,ACM_LSPA_ON_SURFACE,LSPA,1,256 -In-flight icing,TIPD_ON_ISOBARIC_SFC,TIPD,100,257 -Clear air turbulence,TPFI_ON_ISOBARIC_SFC,TPFI,100,258 -Wind shear between shelter level and 2000 FT,VWSH_ON_SPEC_HGT_LVL_ABOVE_GRND,VWSH,106,259 -Ceiling,HGT_ON_CLOUD_CEILING,HGT,215,260 -Flight restriction,VIS_ON_CLOUD_BASE,VIS,2,261 -Instantaneous clear sky incoming surface shortwave,INST_CSDSF_ON_SURFACE,CSDSF,1,262 -Pressure level riming factor for Ferrier scheme,RIME_ON_ISOBARIC_SFC,RIME,100,263 -Model level vertical velocity,DZDT_ON_HYBRID_LVL,DZDT,109,264 -Brightness temperature,SBT122_ON_TOP_OF_ATMOS_FROM_LWRAD,SBT122,8,265 -Average albedo,AVE_ALBDO_ON_SURFACE,ALBDO,1,266 -Ozone on model surface,O3MR_ON_HYBRID_LVL,O3MR,109,267 -Ozone on pressure surface,O3MR_ON_ISOBARIC_SFC,O3MR,100,268 -Surface zonal momentum flux,AVE_UFLX_ON_SURFACE,UFLX,1,269 -Surface meridional momentum flux,AVE_VFLX_ON_SURFACE,VFLX,1,270 -Average precipitation rate,AVE_PRATE_ON_SURFACE,PRATE,1,271 -Average convective precipitation rate,AVE_CPRAT_ON_SURFACE,CPRAT,1,272 -Instantaneous outgoing longwave at top of atmosphere,INST_ULWRF_ON_TOP_OF_ATMOS,ULWRF,8,274 -Total spectrum brightness temperature,BRTMP_ON_TOP_OF_ATMOS,BRTMP,8,275 -Model top pressure,PRES_ON_TOP_OF_ATMOS,PRES,8,282 -Composite rain radar reflectivity,REFZR_ON_ENTIRE_ATMOS,REFZR,200,276 -Composite ice radar reflectivity,REFZI_ON_ENTIRE_ATMOS,REFZI,200,277 -Composite radar reflectivity from convection,REFZC_ON_ENTIRE_ATMOS,REFZC,200,278 -Rain radar reflecting angle,REFZR_ON_SPEC_HGT_LVL_ABOVE_GRND,REFZR,105,279 -Ice radar reflecting angle,REFZI_ON_SPEC_HGT_LVL_ABOVE_GRND,REFZI,105,280 -Convection radar reflecting angle,REFZC_ON_SPEC_HGT_LVL_ABOVE_GRND,REFZC,105,281 -Model level vertical velocity,DZDT_ON_ISOBARIC_SFC,DZDT,100,284 -Column integrated super cool liquid water,TCLSW_ON_ENTIRE_ATMOS,TCLSW,200,285 -Column integrated melting ice,TCOLM_ON_ENTIRE_ATMOS,TCOLM,200,286 -Height of lowest level super cool liquid water,HGT_ON_LWST_BOT_LVL_OF_SUPERCOOLED_LIQ_WATER_LYR,HGT,253,287 -Height of highest level super cool liquid water,HGT_ON_HGHST_TOP_LVL_OF_SUPERCOOLED_LIQ_WATER_LYR,HGT,254,288 -Richardson number planetary boundary layer height,HGT_ON_PLANETARY_BOUND_LYR,HGT,220,289 -Total column shortwave temperature tendency,SWHR_ON_ENTIRE_ATMOS,SWHR,200,290 -Total column longwave temperature tendency,LWHR_ON_ENTIRE_ATMOS,LWHR,200,291 -Total column gridded temperature tendency,AVE_LRGHR_ON_ENTIRE_ATMOS,LRGHR,200,292 -Total column convective temperature tendency,AVE_CNVHR_ON_ENTIRE_ATMOS,CNVHR,200,293 -Radiative flux temperature tendency on pressure level,TTRAD_ON_ISOBARIC_SFC,TTRAD,100,294 -Column integrated moisture convergence,MCONV_ON_ENTIRE_ATMOS,MCONV,200,295 -Time averaged clear sky incoming UV-B shortwave,AVE_CDUVB_ON_SURFACE,CDUVB,1,297 -Time averaged incoming UV-B shortwave,AVE_DUVB_ON_SURFACE,DUVB,1,298 -Total column ozone,TOZNE_ON_ENTIRE_ATMOS_SINGLE_LYR,TOZNE,200,299 -Average low cloud fraction,AVE_TCDC_ON_LOW_CLOUD_LYR,TCDC,214,300 -Average mid cloud fraction,AVE_TCDC_ON_MID_CLOUD_LYR,TCDC,224,301 -Average high cloud fraction,AVE_TCDC_ON_HIGH_CLOUD_LYR,TCDC,234,302 -Average low cloud bottom pressure,AVE_PRES_ON_LOW_CLOUD_BOT_LVL,PRES,212,303 -Average low cloud top pressure,AVE_PRES_ON_LOW_CLOUD_TOP_LVL,PRES,213,304 -Average low cloud top temperature,AVE_TMP_ON_LOW_CLOUD_TOP_LVL,TMP,213,305 -Average mid cloud bottom pressure,AVE_PRES_ON_MID_CLOUD_BOT_LVL,PRES,222,306 -Average mid cloud top pressure,AVE_PRES_ON_MID_CLOUD_TOP_LVL,PRES,223,307 -Average mid cloud top temperature,AVE_TMP_ON_MID_CLOUD_TOP_LVL,TMP,223,308 -Average high cloud bottom pressure,AVE_PRES_ON_HIGH_CLOUD_BOT_LVL,PRES,232,309 -Average high cloud top pressure,AVE_PRES_ON_HIGH_CLOUD_TOP_LVL,PRES,233,310 -Average high cloud top temperature,AVE_TMP_ON_HIGH_CLOUD_TOP_LVL,TMP,233,311 -Total column relative humidity,RH_ON_ENTIRE_ATMOS_SINGLE_LYR,RH,200,312 -Cloud work function,AVE_CWORK_ON_ENTIRE_ATMOS_SINGLE_LYR,CWORK,200,313 -Temperature at maximum wind level,TMP_ON_MAX_WIND,TMP,6,314 -Time averaged zonal gravity wave stress,AVE_U-GWD_ON_SURFACE,U-GWD,1,315 -Time averaged meridional gravity wave stress,AVE_V-GWD_ON_SURFACE,V-GWD,1,316 -Average precipitation type,AVE_CRAIN_ON_SURFACE,CRAIN,1,317 -Simulated GOES 12 channel 2 brightness temperature,SBT122_ON_TOP_OF_ATMOS,SBT122,8,327 -Simulated GOES 12 channel 3 brightness temperature,SBT123_ON_TOP_OF_ATMOS,SBT123,8,328 -Simulated GOES 12 channel 4 brightness temperature,SBT124_ON_TOP_OF_ATMOS,SBT124,8,329 -Simulated GOES 12 channel 5 brightness temperature,SBT126_ON_TOP_OF_ATMOS,SBT126,8,330 -Cloud fraction on pressure surface,TCDC_ON_ISOBARIC_SFC,TCDC,100,331 -U-wind on theta surface,UGRD_ON_ISENTROPIC_LVL,UGRD,113,332 -V-wind on theta surface,VGRD_ON_ISENTROPIC_LVL,VGRD,113,333 -Temperature on theta surface,TMP_ON_ISENTROPIC_LVL,TMP,113,334 -Potential vorticity on theta surface,PVORT_ON_ISENTROPIC_LVL,PVORT,113,335 -Montgomery streamfunction on theta surface,MNTSF_ON_ISENTROPIC_LVL,MNTSF,113,353 -Relative humidity on theta surface,RH_ON_ISENTROPIC_LVL,RH,113,352 -U wind on constant PV surface,UGRD_ON_POT_VORT_SFC,UGRD,117,336 -V wind on constant PV surface,VGRD_ON_POT_VORT_SFC,VGRD,117,337 -Temperature on constant PV surface,TMP_ON_POT_VORT_SFC,TMP,117,338 -Height on constant PV surface,HGT_ON_POT_VORT_SFC,HGT,117,339 -Pressure on constant PV surface,PRES_ON_POT_VORT_SFC,PRES,117,340 -Wind shear on constant PV surface,VWSH_ON_POT_VORT_SFC,VWSH,117,341 -Planetary boundary layer cloud fraction,AVE_TCDC_ON_BOUND_LYR_CLOUD_LYR,TCDC,211,342 -Average water runoff,ACM_WATR_ON_SURFACE,WATR,1,343 -Planetary boundary layer regime,PBLREG_ON_SURFACE,PBLREG,1,344 -Maximum 2m temperature,MAX_TMAX_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,TMAX,105,345 -Minimum 2m temperature,MIN_TMIN_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,TMIN,105,346 -Maximum 2m RH,MAX_MAXRH_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,MAXRH,105,347 -Minimum 2m RH,MIN_MINRH_ON_SPEC_HGT_LVL_ABOVE_GRND_2m,MINRH,105,348 -Ice thickness,ICETK_ON_SURFACE,ICETK,1,349 -Shortwave tendency on pressure surface,SWHR_ON_ISOBARIC_SFC,SWHR,100,354 -Longwave tendency on pressure surface,LWHR_ON_ISOBARIC_SFC,LWHR,100,355 -Deep convective tendency on pressure surface,CNVHR_ON_ISOBARIC_SFC,CNVHR,100,357 -Shallow convective tendency on pressure surface,SHAHR_ON_ISOBARIC_SFC,SHAHR,100,358 -Grid scale tendency on pressure surface,LRGHR_ON_ISOBARIC_SFC,LRGHR,100,359 -Deep convective moisture on pressure surface,CNVMR_ON_ISOBARIC_SFC,CNVMR,100,361 -Shallow convective moisture on pressure surface,SHAMR_ON_ISOBARIC_SFC,SHAMR,100,362 -Ozone tendency on pressure surface,TOZ_ON_ISOBARIC_SFC,TOZ,100,366 -Mass weighted potential vorticity,PVMW_ON_ISOBARIC_SFC,PVMW,100,367 -Simulated GOES 12 channel 3 brightness count,SBC123_ON_TOP_OF_ATMOS,SBC123,8,376 -Simulated GOES 12 channel 4 brightness count,SBC124_ON_TOP_OF_ATMOS,SBC124,8,377 -Omega on theta surface,VVEL_ON_ISENTROPIC_LVL,VVEL,113,378 -Mixing height,MIXHT_ON_SURFACE,MIXHT,1,381 -Average clear-sky incoming longwave at surface,AVE_CSDLF_ON_SURFACE,CSDLF,1,382 -Average clear-sky incoming shortwave at surface,AVE_CSDSF_ON_SURFACE,CSDSF,1,383 -Average clear-sky outgoing longwave at surface,AVE_CSULF_ON_SURFACE,CSULF,1,384 -Average clear-sky outgoing longwave at top of atmosphere,AVE_CSULF_ON_TOP_OF_ATMOS,CSULF,8,385 -Average clear-sky outgoing shortwave at surface,AVE_CSUSF_ON_SURFACE,CSUSF,1,386 -Average clear-sky outgoing shortwave at top of atmosphere,AVE_CSUSF_ON_TOP_OF_ATMOS,CSUSF,8,387 -Average incoming shortwave at top of atmosphere,AVE_DSWRF_ON_TOP_OF_ATMOS,DSWRF,8,388 -Transport wind u component,UGRD_ON_PLANETARY_BOUND_LYR,UGRD,220,389 -Transport wind v component,VGRD_ON_PLANETARY_BOUND_LYR,VGRD,220,390 -Sunshine duration,SUNSD_ON_SURFACE,SUNSD,1,396 -Field capacity,FLDCP_ON_SURFACE,FLDCP,1,397 -ICAO height at maximum wind level,ICAHT_ON_MAX_WIND,ICAHT,6,398 -ICAO height at tropopause,ICAHT_ON_TROPOPAUSE,ICAHT,7,399 -Radar echo top,RETOP_ON_ENTIRE_ATMOS_SINGLE_LYR,RETOP,200,400 -Time averaged surface Visible beam downward solar flux,AVE_VBDSF_ON_SURFACE,VBDSF,1,401 -Time averaged surface Visible diffuse downward solar flux,AVE_VDDSF_ON_SURFACE,VDDSF,1,402 -Time averaged surface Near IR beam downward solar flux,AVE_NBDSF_ON_SURFACE,NBDSF,1,403 -Time averaged surface Near IR diffuse downward solar flux,AVE_NDDSF_ON_SURFACE,NDDSF,1,404 -Average snowfall rate,AVE_SRWEQ_ON_SURFACE,SRWEQ,1,405 -Dust 1 on pressure surface,DUST1_ON_ISOBARIC_LVL,MASSMR,100,438 -Dust 2 on pressure surface,DUST2_ON_ISOBARIC_LVL,MASSMR,100,439 -Dust 3 on pressure surface,DUST3_ON_ISOBARIC_LVL,MASSMR,100,440 -Dust 4 on pressure surface,DUST4_ON_ISOBARIC_LVL,MASSMR,100,441 -Dust 5 on pressure surface,DUST5_ON_ISOBARIC_LVL,MASSMR,100,442 -Equilibrium level height,HGT_ON_EQUIL_LVL,HGT,247,443 -Lightning,LTNG_ON_SURFACE,LTNG,1,444 -Goes west channel 2 brightness temperature,SBT112_ON_TOP_OF_ATMOS,SBT112,8,446 -Goes west channel 3 brightness temperature,SBT113_ON_TOP_OF_ATMOS,SBT113,8,447 -Goes west channel 4 brightness temperature,SBT114_ON_TOP_OF_ATMOS,SBT114,8,448 -Goes west channel 5 brightness temperature,SBT115_ON_TOP_OF_ATMOS,SBT115,8,449 -In flight icing from NCAR algorithm,ICIP_ON_ISOBARIC_SFC,ICIP,100,450 -Specific humidity at flight levels,SPFH_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,SPFH,103,451 -Virtual temperature based convective available potential energy,VTCAPE_ON_SURFACE,CAPE,1,452 -Virtual temperature based convective inhibition,VTCIN_ON_SURFACE,CIN,1,453 -Virtual temperature on model surfaces,Not currently available for grib2,NA,109,909 -Virtual temperature on pressure surfaces,Not currently available for grib2,NA,100,910 -Virtual temperature on flight levels,Not currently available for grib2,NA,103,911 -Ventilation rate,VRATE_ON_PLANETARY_BOUND_LYR,VRATE,220,454 -Haines index,HINDEX_ON_SURFACE,HINDEX,1,455 -Pressure at flight levels,PRES_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL,PRES,103,482 -Time-averaged percentage snow cover,AVE_SNOWC_ON_SURFACE,SNOWC,1,500 -Time-averaged surface pressure,AVE_PRES_ON_SURFACE,PRES,1,501 -Time-averaged 10m temperature,AVE_TMP_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,TMP,105,502 -Time-averaged mass exchange coefficient,AVE_AKHS_ON_SURFACE,AKHS,1,503 -Time-averaged wind exchange coefficient,AVE_AKMS_ON_SURFACE,AKMS,1,504 -Temperature at 10m,TMP_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,TMP,105,505 -Maximum U-component wind at 10m,MAX_MAXUW_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,MAXUW,105,506 -Maximum V-component wind at 10m,MAX_MAXVW_ON_SPEC_HGT_LVL_ABOVE_GRND_10m,MAXVW,105,507 -Simulated GOES 12 channel 2 brightness temperature with satellite angle correction,NON_NADIR_SBT122_ON_TOP_OF_ATMOS,SBT122,8,456 -Simulated GOES 12 channel 3 brightness temperature with satellite angle correction,NON_NADIR_SBT123_ON_TOP_OF_ATMOS,SBT123,8,457 -Simulated GOES 12 channel 4 brightness temperature with satellite angle correction,NON_NADIR_SBT124_ON_TOP_OF_ATMOS,SBT124,8,458 -Simulated GOES 12 channel 5 brightness temperature with satellite angle correction,NON_NADIR_SBT126_ON_TOP_OF_ATMOS,SBT126,8,459 -Simulated GOES 11 channel 2 brightness temperature with satellite angle correction,SBT112_ON_TOP_OF_ATMOS,SBT112,8,460 -Simulated GOES 11 channel 3 brightness temperature with satellite angle correction,SBT113_ON_TOP_OF_ATMOS,SBT113,8,461 -Simulated GOES 11 channel 4 brightness temperature with satellite angle correction,SBT114_ON_TOP_OF_ATMOS,SBT114,8,462 -Simulated GOES 11 channel 5 brightness temperature with satellite angle correction,SBT115_ON_TOP_OF_ATMOS,SBT115,8,463 -Simulated GOES 15 channel 5 brightness temperature with satellite angle correction,Not currently available for grib2,NA,109,872 -Simulated GOES 13 channel 2 brightness temperature with satellite angle correction,Not currently available for grib2,NA,109,868 -Simulated AMSR-E channel 9 brightness temperature,AMSRE9_ON_TOP_OF_ATMOS,AMSRE9,8,483 -Simulated AMSR-E channel 10 brightness temperature,AMSRE10_ON_TOP_OF_ATMOS,AMSRE10,8,484 -Simulated AMSR-E channel 11 brightness temperature,AMSRE11_ON_TOP_OF_ATMOS,AMSRE11,8,485 -Simulated AMSR-E channel 12 brightness temperature,AMSRE12_ON_TOP_OF_ATMOS,AMSRE12,8,486 -SSMI F13 (19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,800 -SSMI F14 (19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,806 -SSMI F15 (19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,812 -SSMIS F16 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,818 -SSMIS F17 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,825 -SSMIS F18 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,832 -SSMIS F19 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,839 -SSMIS F20 (183H 19H 19V 37H 37V 85H 85V),Not currently available for grib2,NA,109,846 -MTSAT-1r imager channels 1-4 (backup for mtsat2),Not currently available for grib2,NA,109,864 -MTSAT2 imager channels 1-4,Not currently available for grib2,NA,109,860 -Seviri brightness temperature channels 5-11,Not currently available for grib2,NA,109,876 -Insat 3d brightness temperature IR channels 1-4,Not currently available for grib2,NA,109,865 diff --git a/docs/UPP_GRIB2_Table.rst b/docs/UPP_GRIB2_Table.rst deleted file mode 100644 index 13f6ef7c8..000000000 --- a/docs/UPP_GRIB2_Table.rst +++ /dev/null @@ -1,30 +0,0 @@ -================================ -GRIB2 Fields Produced by Unipost -================================ - -GRIB2 fields produced by *unipost* (column 1), abbreviated names -used in the *postcntrl.xml* file (column 2), corresponding standard -grib2 pname (column 3), corresponding grib identification number for the -vertical coordinate (column 4), and corresponding array location UPP -uses to store the variable in parallel arrays (column 5). - -.. csv-table:: - :file: /d1/hertneky/upp/docs/UPP_GRIB2_Table.csv - :header: "Field Description","Name in Grib2 Control File","Grib2 pname","Vertical Level","UPP ID" - :widths: 35,35,10,10,10 - -\*See Appendix A of the UPP Users Guid - -\***4 types of CAPE and CIN can be output with use of the Levels control -line in the wrf\_cntrl.parm (nmb\_cntrl.parm file). - -Surface based CAPE/CIN is output at one grib record, while the remaining -three types are output within one grib record in 3 levels. - - Level 1: Surface Based CAPE/CIN - - Level 2: Best Boundary Layer CAPE/CIN - - Level 3: Mixed Layer CAPE/CIN - - Level 4: Most Unstable CAPE/CIN diff --git a/docs/UPP_Users_guide_V4.rst b/docs/UPP_Users_guide_V4.rst deleted file mode 100644 index 293bdd6c9..000000000 --- a/docs/UPP_Users_guide_V4.rst +++ /dev/null @@ -1,763 +0,0 @@ -.. role:: math(raw) - :format: html latex -.. role:: bolditalic - :class: bolditalic - -====================================================== -User’s Guide for the NCEP Unified Post Processor (UPP) -====================================================== - -**Version 4** - -*Acknowledgments:* - -*The adaptation of the original WRF Post Processor package and Users -Guide (by Mike Baldwin of NSSL/CIMMS and Hui-Ya Chuang of NCEP/EMC) was -done by Lígia Bernardet (NOAA/ESRL/DTC) in collaboration with Dusan -Jovic (NCEP/EMC), Robert Rozumalski (COMET), Wesley Ebisuzaki -(NWS/HQTR), and Louisa Nance (NCAR/RAL/DTC). Upgrades to WRF Post -Processor versions 2.2 and higher were performed by Hui-Ya Chuang, Dusan -Jovic and Mathew Pyle (NCEP/EMC). Transitioning of the documentation -from the WRF Post Processor to the Unified Post Processor was performed -by Nicole McKee (NCEP/EMC), Hui-ya Chuang (NCEP/EMC), and Jamie Wolff -(NCAR/RAL/DTC). Implementation of the Community Unified Post Processor -was performed by Tricia Slovacek and Kate Fossell (NCAR/RAL/DTC).* - -NCEP Unified Post Processor (UPP) -================================= - -UPP Introduction -================ - -The Unified Post Processor (UPP) software package is a software package -designed to generate useful products from raw model output. The UPP is -currently used in operations with the Global Forecast System (GFS), GFS -Ensemble Forecast System (GEFS), North American Mesoscale (NAM), Rapid -Refresh (RAP), High Resolution Rapid Refresh (HRRR), Short Range Ensemble -Forecast (SREF), Hurricane WRF (HWRF) applications, and is also used in -Unified Forecasting System (UFS) applications. The UPP provides the capability -to compute a variety of diagnostic fields and interpolate to pressure levels -or other vertical coordinates. UPP also incorporates the Joint Center for -Satellite Data Assimilation (JCSDA) Community Radiative Transfer Model (CRTM) -to compute model derived brightness temperature (TB) for various instruments -and channels. This additional feature enables the generation of a number of -simulated satellite products including GOES products. Output from the UPP is -in National Weather Service (NWS) and World Meteorological Organization (WMO) -GRIB2 format and can be used directly by visualization, plotting, or verification -packages, or for further downstream post-processing, e.g. statistical -post-processing techniques. - - Examples of UPP products include: - - - T, Z, humidity, wind, cloud water, cloud ice, rain, and snow on pressure levels - - SLP, shelter level T, humidity, and wind fields - - Precipitation-related fields - - PBL-related fields - - Severe weather products (e.g. CAPE, Vorticity, Wind shear) - - Radiative/Surface fluxes - - Cloud related fields - - Aviation products - - Radar reflectivity products - - Satellite look-alike products - -Community user support is currently provided for FV3-based applications, and on -a limited basis, WRF-ARW applications. - -http://www.dtcenter.org/upp/users/docs/user_guide/crtm_ug/CRTM_User_Guide.pdf. - -Software Installation/Getting Started -===================================== - -System Requirements, Libraries, and Compilers ---------------------------------------------- -UPP has been tested on LINUX platforms (with PGI, Intel and GFORTRAN -compilers). - -Before installing the UPP code, it is necessary to ensure that you have -the required libraries available on your system. These libraries -include: - -- Unidata’s NetCDF library - - https://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html - -- The NCEP libraries for the UPP application - - https://github.com/NCAR/NCEPlibs - -- The JasPer, PNG, and Zlib libraries, required for GRIB2 capabilities. NCEP - provides these necessary codes for download: - - http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/ - -- GNU M4, used to build the WRF I/O libraries included in UPPV4.0. - This is usually bundled with an operating system or can be downloaded: - - https://www.gnu.org/software/m4/ - -The UPP has some sample visualization scripts included to create graphics using: - -- GrADS (http://cola.gmu.edu/grads/gadoc/gadoc.php) - -- GEMPAK (http://www.unidata.ucar.edu/software/gempak/index.html) - -**Note:** *These are not part of the UPP installation and need to be -installed separately if one would like to use either plotting package.* - -The UPP and all libraries required by the UPP need to be built with the same compiler. - -Obtaining the UPP Code ----------------------- - -The most recent release UPPV4.0.1 is available on github. To obtain the code, move to the diretory where you would like the repository to reside and enter on the command line: - - git clone -b DTC_post --recurse-submodules https://github.com/NOAA-EMC/EMC_post - -This will clone the DTC_post branch of EMC_post, including the CRTM submodule. - -UPP Directory Structure ------------------------ - -Under the main directory of **UPPV4.0** reside seven subdirectories -(\* indicates directories that are created after the configuration -step): - -**docs**: - -**exec**\*: Contains the *unipost* executable after successful compilation - -**include**\*: Source include modules built/used during compilation of UPP - -**lib**\*: Libraries built/used by UPP not in NCEPlibs - -**parm**: Contains the parameter files, which can be modified by the -user to control how the post processing is performed. - -**scripts**: contains sample running scripts to process model history files. - -- **run\_unipost**: runs *unipost*. - -**sorc**: Contains source codes for: - -- **arch**: Machine dependent configuration build scripts used to construct *configure.upp* - -- **ncep_post.fd**: Source code for *unipost* - -- **comlibs**: Contains source code subdirectories for the UPP libraries not included in NCEPlibs - - - **crtm2**: Community Radiative Transfer Model library - - - **wrfmpi\_stubs**: Contains some *C* and *FORTRAN* codes - to generate *libmpi.a* library used to replace MPI calls for - serial compilation. - - - **xml**: XML support for the GRIB2 parameter file - -Installing the UPP Code ------------------------ - -Environment variables to compatible versions of the required libraries must be set -before beginning the installation. - -To reference the netCDF libraries, the configure script checks for an -environment variable (**NETCDF**) first, then the system default -(**/user/local/netcdf**), and then a user supplied link -(*./netcdf\_links*). If none of these resolve a path, the user will -be prompted by the configure script to supply a path. - -To reference the NCEP libraries, the configure script will also check that you set the environment variable **NCEPLIBS_DIR** to the location where the NCEPlibs were built. - -Type configure, and provide the required info. For example: - - *./configure* - -You will be given a list of choices for your computer. - -1. Linux x86\_64, PGI compiler (serial) - -2. Linux x86\_64, PGI compiler (dmpar) - -3. Linux x86\_64, Intel compiler (serial) - -4. Linux x86\_64, Intel compiler (dmpar) - -5. Linux x86\_64, Intel compiler, SGI MPT (serial) - -6. Linux x86\_64, Intel compiler, SGI MPT (dmpar) - -7. Linux x86\_64, gfortran compiler (serial) - -8. Linux x86\_64, gfortran compiler (dmpar) - -Choose one of the configure options listed. Check the -*configure.upp* file created and edit for compile options/paths, if -necessary. For debug flag settings, the configure script can be run with -a *-d* switch or flag. - -To compile UPP, enter the following command: - - *./compile >& compile\_upp.log &* - -When compiling UPP with distributed memory (serial) this command should -create 2 (3) libraries in **EMC_post/lib/** (*libCRTM.a*, (*libmpi.a*), *libxmlparse.a*) and the UPP executable in **exec/** (*unipost.exe*). - -To remove all built files, as well as the *configure.upp*, type: - - *./clean* - -This action is recommended if a mistake is made during the installation -process or a change is made to the configuration or build environment. -There is also a *clean -a* option which will revert back to a -pre-install configuration. - -UPP Functionalities -------------------- - -The UPP, - -- is compatible with WRF v3.7 and higher for Ferrier physics. - -- can be used to post-process WRF-ARW, WRF-NMM, NMMB, GFS, CFS, and FV3 - forecasts (community support only provided for WRF-ARW and global FV3 - forecasts). - -- can ingest WRF history files (wrfout\*) in netCDF format. - -- can ingest FV3 history files (dyn\*/phy\* or gfs\*) in binarynemsiompioo. - format. - -**Unipost** - - - Interpolates the forecasts from the models native vertical - coordinate to NWS standard output levels (e.g., pressure, height) - and computes mean sea level pressure. If the requested parameter - is on a models native level, then no vertical interpolation is - performed. - - - Computes diagnostic output quantities (e.g., convective available - potential energy, helicity, relative humidity). A full list of - fields that can be generated by *unipost* is provided in - https://dtcenter.org/upp/users/docs/tables/UPP_GRIB2_Table.pdf. - - - Outputs the results in NWS and WMO standard GRIB2 format - (for GRIB documentation, see - http://www.nco.ncep.noaa.gov/pmb/docs/). - - - Except for new capabilities of post processing GFS/CFS and - additions of many new variables, UPP uses the same algorithms to - derive most existing variables as were used in WPP. The only three - exceptions/changes from the WPP are: - - - Computes RH w.r.t. ice for GFS, but w.r.t. water for all other - supported models. WPP computed RH w.r.t. water only. - - - The height and wind speed at the maximum wind level is computed - by assuming the wind speed varies quadratically in height in - the location of the maximum wind level. The WPP defined maximum - wind level at the level with the maximum wind speed among all - model levels. The static tropopause level is obtained by - finding the lowest level that has a temperature lapse rate of - less than 2 K/km over a 2 km depth above it. The WPP defined - the tropopause by finding the lowest level that has a mean UPP - V3: Users Guide 8 temperature lapse rate of 2 K/km over three - model layers. - -Setting up the model to interface with UPP ------------------------------------------------------ - -The unipost program is currently set up to read a large number of fields -from the model history files. This configuration stems from -NCEP’s need to generate all of its required operational products. When -using the netCDF or NEMS binary read, this program is configured such -that it will run successfully even if an expected input field is missing -from the history file as long as this field is not required -to produce a requested output field. If the pre-requisites for a -requested output field are missing from the history file, -unipost will abort at run time. - -Take care not to remove fields from the model history files, which may -be needed for diagnostic purposes by the UPP package. For example, if -isobaric state fields are requested, but the pressure fields on model -interfaces are not available in the history -file, unipost will abort at run time. In general, the default fields -available in the model history files are sufficient to run UPP. - -UPP is written to process a single forecast hour, therefore, having a -single forecast per output file is optimal. However, for WRF based -forecasts, UPP can be run across multiple forecast times in a single -output file to extract a specified forecast hour. - -UPP Control File Overview -========================= - -GRIB2 control file ------------------- - -- For outputting GRIB2 format using version 4.0, a preprocessing step - is required by the user to convert the xml file - *parm/postcntrl.xml* to a flat text file - *parm/postxconfig-NT.txt*. The flat file is quicker to process - than the xml file. The user will first need to edit the - *postcntrl.xml* file to declare which fields are to be output - from UPP. - -- In order to ensure that the user-edited xml files are error free, XML - stylesheets (*parm/EMC\_POST\_CTRL\_Schema.xsd* and - *EMC\_POST\_Avblflds\_Schema.xsd*) are used to validate both the - *postcntrl.xml* and *post\_avblflds.xml* files, respectively. - Confirmation of validation will be given (e.g. postcntrl.xml - validates) or otherwise return errors if it does not match the - schema. To run the validation: - - *xmllint --noout --schema EMC\_POST\_CTRL\_Schema.xsd - postcntrl.xml* - - *xmllint --noout --schema EMC\_POST\_Avblflds\_Schema.xsd - post\_avblflds.xml* - -- Once the xmls are validated, the user will need to generate the flat - file. Edit the *parm/makefile* if necessary to point to the - desired flat file directory and xmls. The makefile will call the perl - program *parm/POSTXMLPreprocessor.pl* to generate the post flat - file *postxconfig-NT.txt*. Generate the flat file: - - *make* - -Controlling which variables unipost outputs -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To output a field, the body of the control file needs to contain an -entry for the appropriate variable. For variables found on isobaric or -height levels, the desired levels to be output must be listed (see next -section: *Controlling which levels unipost outputs*). If an entry for -a particular field is not yet available in the control file, it may be -added to the control file with the appropriate entries for that field. - -Controlling which levels unipost outputs -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The tag in the postcntrl.xml is used to list the desired levels -for output. The following levels are currently available for output: - -- For isobaric output, 46 levels are possible, from 2 to 1000 hPa (*2, - 5, 7, 10, 20, 30, 50, 70 mb and then every 25 mb from 75 to 1000 - mb*). The complete list of levels is specified in - *src/unipost/CTLBLK.f*. - - - Modify specification of variable LSMDEF to change the number of - pressure levels: LSMDEF=47 - - - Modify specification of SPLDEF array to change the values of - pressure levels: (/200.,500.,700.,1000.,2000.,3000. - &,5000.,7000.,7500.,10000.,12500.,15000.,17500.,20000., …/) - -- For model-level output, all model levels are possible, from the - highest to the lowest. - -- When using the Noah LSM, the soil layers are 0-10 cm, 10-40 cm, - 40-100 cm, and 100-200 cm. - -- When using the RUC LSM, the soil levels are 0 cm, 1 cm, 4 cm, 10 cm, - 30 cm, 60 cm, 100 cm, 160 cm, and 300 cm. (For the old RUC LSM, - there are only 6 layers and if using this, you will need to change - “RUC LSM” from 9 to 6 in the WRFPOST.f routine.) - -- When using Pliem-Xiu LSM, there are two layers: 0-1 cm, 1-100 cm - -- For low, mid, and high cloud layers, the layers are :math:`\geq`\ 642 - hPa, :math:`\geq`\ 350 hPa, and <350 hPa, respectively. - -- For PBL layer averages, the levels correspond to 6 layers with a - thickness of 30 hPa each. - -- For flight level, the levels are 30 m, 50 m, 80 m, 100 m, 305 m, 457 - m, 610 m, 914 m, 1524 m, 1829 m, 2134 m, 2743 m, 3658 m, 4572 m, 6000 - m, 7010 m. - -- For AGL radar reflectivity, the levels are 4000 and 1000 m (see - Appendix A for details). - -- For surface or shelter-level output, the is not necessary. - -Running UPP -=========== - -Scripts for running the UPP package are included in the tar file: - - *run\_unipost* - -Before running any of the above listed scripts, perform the following instructions: - -#. *cd* to your *DOMAINPATH* directory. - -#. Make a directory to put the UPP results. - - *mkdir postprd* - -#. Make a directory to put a copy of *postxconfig-NT.txt*. - - *mkdir parm* - -#. Copy over the relevant control file to your working directory to - customize *unipost* - - For WRF, copy the *UPPV4.0/parm/postxconfig-NT-WRF.txt* or for - FV3, copy the *UPPV4.0/parm/postxconfig-NT-GFS.txt*. - - **Note:** *If you modified postcntrl.xml to reflect desired fields - and levels, you will need to be sure that you generated the new flat file - (please reference the section 'GRIB2 Control File' on how to do this)* - -#. Copy over the (*UPPV4.0/scripts/run\_unipost*) script to **postprd/**. - -#. Edit the run script as outlined below. Once these directories are set - up and the edits outlined below are complete, the script can be run - interactively from the **postprd** directory by simply typing the - script name on the command line. - -Overview of the scripts to run the UPP --------------------------------------- - -**Note** *: It is recommended that the user refer to the -run\_unipost scripts in the script/ while reading this overview.* - -User modified variables are all contained at the top of -the *run\_unipost* script in one user-edit section, along with a -brief description. Descriptions below follow the *run\_unipost* -script. - -#. Set up basic path variables: - - **TOP\_DIR** : Top level directory for source code (*UPPV4.0*) - - **DOMAINPATH** : Working directory for this run - - **UNIPOST\_HOME** : Location of the *UPPV4.0* build directory - - **POSTEXEC** : Location of the *UPPV4.0* executables - - **modelDataPath** : Location of the model output data files to be - processed (e.g. **wrfprd/** for WRF-based runs). - - **txtCntrlFile** : Name and location of *postxconfig-NT.txt* - file that lists desired fields for GRIB2 format. - This file is generated by the user following the steps listed above - in the *'GRIB2 Control File'* section. - - **Note:** *For WRF, the scripts are configured such that - unipost expects the WRF history files (wrfout - files) to be in wrfprd/, the postxconfig-NT.txt file to be - in parm/ and the postprocessor working directory to be - called postprd/, all under DOMAINPATH* - - This set up is for user convenience to have a script ready to run, - paths may be modified but be sure to check the run script to make - sure settings are correct. - -#. Specify dynamic core being run (ARW or FV3) - - **dyncore**: What model core is used (ARW or FV3) - -#. Specify the format for the input model files and output UPP files. - - **inFormat**: Format of the model data - - arw - "netcdf" - fv3 - "binarynemsiompiio" - - **outFormat**: Format of output from UPP - - "grib2" - -#. Specify the forecast cycles to be post-processed - - **startdate** : Forecast start date (YYYYMMDDHH) - - **fhr** : First forecast hour to be post-processed - - **lastfhr** : Last forecast hour to be post-processed - - **incrementhr** : Increment (in hours) between forecast files - - \*Do not set to 0 or the script will loop continuously - -#. Set up how many domains will be post-processed - - **domain\_list** : List of domains for run (e.g. d01 d02) - -#. Set/uncomment the run command for your system. (i.e. serial, mpirun, - etc). - - **RUN\_COMMAND** : System run command for serial or parallel runs - - - The default execution command in the distributed scripts is for a - single processor: - - *./unipost.exe > unipost\_${domain}.${fhr}.out 2>&1* - - - To run unipost using mpi (dmpar compilation), the command line - should be: - - >> LINUX-MPI systems: *mpirun -np N unipost.exe > outpost - 2>&1* - - (**Note:** *on some systems a host file also needs to be - specified: -machinefile "host"*) - - >> IBM: *mpirun.lsf unipost.exe < itag > outpost* - - >> SGI MPT: *mpiexec\_mpt unipost.exe < itag > outpost* - -#. Set naming convention for prefix and extension of output file name - - - **comsp** is the initial string of the output file name (by default - it is not setand the prefix of the output file will be the string set - in the tag of the *postcntrl.xml*). - - - **tmmark** is used for the file extension (in - *run\_unipost*, *tmmark=tm00*, if not set, it is set to .GrbF) - -The itag that will be read in by *unipost.exe* from -stdin (unit 5) is generated automatically in the *run\_unipost* -script based on the user-defined options above. It should not be -necessary to edit this. For description purposes, the namelist -(*itag*) contains 6 lines for FV3: - -#. Name of the FV3 (pressure level) output file to be posted. - -#. Format of FV3 model output (netcdf, binarynemsio). - -#. Format of UPP output (GRIB2) - -#. Forecast valid time (not model start time) in FV3 format (the - forecast time desired to be post-processed). - -#. Dynamic core used (GFS). - -#. Name of the FV3 (surface) output file to be post-processed. - -**Note:** *If the third line (i.e., UPP output type) is not set, UPP will default the output file format to "grib1". -UPP output for FV3 only supports GRIB2.* - -If scripts *run\_unipostandgrads* or *run\_unipostandgempak* are -used, additional steps are taken to create image files (see -Visualization section below). - -Upon a successful run, *unipost* will generate output files *GFSPRS.hh* in the postprocessor working directory, where *nn* refers to -the domain id and *hh* denotes the forecast hour. In addition, the script -*run\_unipostandgrads* will produce a suite of png images named -*variablehh\_GrADS.png*, and the script *run\_unipostandgempak* -will produce a suite of gif images named *variablehh.gif*. - -If the run did not complete successfully, a log file in the -post-processor working directory called *unipost.hh.out*, where *nn* is the domain id and *hh* is the -forecast hour, may be consulted for further information. - -Examples of wgrib2 -================== - -*Wgrib2* is a versatile program that has the ability to convert -grib2 files from one grid to another for various user-defined grids as -well as pre-defined NCEP grids. Complete documentation with examples of -re-gridding for all available grid definitions can be found at: - -http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/new_grid.html. - -Sample command line usage for calling wgrib2: - - *wgrib2 -new\_grid\_winds W -new\_grid A B C outfile* - -Where, - - **W** = earth or grid - - earth: winds oriented to the earths north and south directions - - grid: winds are rotated so that north is relative to the grid - - **A**, **B**, and **C** represent the output grid description - - Sample lat-lon grid description: - - **A** = latlon - - **B** = lon0:nlon:dlon - - lon0 is longitude of first grid point in degrees - - nlon is number of longitudes - - dlon is grid resolution in degrees of longitude - - **C** = lat0:nlat:dlat - - lat0 is latitude of first grid point - - nlat is number of latitudes - - dlat is grid resolution in degrees of latitude - -**Note:** *wgrib2 is not distributed within the UPP tar -file. Users may download and install from -http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/.* - -Visualization with UPP -====================== - -GEMPAK -------- - -The GEMPAK utility *nagrib* is able to decode GRIB files whose -navigation is on any non-staggered grid. Hence, GEMPAK is able to decode -GRIB files generated by the UPP package and plot horizontal fields or -vertical cross sections. - -A sample script named *run\_unipostandgempak*, which is included in -the scripts directory of the tar file, can be used to run *unipost* -and plot the following fields using GEMPAK: - -- **Sfcmap\_dnn\_hh.gif**: mean SLP and 6 hourly precipitation - -- **PrecipType\_dnn\_hh.gif**: precipitation type (just snow and - rain) - -- **850mbRH\_dnn\_hh.gif**: 850 mb relative humidity - -- **850mbTempandWind\_dnn\_hh.gif**: 850 mb temperature and wind - vectors - -- **500mbHandVort\_dnn\_hh.gif**: 500 mb geopotential height and - vorticity - -- **250mbWindandH\_dnn\_hh.gif**: 250 mb wind speed isotacs and - geopotential height - -This script can be modified to customize fields for output. GEMPAK has -an online users guide at: - -http://www.unidata.ucar.edu/software/gempak/help_and_documentation/manual/. - -In order to use the script *run\_unipostandgempak*, it is necessary -to set the environment variable *GEMEXEC* to the path of the GEMPAK -executables. For example, - - *setenv GEMEXEC /usr/local/gempak/bin* - -GrADS ------ - -The GrADS utilities *g2ctl.pl* and *gribmap* -are able to decode GRIB2 files whose navigation is on any -non-staggered grid. These utilities and instructions on how to use them -to generate GrADS control files are available from: - -http://www.cpc.ncep.noaa.gov/products/wesley/g2ctl.html (GRIB2). - -The GrADS package is available from: -http://cola.gmu.edu/grads/gadoc/gadoc.php. - -GrADS has an online Users Guide at: -http://cola.gmu.edu/grads/gadoc/users.html - -A list of basic commands for GrADS can be found at: -http://cola.gmu.edu/grads/gadoc/reference_card.pdf. - -A sample script named *run\_unipostandgrads*, which is included in -the scripts directory of the Unified Post Processing package, can be -used to run *unipost* and plot the following fields using GrADS: - -- **Sfcmaphh\_dnn\_GRADS.png**: mean SLP and 6-hour accumulated - precipitation. - -- **850mbRHhh\_dnn\_GRADS.png**: 850 mb relative humidity - -- **850mbTempandWindhh\_dnn\_GRADS.png**: 850 mb temperature and wind - vectors - -- **500mbHandVorthh\_dnn\_GRADS.png**: 500 mb geopotential heights - and absolute vorticity - -- **250mbWindandHhh\_dnn\_GRADS.png**: 250 mb wind speed isotacs and - geopotential heights - -In order to use the script *run\_unipostandgrads*, it is necessary -to: - -#. Set the environmental variable GADDIR to the path of the GrADS fonts - and auxiliary files. For example: - - *setenv GADDIR /usr/local/grads/data* - -#. Add the location of the GrADS executables to the PATH. For example: - - *setenv PATH /usr/local/grads/bin:$PATH* - -#. Link script *cbar.gs* to the post-processor working directory. - (This scripts is provided in UPP package, and the - *run\_unipostandgrads* script makes a link from **scripts/** to - **postprd/**.) To generate the plots above, GrADS script - *cbar.gs* is invoked. This script can also be obtained from the - GrADS library of scripts at - http://cola.gmu.edu/grads/gadoc/library.html. - -Fields produced by unipost -========================== - -The 2 tables described below contain documentation regarding the fields -that are available for output by UPP for GRIB2. - -Grib2 Table: ------------- - -https://dtcenter.org/upp/users/docs/tables/UPP_GRIB2_Table.pdf - -This table lists basic and derived fields currently produced by unipost -for grib2. The abbreviated names listed in the second column of each -table describe how the fields should be entered in the -*post\_cntrl.xml*. - -Appendix A: UPPV3.1+ Reflectivity field descriptions -==================================================== - -Reflectivities are filled/computed depending on the model core and -microphysics options. - -UPP uses model derived reflectivity (REFL\_10CM from WRF) for model runs -using the Thompson microphysics option (mp=8). Other combinations use -algorithms within UPP code. - -Work is underway to provide more user flexibility when selecting -reflectivity computations. For more information on model computed -reflectivity, e.g. REFL\_10CM, please see model documentation. - -Relevant routines for reflectivity. Some or all of these may need to be -modified if the user desires to change where/how reflectivity is -processed. It is recommended that the user have knowledge of the model -output and reflectivity computations before trying to modify the UPP -code. Email `upp-help@ucar.edu `__ for further questions. - -**INITPOST**\* - Separate routines for each different model core (e.g. -ARW, FV3, etc.). Reads model fields, e.g. REFL\_10CM, REFD\_MAX - -**MDLFLD.f** - Computes DBZ or fills DBZ arrays with model computed -Reflectivity. - Fills 3-D model level reflectivity array (UPP ID: 250) - -Fills 2-D composite reflectivity array (UPP ID: 252) - -**MDL2AGL.f** - Interpolates relevant DBZ array to AGL reflectivity -(UPP ID: 253) - Outputs model computed maximum hourly reflectivity -(REFD\_MAX; UPP ID: 421) - -**MDL2P.f** - Interpolates relevant DBZ array to pressure levels (UPP -ID: 251) - - -Acknowledgement - -If significant help was provided via the UPP helpdesk for work resulting -in a publication, please acknowledge the Developmental Testbed Center -UPP Team. - -For referencing this document please use: - -UPP Users Guide V3.0, 34 pp. [available online at -http://www.dtcenter.org/upp/users/docs/user\_guide/V3/upp\_users\_guide.pdf] diff --git a/docs/conf.py b/docs/conf.py index ae4186a60..4e9248c66 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,12 +17,12 @@ # -- Project information ----------------------------------------------------- -project = 'upp_docs' -copyright = '2019, Tracy Hertneky' -author = 'Tracy Hertneky' +project = 'Unified Post Processor Users Guide' +copyright = '2020' +author = ' ' # The full version, including alpha/beta/rc tags -release = 'v1' +release = ' ' # -- General configuration --------------------------------------------------- @@ -36,6 +36,10 @@ # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = '.rst' + # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. @@ -49,7 +53,10 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = 'classic' + +# html_theme_options = {} +html_theme_options = {"body_max_width": "none"} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/docs/index.rst b/docs/index.rst index 99e94eae2..2ed89e5c3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,21 +1,13 @@ -.. upp_docs documentation master file, created by - sphinx-quickstart on Wed Nov 13 10:17:56 2019. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to upp_docs's documentation! -==================================== +Welcome to the UPP User's Guide +=============================== .. toctree:: - :maxdepth: 2 - :caption: Contents: - - - UPP_Users_guide_V4 - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + :maxdepth: 3 + :numbered: + + Introduction + CodeOverview + InputsOutputs + Regridding + BuildRunWithoutApp + Acknowledgments From 453e9ff6d012f6080d10c0fdc9ffe5d51b1b4853 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 21 Feb 2020 07:28:49 -0700 Subject: [PATCH 56/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 50306eb25..3c7e07fd7 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 50306eb2502a525551aa076e95d6303af24c4208 +Subproject commit 3c7e07fd7ccc5fb37e950785e3b543a435dfce52 From ed61d7dd3b2e742d6e3657bb9e9e2fe9127ed914 Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Fri, 21 Feb 2020 20:22:01 +0000 Subject: [PATCH 57/85] Rename g2tmpl_d to g2tmpl (#89) --- CMakeLists.txt | 2 +- sorc/ncep_post.fd/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 621fdf4c0..c79d62299 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ if(NOT TARGET g2_4) find_package(g2 REQUIRED) endif() -if(NOT TARGET g2tmpl_d) +if(NOT TARGET g2tmpl) find_package(g2tmpl REQUIRED) endif() diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index d3da41851..2b7b33c7e 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -198,7 +198,7 @@ target_include_directories(${LIBNAME} PUBLIC ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) target_link_libraries(${LIBNAME} sp_4 sigio_4 sfcio_4 gfsio_4 - nemsio ip_4 w3emc_4 w3nco_4 g2tmpl_d g2_4 crtm bacio_4 ${PNG_LIBRARIES} ${JASPER_LIBRARY}) + nemsio ip_4 w3emc_4 w3nco_4 g2tmpl g2_4 crtm bacio_4 ${PNG_LIBRARIES} ${JASPER_LIBRARY}) target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) From 723f4fb9d22bc51aa1a8bf8cf1e13b7e6f31655f Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 21 Feb 2020 13:56:30 -0700 Subject: [PATCH 58/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 3c7e07fd7..1b41b3a27 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 3c7e07fd7ccc5fb37e950785e3b543a435dfce52 +Subproject commit 1b41b3a2794f1db002a965749ccc448f135b72b7 From bc4e6c3e94795664ac4fda61d206850a11eede1e Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Sat, 22 Feb 2020 12:01:25 -0500 Subject: [PATCH 59/85] cleanup post Change-Id: Ie52af5ff79ac4122e79d7a46e89ee2077188b0a4 --- .gitignore | 10 + CMakeLists.txt | 42 ++-- VERSION | 1 + sorc/CMakeLists.txt | 1 + sorc/ncep_post.fd/CMakeLists.txt | 387 +++++++++++++++---------------- 5 files changed, 216 insertions(+), 225 deletions(-) create mode 100644 .gitignore create mode 100644 VERSION create mode 100644 sorc/CMakeLists.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..354ebb137 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +build/ +install/ + +*.[ao] +*.mod +*.so +*.exe +*.x + +*.swp diff --git a/CMakeLists.txt b/CMakeLists.txt index c79d62299..a931c54b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,32 +1,13 @@ cmake_minimum_required(VERSION 3.15) -project(ncep_post VERSION 1.1.1) -set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION} CACHE INTERNAL "${PROJECT_NAME} version number") -enable_language (Fortran) +file(STRINGS "VERSION" pVersion) -option(OPENMP "use OpenMP threading" OFF) - -if (NOT CMAKE_BUILD_TYPE) - set (CMAKE_BUILD_TYPE RELEASE CACHE STRING - "Choose the type of build, options are: PRODUCTION Debug Release." - FORCE) -endif() +project( + ncep_post + VERSION ${pVersion} + LANGUAGES Fortran) -if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(IntelComp true ) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang*") - set(GNUComp true ) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*") - set(PGIComp true ) -endif() - -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE) -if(NOT BUILD_RELEASE ) - STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) -endif() -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEBUG" BUILD_DEBUG) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) @@ -35,15 +16,19 @@ if(POLICY CMP0012) cmake_policy(SET CMP0012 NEW) endif() +option(OPENMP "use OpenMP threading" OFF) + find_package(MPI REQUIRED) if(OPENMP) - find_package(OpenMP) + find_package(OpenMP REQUIRED) endif() find_package(PNG REQUIRED) find_package(ZLIB REQUIRED) +find_package(Jasper REQUIRED) find_package(HDF5 COMPONENTS C Fortran HL REQUIRED) find_package(NetCDF REQUIRED) -find_package(Jasper REQUIRED) + +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true) if(NOT TARGET sigio_4) find_package(sigio REQUIRED) @@ -93,5 +78,4 @@ if(NOT TARGET crtm) find_package(crtm REQUIRED) endif() - -add_subdirectory(sorc/ncep_post.fd) +add_subdirectory(sorc) diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..524cb5524 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.1.1 diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt new file mode 100644 index 000000000..b454c0fb2 --- /dev/null +++ b/sorc/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(ncep_post.fd) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 2b7b33c7e..6ed117adb 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -1,215 +1,210 @@ - set(LIB_SRC - ${CMAKE_CURRENT_SOURCE_DIR}/AllGETHERV_GSD.f - ${CMAKE_CURRENT_SOURCE_DIR}/ALLOCATE_ALL.f - ${CMAKE_CURRENT_SOURCE_DIR}/ASSIGNNEMSIOVAR.f - ${CMAKE_CURRENT_SOURCE_DIR}/AVIATION.f - ${CMAKE_CURRENT_SOURCE_DIR}/blockIO.c - ${CMAKE_CURRENT_SOURCE_DIR}/BNDLYR.f - ${CMAKE_CURRENT_SOURCE_DIR}/BOUND.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALCAPE.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALDRG.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALDWP.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALGUST.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALHEL.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALLCL.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALMCVG.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALMICT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALPBL.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALPBLREGIME.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALPOT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALPW.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRAD_WCLOUD_newcrtm.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRCH.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRH.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GFS.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GSD.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_PW.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALSTRM.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALTAU.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALTHTE.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALUPDHEL.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALVIS.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALVIS_GSD.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALVOR.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_BOURG.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_DOMINANT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_EXPLICIT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_RAMER.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_REVISED.f - ${CMAKE_CURRENT_SOURCE_DIR}/CANRES.f - ${CMAKE_CURRENT_SOURCE_DIR}/CLDFRAC_ZHAO.f - ${CMAKE_CURRENT_SOURCE_DIR}/CLDRAD.f - ${CMAKE_CURRENT_SOURCE_DIR}/CLMAX.f - ${CMAKE_CURRENT_SOURCE_DIR}/CMASSI.f - ${CMAKE_CURRENT_SOURCE_DIR}/COLLECT.f - ${CMAKE_CURRENT_SOURCE_DIR}/COLLECT_LOC.f - ${CMAKE_CURRENT_SOURCE_DIR}/CTLBLK.f - ${CMAKE_CURRENT_SOURCE_DIR}/cuparm.f - ${CMAKE_CURRENT_SOURCE_DIR}/DEALLOCATE.f - ${CMAKE_CURRENT_SOURCE_DIR}/DEWPOINT.f - ${CMAKE_CURRENT_SOURCE_DIR}/ETCALC.f - ${CMAKE_CURRENT_SOURCE_DIR}/EXCH2.f - ${CMAKE_CURRENT_SOURCE_DIR}/EXCH.f - ${CMAKE_CURRENT_SOURCE_DIR}/FDLVL.f - ${CMAKE_CURRENT_SOURCE_DIR}/FGAMMA.f - ${CMAKE_CURRENT_SOURCE_DIR}/FILL_PSETFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/FIXED.f - ${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL2.f - ${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL.f - ${CMAKE_CURRENT_SOURCE_DIR}/GEO_ZENITH_ANGLE.f - ${CMAKE_CURRENT_SOURCE_DIR}/GET_BITS.f - ${CMAKE_CURRENT_SOURCE_DIR}/GETGBANDSCATTER.f - ${CMAKE_CURRENT_SOURCE_DIR}/getIVariableN.f - ${CMAKE_CURRENT_SOURCE_DIR}/GETNEMSNDSCATTER.f - ${CMAKE_CURRENT_SOURCE_DIR}/get_postfilename.f - ${CMAKE_CURRENT_SOURCE_DIR}/getVariable.f - ${CMAKE_CURRENT_SOURCE_DIR}/GFIP3.f - ${CMAKE_CURRENT_SOURCE_DIR}/GFSPOST.F - ${CMAKE_CURRENT_SOURCE_DIR}/GPVS.f - ${CMAKE_CURRENT_SOURCE_DIR}/grib2_module.f - ${CMAKE_CURRENT_SOURCE_DIR}/GRIBIT.F - ${CMAKE_CURRENT_SOURCE_DIR}/GRIDAVG.f - ${CMAKE_CURRENT_SOURCE_DIR}/GRIDSPEC.f - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_algo.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_compute.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_config.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_ctlblk.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_filter.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_indices.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_smoothseams.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/ICAOHEIGHT.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST.F - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS_MPIIO.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_SIGIO.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS_MPIIO.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NETCDF.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NMM.f - ${CMAKE_CURRENT_SOURCE_DIR}/kinds_mod.F - ${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD_GFS.f - ${CMAKE_CURRENT_SOURCE_DIR}/LOOKUP.f - ${CMAKE_CURRENT_SOURCE_DIR}/machine.f - ${CMAKE_CURRENT_SOURCE_DIR}/map_routines.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/MAPSSLP.f - ${CMAKE_CURRENT_SOURCE_DIR}/MASKS_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2AGL.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2P.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA2.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2THANDPV.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDLFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/MICROINIT.F - ${CMAKE_CURRENT_SOURCE_DIR}/MISCLN.f - ${CMAKE_CURRENT_SOURCE_DIR}/MIXLEN.f - ${CMAKE_CURRENT_SOURCE_DIR}/MPI_FIRST.f - ${CMAKE_CURRENT_SOURCE_DIR}/MPI_LAST.f - ${CMAKE_CURRENT_SOURCE_DIR}/MSFPS.f - ${CMAKE_CURRENT_SOURCE_DIR}/native_endianness.f - ${CMAKE_CURRENT_SOURCE_DIR}/NGMFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/NGMSLP.f - ${CMAKE_CURRENT_SOURCE_DIR}/OTLFT.f - ${CMAKE_CURRENT_SOURCE_DIR}/OTLIFT.f - ${CMAKE_CURRENT_SOURCE_DIR}/PARAMR.f - ${CMAKE_CURRENT_SOURCE_DIR}/params.F - ${CMAKE_CURRENT_SOURCE_DIR}/PARA_RANGE.f - ${CMAKE_CURRENT_SOURCE_DIR}/physcons.f - ${CMAKE_CURRENT_SOURCE_DIR}/PMICRPH.f - ${CMAKE_CURRENT_SOURCE_DIR}/POLEAVG.f - ${CMAKE_CURRENT_SOURCE_DIR}/PROCESS.f - ${CMAKE_CURRENT_SOURCE_DIR}/READCNTRL.F - ${CMAKE_CURRENT_SOURCE_DIR}/READ_xml.f - ${CMAKE_CURRENT_SOURCE_DIR}/retrieve_index.f - ${CMAKE_CURRENT_SOURCE_DIR}/RHGRD.f - ${CMAKE_CURRENT_SOURCE_DIR}/RQSTFLD.F - ${CMAKE_CURRENT_SOURCE_DIR}/SCLFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/SELECT_CHANNELS.f - ${CMAKE_CURRENT_SOURCE_DIR}/SERVER.f - ${CMAKE_CURRENT_SOURCE_DIR}/SET_LVLSXML.f - ${CMAKE_CURRENT_SOURCE_DIR}/SET_OUTFLDS.f - ${CMAKE_CURRENT_SOURCE_DIR}/SETUP_SERVERS.f - ${CMAKE_CURRENT_SOURCE_DIR}/SLP_new.f - ${CMAKE_CURRENT_SOURCE_DIR}/SLP_NMM.f - ${CMAKE_CURRENT_SOURCE_DIR}/SMOOTH.f - ${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC.f - ${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC_GFS.f - ${CMAKE_CURRENT_SOURCE_DIR}/SOIL_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/SPLINE.f - ${CMAKE_CURRENT_SOURCE_DIR}/SURFCE.f - ${CMAKE_CURRENT_SOURCE_DIR}/svptbl.f - ${CMAKE_CURRENT_SOURCE_DIR}/TABLE.f - ${CMAKE_CURRENT_SOURCE_DIR}/TABLEQ.f - ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS.f - ${CMAKE_CURRENT_SOURCE_DIR}/TTBLEX.f - ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS2D_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS3D_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS4D_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/WETBULB.f - ${CMAKE_CURRENT_SOURCE_DIR}/WETFRZLVL.f - ${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.f - ${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.h - ${CMAKE_CURRENT_SOURCE_DIR}/xml_perl_data.f - ${CMAKE_CURRENT_SOURCE_DIR}/ZENSUN.f) +AllGETHERV_GSD.f +ALLOCATE_ALL.f +ASSIGNNEMSIOVAR.f +AVIATION.f +BNDLYR.f +BOUND.f +CALCAPE.f +CALDRG.f +CALDWP.f +CALGUST.f +CALHEL.f +CALLCL.f +CALMCVG.f +CALMICT.f +CALPBL.f +CALPBLREGIME.f +CALPOT.f +CALPW.f +CALRAD_WCLOUD_newcrtm.f +CALRCH.f +CALRH.f +CALRH_GFS.f +CALRH_GSD.f +CALRH_PW.f +CALSTRM.f +CALTAU.f +CALTHTE.f +CALUPDHEL.f +CALVIS.f +CALVIS_GSD.f +CALVOR.f +CALWXT_BOURG.f +CALWXT_DOMINANT.f +CALWXT_EXPLICIT.f +CALWXT.f +CALWXT_RAMER.f +CALWXT_REVISED.f +CANRES.f +CLDFRAC_ZHAO.f +CLDRAD.f +CLMAX.f +CMASSI.f +COLLECT.f +COLLECT_LOC.f +CTLBLK.f +cuparm.f +DEALLOCATE.f +DEWPOINT.f +ETCALC.f +EXCH2.f +EXCH.f +FDLVL.f +FGAMMA.f +FILL_PSETFLD.f +FIXED.f +FRZLVL2.f +FRZLVL.f +GEO_ZENITH_ANGLE.f +GET_BITS.f +GETGBANDSCATTER.f +getIVariableN.f +GETNEMSNDSCATTER.f +get_postfilename.f +getVariable.f +GFIP3.f +GFSPOST.F +GPVS.f +grib2_module.f +GRIBIT.F +GRIDAVG.f +GRIDSPEC.f +gtg_algo.f90 +gtg_compute.f90 +gtg_config.f90 +gtg_ctlblk.f90 +gtg_filter.f90 +gtg_indices.f90 +gtg_smoothseams.f90 +ICAOHEIGHT.f +INITPOST.F +INITPOST_GFS.f +INITPOST_GFS_NEMS.f +INITPOST_GFS_NEMS_MPIIO.f +INITPOST_GFS_SIGIO.f +INITPOST_NEMS.f +INITPOST_NEMS_MPIIO.f +INITPOST_NETCDF.f +INITPOST_NMM.f +kinds_mod.F +LFMFLD.f +LFMFLD_GFS.f +LOOKUP.f +machine.f +map_routines.f90 +MAPSSLP.f +MASKS_mod.f +MDL2AGL.f +MDL2P.f +MDL2SIGMA2.f +MDL2SIGMA.f +MDL2THANDPV.f +MDLFLD.f +MICROINIT.F +MISCLN.f +MIXLEN.f +MPI_FIRST.f +MPI_LAST.f +MSFPS.f +native_endianness.f +NGMFLD.f +NGMSLP.f +OTLFT.f +OTLIFT.f +PARAMR.f +params.F +PARA_RANGE.f +physcons.f +PMICRPH.f +POLEAVG.f +PROCESS.f +READCNTRL.F +READ_xml.f +retrieve_index.f +RHGRD.f +RQSTFLD.F +SCLFLD.f +SELECT_CHANNELS.f +SERVER.f +SET_LVLSXML.f +SET_OUTFLDS.f +SETUP_SERVERS.f +SLP_new.f +SLP_NMM.f +SMOOTH.f +SNFRAC.f +SNFRAC_GFS.f +SOIL_mod.f +SPLINE.f +SURFCE.f +svptbl.f +TABLE.f +TABLEQ.f +TRPAUS.f +TTBLEX.f +VRBLS2D_mod.f +VRBLS3D_mod.f +VRBLS4D_mod.f +WETBULB.f +WETFRZLVL.f +wrf_io_flags.f +wrf_io_flags.h +xml_perl_data.f +ZENSUN.f +) -file(GLOB EXE_SRC *.f *.f90 *.F) -file(GLOB EXE_C_SRC *.c) +set(EXE_SRC +CALCAPE2.f +CALHEL2.f +CALVESSEL.f +GFSPOSTSIG.F +INITPOST_GFS_NETCDF.f +MDL2STD_P.f +TIMEF.f +WRFPOST.f +getlvls.f +intio_tags.f +io_int_stubs.f +) -list(REMOVE_ITEM EXE_SRC ${LIB_SRC}) -list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) -list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) +set(EXE_C_SRC blockIO.c) -if(IntelComp) - set(fortran_flags "-free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}") - set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") -elseif(GNUComp) - set(fortran_flags "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}") - if(APPLE) - set(c_flags "-DAPPLE -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") - elseif(UNIX) - set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") - endif(APPLE) -else() - message("unknown compiler!") - exit() +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "-g -traceback -fp-model source -free -convert big_endian") + set(CMAKE_Fortran_FLAGS_RELEASE "-O3") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "-g -fbacktrace -ffree-form -ffree-line-length-none -fconvert=big-endian") + set(CMAKE_Fortran_FLAGS_RELEASE "-O3") endif() -set(EXENAME ncep_post) -set(LIBNAME nceppost) - -add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC}) -add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC}) - -set_source_files_properties(${EXE_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) -set_source_files_properties(${LIB_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) -set_source_files_properties(${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${c_flags}) -if(OPENMP) - set_target_properties(${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) +if(APPLE) + add_compile_definitions(APPLE) +elseif(UNIX) + add_compile_definitions(LINUX) endif() +add_compile_definitions("funder" "FortranByte=char" "FortranInt=int" "FortranLlong='long long'") + +set(LIBNAME nceppost) +set(EXENAME ncep_post) set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include") -set_target_properties(${EXENAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") -set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") +add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC}) +set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY ${module_dir}) target_include_directories(${LIBNAME} PUBLIC ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) - target_link_libraries(${LIBNAME} sp_4 sigio_4 sfcio_4 gfsio_4 nemsio ip_4 w3emc_4 w3nco_4 g2tmpl g2_4 crtm bacio_4 ${PNG_LIBRARIES} ${JASPER_LIBRARY}) -target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) - -install(TARGETS ${EXENAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - install(TARGETS ${LIBNAME} - RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) +install(DIRECTORY ${module_dir} DESTINATION include) -install(DIRECTORY ${module_dir} DESTINATION include_4) +add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC}) +set_target_properties(${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) +target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) + +install(TARGETS ${EXENAME} + RUNTIME DESTINATION bin) From 49d47d162e5fa4b1ff115486a41e27d365b11afd Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Sat, 22 Feb 2020 16:58:51 -0500 Subject: [PATCH 60/85] we dont depend on C HDF5 library. remove. Change-Id: I26aa7c0bf7ed2783de1a9967d961d0260dee8b54 --- CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a931c54b4..bb0823c73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,15 +19,16 @@ endif() option(OPENMP "use OpenMP threading" OFF) find_package(MPI REQUIRED) -if(OPENMP) - find_package(OpenMP REQUIRED) -endif() find_package(PNG REQUIRED) find_package(ZLIB REQUIRED) find_package(Jasper REQUIRED) -find_package(HDF5 COMPONENTS C Fortran HL REQUIRED) +find_package(HDF5 COMPONENTS Fortran HL REQUIRED) find_package(NetCDF REQUIRED) +if(OPENMP) + find_package(OpenMP REQUIRED) +endif() + set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true) if(NOT TARGET sigio_4) From b5be948f1bb836824f117833525f36b9417fc4a8 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Sun, 23 Feb 2020 14:26:41 -0500 Subject: [PATCH 61/85] use transitive properties. apply OpenMP flags if OpenMP is found. Formatting using cmake-format Change-Id: Ic08ce6bc85a7d949c779ec597241c8cb4c20db86 --- CMakeLists.txt | 17 +- sorc/ncep_post.fd/CMakeLists.txt | 384 +++++++++++++++++-------------- 2 files changed, 220 insertions(+), 181 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb0823c73..46360a57d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ file(STRINGS "VERSION" pVersion) project( ncep_post VERSION ${pVersion} - LANGUAGES Fortran) + LANGUAGES C Fortran) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") @@ -18,6 +18,19 @@ endif() option(OPENMP "use OpenMP threading" OFF) +if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE + "Release" + CACHE STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() + +if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") + message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") +endif() + find_package(MPI REQUIRED) find_package(PNG REQUIRED) find_package(ZLIB REQUIRED) @@ -26,7 +39,7 @@ find_package(HDF5 COMPONENTS Fortran HL REQUIRED) find_package(NetCDF REQUIRED) if(OPENMP) - find_package(OpenMP REQUIRED) + find_package(OpenMP REQUIRED COMPONENTS Fortran) endif() set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 6ed117adb..1add4d1e0 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -1,180 +1,180 @@ set(LIB_SRC -AllGETHERV_GSD.f -ALLOCATE_ALL.f -ASSIGNNEMSIOVAR.f -AVIATION.f -BNDLYR.f -BOUND.f -CALCAPE.f -CALDRG.f -CALDWP.f -CALGUST.f -CALHEL.f -CALLCL.f -CALMCVG.f -CALMICT.f -CALPBL.f -CALPBLREGIME.f -CALPOT.f -CALPW.f -CALRAD_WCLOUD_newcrtm.f -CALRCH.f -CALRH.f -CALRH_GFS.f -CALRH_GSD.f -CALRH_PW.f -CALSTRM.f -CALTAU.f -CALTHTE.f -CALUPDHEL.f -CALVIS.f -CALVIS_GSD.f -CALVOR.f -CALWXT_BOURG.f -CALWXT_DOMINANT.f -CALWXT_EXPLICIT.f -CALWXT.f -CALWXT_RAMER.f -CALWXT_REVISED.f -CANRES.f -CLDFRAC_ZHAO.f -CLDRAD.f -CLMAX.f -CMASSI.f -COLLECT.f -COLLECT_LOC.f -CTLBLK.f -cuparm.f -DEALLOCATE.f -DEWPOINT.f -ETCALC.f -EXCH2.f -EXCH.f -FDLVL.f -FGAMMA.f -FILL_PSETFLD.f -FIXED.f -FRZLVL2.f -FRZLVL.f -GEO_ZENITH_ANGLE.f -GET_BITS.f -GETGBANDSCATTER.f -getIVariableN.f -GETNEMSNDSCATTER.f -get_postfilename.f -getVariable.f -GFIP3.f -GFSPOST.F -GPVS.f -grib2_module.f -GRIBIT.F -GRIDAVG.f -GRIDSPEC.f -gtg_algo.f90 -gtg_compute.f90 -gtg_config.f90 -gtg_ctlblk.f90 -gtg_filter.f90 -gtg_indices.f90 -gtg_smoothseams.f90 -ICAOHEIGHT.f -INITPOST.F -INITPOST_GFS.f -INITPOST_GFS_NEMS.f -INITPOST_GFS_NEMS_MPIIO.f -INITPOST_GFS_SIGIO.f -INITPOST_NEMS.f -INITPOST_NEMS_MPIIO.f -INITPOST_NETCDF.f -INITPOST_NMM.f -kinds_mod.F -LFMFLD.f -LFMFLD_GFS.f -LOOKUP.f -machine.f -map_routines.f90 -MAPSSLP.f -MASKS_mod.f -MDL2AGL.f -MDL2P.f -MDL2SIGMA2.f -MDL2SIGMA.f -MDL2THANDPV.f -MDLFLD.f -MICROINIT.F -MISCLN.f -MIXLEN.f -MPI_FIRST.f -MPI_LAST.f -MSFPS.f -native_endianness.f -NGMFLD.f -NGMSLP.f -OTLFT.f -OTLIFT.f -PARAMR.f -params.F -PARA_RANGE.f -physcons.f -PMICRPH.f -POLEAVG.f -PROCESS.f -READCNTRL.F -READ_xml.f -retrieve_index.f -RHGRD.f -RQSTFLD.F -SCLFLD.f -SELECT_CHANNELS.f -SERVER.f -SET_LVLSXML.f -SET_OUTFLDS.f -SETUP_SERVERS.f -SLP_new.f -SLP_NMM.f -SMOOTH.f -SNFRAC.f -SNFRAC_GFS.f -SOIL_mod.f -SPLINE.f -SURFCE.f -svptbl.f -TABLE.f -TABLEQ.f -TRPAUS.f -TTBLEX.f -VRBLS2D_mod.f -VRBLS3D_mod.f -VRBLS4D_mod.f -WETBULB.f -WETFRZLVL.f -wrf_io_flags.f -wrf_io_flags.h -xml_perl_data.f -ZENSUN.f -) + AllGETHERV_GSD.f + ALLOCATE_ALL.f + ASSIGNNEMSIOVAR.f + AVIATION.f + BNDLYR.f + BOUND.f + CALCAPE.f + CALDRG.f + CALDWP.f + CALGUST.f + CALHEL.f + CALLCL.f + CALMCVG.f + CALMICT.f + CALPBL.f + CALPBLREGIME.f + CALPOT.f + CALPW.f + CALRAD_WCLOUD_newcrtm.f + CALRCH.f + CALRH.f + CALRH_GFS.f + CALRH_GSD.f + CALRH_PW.f + CALSTRM.f + CALTAU.f + CALTHTE.f + CALUPDHEL.f + CALVIS.f + CALVIS_GSD.f + CALVOR.f + CALWXT_BOURG.f + CALWXT_DOMINANT.f + CALWXT_EXPLICIT.f + CALWXT.f + CALWXT_RAMER.f + CALWXT_REVISED.f + CANRES.f + CLDFRAC_ZHAO.f + CLDRAD.f + CLMAX.f + CMASSI.f + COLLECT.f + COLLECT_LOC.f + CTLBLK.f + cuparm.f + DEALLOCATE.f + DEWPOINT.f + ETCALC.f + EXCH2.f + EXCH.f + FDLVL.f + FGAMMA.f + FILL_PSETFLD.f + FIXED.f + FRZLVL2.f + FRZLVL.f + GEO_ZENITH_ANGLE.f + GET_BITS.f + GETGBANDSCATTER.f + getIVariableN.f + GETNEMSNDSCATTER.f + get_postfilename.f + getVariable.f + GFIP3.f + GFSPOST.F + GPVS.f + grib2_module.f + GRIBIT.F + GRIDAVG.f + GRIDSPEC.f + gtg_algo.f90 + gtg_compute.f90 + gtg_config.f90 + gtg_ctlblk.f90 + gtg_filter.f90 + gtg_indices.f90 + gtg_smoothseams.f90 + ICAOHEIGHT.f + INITPOST.F + INITPOST_GFS.f + INITPOST_GFS_NEMS.f + INITPOST_GFS_NEMS_MPIIO.f + INITPOST_GFS_SIGIO.f + INITPOST_NEMS.f + INITPOST_NEMS_MPIIO.f + INITPOST_NETCDF.f + INITPOST_NMM.f + kinds_mod.F + LFMFLD.f + LFMFLD_GFS.f + LOOKUP.f + machine.f + map_routines.f90 + MAPSSLP.f + MASKS_mod.f + MDL2AGL.f + MDL2P.f + MDL2SIGMA2.f + MDL2SIGMA.f + MDL2THANDPV.f + MDLFLD.f + MICROINIT.F + MISCLN.f + MIXLEN.f + MPI_FIRST.f + MPI_LAST.f + MSFPS.f + native_endianness.f + NGMFLD.f + NGMSLP.f + OTLFT.f + OTLIFT.f + PARAMR.f + params.F + PARA_RANGE.f + physcons.f + PMICRPH.f + POLEAVG.f + PROCESS.f + READCNTRL.F + READ_xml.f + retrieve_index.f + RHGRD.f + RQSTFLD.F + SCLFLD.f + SELECT_CHANNELS.f + SERVER.f + SET_LVLSXML.f + SET_OUTFLDS.f + SETUP_SERVERS.f + SLP_new.f + SLP_NMM.f + SMOOTH.f + SNFRAC.f + SNFRAC_GFS.f + SOIL_mod.f + SPLINE.f + SURFCE.f + svptbl.f + TABLE.f + TABLEQ.f + TRPAUS.f + TTBLEX.f + VRBLS2D_mod.f + VRBLS3D_mod.f + VRBLS4D_mod.f + WETBULB.f + WETFRZLVL.f + wrf_io_flags.f + wrf_io_flags.h + xml_perl_data.f + ZENSUN.f) set(EXE_SRC -CALCAPE2.f -CALHEL2.f -CALVESSEL.f -GFSPOSTSIG.F -INITPOST_GFS_NETCDF.f -MDL2STD_P.f -TIMEF.f -WRFPOST.f -getlvls.f -intio_tags.f -io_int_stubs.f -) + CALCAPE2.f + CALHEL2.f + CALVESSEL.f + GFSPOSTSIG.F + INITPOST_GFS_NETCDF.f + MDL2STD_P.f + TIMEF.f + WRFPOST.f + getlvls.f + intio_tags.f + io_int_stubs.f) set(EXE_C_SRC blockIO.c) if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") - set(CMAKE_Fortran_FLAGS "-g -traceback -fp-model source -free -convert big_endian") + set(CMAKE_Fortran_FLAGS + "-g -traceback -fp-model source -free -convert big_endian") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") - set(CMAKE_Fortran_FLAGS "-g -fbacktrace -ffree-form -ffree-line-length-none -fconvert=big-endian") + set(CMAKE_Fortran_FLAGS + "-g -fbacktrace -ffree-form -ffree-line-length-none -fconvert=big-endian") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") endif() @@ -183,7 +183,8 @@ if(APPLE) elseif(UNIX) add_compile_definitions(LINUX) endif() -add_compile_definitions("funder" "FortranByte=char" "FortranInt=int" "FortranLlong='long long'") +add_compile_definitions("funder" "FortranByte=char" "FortranInt=int" + "FortranLlong='long long'") set(LIBNAME nceppost) set(EXENAME ncep_post) @@ -191,20 +192,45 @@ set(EXENAME ncep_post) set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include") add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC}) -set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY ${module_dir}) -target_include_directories(${LIBNAME} PUBLIC ${MPI_C_INCLUDE_PATH} - ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) -target_link_libraries(${LIBNAME} sp_4 sigio_4 sfcio_4 gfsio_4 - nemsio ip_4 w3emc_4 w3nco_4 g2tmpl g2_4 crtm bacio_4 ${PNG_LIBRARIES} ${JASPER_LIBRARY}) +set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY + ${module_dir}) +target_include_directories(${LIBNAME} PUBLIC ${NETCDF_INCLUDES} ${module_dir}) +target_link_libraries( + ${LIBNAME} + sp_4 + sigio_4 + sfcio_4 + gfsio_4 + nemsio + ip_4 + w3emc_4 + w3nco_4 + g2tmpl + g2_4 + crtm + bacio_4 + MPI::MPI_Fortran + PNG::PNG + ${JASPER_LIBRARY}) -install(TARGETS ${LIBNAME} +if(OpenMP_Fortran_FOUND) + target_link_libraries(${LIBNAME} OpenMP::OpenMP_Fortran) +endif() + +install( + TARGETS ${LIBNAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) install(DIRECTORY ${module_dir} DESTINATION include) add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC}) -set_target_properties(${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) -target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) +target_link_libraries( + ${EXENAME} + ${LIBNAME} + ${NETCDF_LIBRARIES_F90} + ${NETCDF_LIBRARIES} + ${HDF5_HL_LIBRARIES} + ${HDF5_LIBRARIES} + ${CMAKE_DL_LIBS}) -install(TARGETS ${EXENAME} - RUNTIME DESTINATION bin) +install(TARGETS ${EXENAME} RUNTIME DESTINATION bin) From 5377c9ae4ce1a3725eeac14beaabaee8f66f66b2 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Sun, 23 Feb 2020 20:59:44 -0500 Subject: [PATCH 62/85] add debug gnu flags. compile_definitions does not like the quotes around long long, remove Change-Id: Iccd5bb496944f75a79500729051dd571303cb50f --- sorc/ncep_post.fd/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 1add4d1e0..31b6c9159 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -176,6 +176,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") set(CMAKE_Fortran_FLAGS "-g -fbacktrace -ffree-form -ffree-line-length-none -fconvert=big-endian") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") + set(CMAKE_Fortran_FLAGS_DEBUG"-O0 -ggdb -Wall") endif() if(APPLE) @@ -184,7 +185,7 @@ elseif(UNIX) add_compile_definitions(LINUX) endif() add_compile_definitions("funder" "FortranByte=char" "FortranInt=int" - "FortranLlong='long long'") + "FortranLlong=long long") set(LIBNAME nceppost) set(EXENAME ncep_post) From 1390d73c2f4274b3963d5fe7353b285910950da0 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Mon, 24 Feb 2020 10:53:40 -0500 Subject: [PATCH 63/85] Update CMakeLists.txt --- sorc/ncep_post.fd/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 31b6c9159..0e0c99a0f 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -176,7 +176,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") set(CMAKE_Fortran_FLAGS "-g -fbacktrace -ffree-form -ffree-line-length-none -fconvert=big-endian") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") - set(CMAKE_Fortran_FLAGS_DEBUG"-O0 -ggdb -Wall") + set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check") endif() if(APPLE) From 0dcfe64fbd474090ee85e01ad873a9c16584c4b5 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 25 Feb 2020 07:34:45 -0700 Subject: [PATCH 64/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 1b41b3a27..d168aceaf 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 1b41b3a2794f1db002a965749ccc448f135b72b7 +Subproject commit d168aceaf558e286c7ba151b7b47a70789f647a1 From a28ee5a6b09670d1b87c538fa39807b69414fd5e Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 25 Feb 2020 07:56:34 -0700 Subject: [PATCH 65/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index d168aceaf..2f3ea79a8 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit d168aceaf558e286c7ba151b7b47a70789f647a1 +Subproject commit 2f3ea79a8991ee88d772f8f20fd45583f302a47f From ac6ea1a2c7acca6dd6ffe61bc95dfc6aa884537a Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 25 Feb 2020 07:57:17 -0700 Subject: [PATCH 66/85] Add LGPL license to repository --- LICENSE.md | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..0927556b5 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,157 @@ +### GNU LESSER GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the +terms and conditions of version 3 of the GNU General Public License, +supplemented by the additional permissions listed below. + +#### 0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the +GNU General Public License. + +"The Library" refers to a covered work governed by this License, other +than an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + +The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + +#### 1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + +#### 2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + +- a) under this License, provided that you make a good faith effort + to ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or +- b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + +#### 3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from a +header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + +- a) Give prominent notice with each copy of the object code that + the Library is used in it and that the Library and its use are + covered by this License. +- b) Accompany the object code with a copy of the GNU GPL and this + license document. + +#### 4. Combined Works. + +You may convey a Combined Work under terms of your choice that, taken +together, effectively do not restrict modification of the portions of +the Library contained in the Combined Work and reverse engineering for +debugging such modifications, if you also do each of the following: + +- a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. +- b) Accompany the Combined Work with a copy of the GNU GPL and this + license document. +- c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. +- d) Do one of the following: + - 0) Convey the Minimal Corresponding Source under the terms of + this License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + - 1) Use a suitable shared library mechanism for linking with + the Library. A suitable mechanism is one that (a) uses at run + time a copy of the Library already present on the user's + computer system, and (b) will operate properly with a modified + version of the Library that is interface-compatible with the + Linked Version. +- e) Provide Installation Information, but only if you would + otherwise be required to provide such information under section 6 + of the GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the Application + with a modified version of the Linked Version. (If you use option + 4d0, the Installation Information must accompany the Minimal + Corresponding Source and Corresponding Application Code. If you + use option 4d1, you must provide the Installation Information in + the manner specified by section 6 of the GNU GPL for conveying + Corresponding Source.) + +#### 5. Combined Libraries. + +You may place library facilities that are a work based on the Library +side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + +- a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities, conveyed under the terms of this License. +- b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + +#### 6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +as you received it specifies that a certain numbered version of the +GNU Lesser General Public License "or any later version" applies to +it, you have the option of following the terms and conditions either +of that published version or of any later version published by the +Free Software Foundation. If the Library as you received it does not +specify a version number of the GNU Lesser General Public License, you +may choose any version of the GNU Lesser General Public License ever +published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. From a7cc7d834249a0d7d7e0d68a51d1122c2c91f576 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Tue, 25 Feb 2020 12:32:17 -0500 Subject: [PATCH 67/85] EMC_post is a Fortran only project. blockIO.c is not used, so do not include in building --- CMakeLists.txt | 2 +- sorc/ncep_post.fd/CMakeLists.txt | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46360a57d..29dd5f3dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ file(STRINGS "VERSION" pVersion) project( ncep_post VERSION ${pVersion} - LANGUAGES C Fortran) + LANGUAGES Fortran) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 0e0c99a0f..06f29c578 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -166,8 +166,6 @@ set(EXE_SRC intio_tags.f io_int_stubs.f) -set(EXE_C_SRC blockIO.c) - if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "-g -traceback -fp-model source -free -convert big_endian") @@ -192,7 +190,7 @@ set(EXENAME ncep_post) set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include") -add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC}) +add_library(${LIBNAME} ${LIB_SRC}) set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY ${module_dir}) target_include_directories(${LIBNAME} PUBLIC ${NETCDF_INCLUDES} ${module_dir}) @@ -224,7 +222,7 @@ install( ARCHIVE DESTINATION lib) install(DIRECTORY ${module_dir} DESTINATION include) -add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC}) +add_executable(${EXENAME} ${EXE_SRC}) target_link_libraries( ${EXENAME} ${LIBNAME} From ce2c07e17980fdd7870bbb4e3453f4de53973f8b Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 25 Feb 2020 10:49:49 -0700 Subject: [PATCH 68/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 2f3ea79a8..f90bde507 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 2f3ea79a8991ee88d772f8f20fd45583f302a47f +Subproject commit f90bde507355ee522f57e6b146bfc05c91a9afaa From 51fd76656265fb68031addc421b1fa3648f81a31 Mon Sep 17 00:00:00 2001 From: WenMeng-NOAA <48260754+WenMeng-NOAA@users.noreply.github.com> Date: Tue, 25 Feb 2020 09:34:59 -0500 Subject: [PATCH 69/85] Bug fix for unary operator in INITPOST_GFS_NEMS_MPIIO.f. (#92) --- sorc/ncep_post.fd/INITPOST_GFS_NEMS_MPIIO.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/ncep_post.fd/INITPOST_GFS_NEMS_MPIIO.f b/sorc/ncep_post.fd/INITPOST_GFS_NEMS_MPIIO.f index 104eee42b..c9c0a8772 100644 --- a/sorc/ncep_post.fd/INITPOST_GFS_NEMS_MPIIO.f +++ b/sorc/ncep_post.fd/INITPOST_GFS_NEMS_MPIIO.f @@ -1156,7 +1156,7 @@ SUBROUTINE INITPOST_GFS_NEMS_MPIIO(iostatusAER) if (j > jm-jtem+1) then npass = npass + nint(0.5*(j-jm+jtem-1)) elseif (j < jtem) then - npass = npass + nint(0.5*(jtem--j)) + npass = npass + nint(0.5*(jtem-j)) endif ! npass = 0 !$omp parallel do private(i,l,ll) From 44b27feef0e6fdc77ed19f45ea1516b24c0742be Mon Sep 17 00:00:00 2001 From: Kate Fossell Date: Tue, 25 Feb 2020 13:18:42 -0700 Subject: [PATCH 70/85] Remove old unused makefiles --- sorc/ncep_post.fd/makefile.sh | 318 ------------------------- sorc/ncep_post.fd/makefile_LINUX | 189 --------------- sorc/ncep_post.fd/makefile_Linux_gnu | 145 ----------- sorc/ncep_post.fd/makefile_Linux_intel | 145 ----------- sorc/ncep_post.fd/makefile_Linux_pgi | 145 ----------- sorc/ncep_post.fd/makefile_nems | 155 ------------ sorc/ncep_post.fd/makefile_wcoss | 188 --------------- 7 files changed, 1285 deletions(-) delete mode 100755 sorc/ncep_post.fd/makefile.sh delete mode 100644 sorc/ncep_post.fd/makefile_LINUX delete mode 100644 sorc/ncep_post.fd/makefile_Linux_gnu delete mode 100644 sorc/ncep_post.fd/makefile_Linux_intel delete mode 100644 sorc/ncep_post.fd/makefile_Linux_pgi delete mode 100644 sorc/ncep_post.fd/makefile_nems delete mode 100644 sorc/ncep_post.fd/makefile_wcoss diff --git a/sorc/ncep_post.fd/makefile.sh b/sorc/ncep_post.fd/makefile.sh deleted file mode 100755 index 4c58b6e54..000000000 --- a/sorc/ncep_post.fd/makefile.sh +++ /dev/null @@ -1,318 +0,0 @@ -#!/bin/sh -set -x -mac=$(hostname | cut -c1-1) -mac2=$(hostname | cut -c1-2) -################################# options ############################################### - export CLEAN=NO # comment this line to clean before compiling -#debug=YES # turn on debug mode - default - NO -#make_post_lib=YES # create post library - default - NO - make_post_exec=YES # create post executable - default - YES -#make_nowrf=NO # compile with wrf stub instead of WRF lib - make_nowrf=YES # compile with wrf stub instead of WRF lib -#BMPYXML=_bmpyxml # use original bumpy xml file - # make sure to clean when changing BMPXML -################################# options ############################################### -# -if [ $mac2 = ga ] ; then # For GAEA - machine=gaea - center=${center:-ncep} - make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib -elif [ $mac2 = tf ] ; then # For Theia - machine=theia - make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib -elif [ $mac = z -o $mac = h -o $mac = f ] ; then # For ZEUS - machine=zeus - make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib -elif [ $mac = t -o $mac = e -o $mac = g ] ; then # For WCOSS - machine=wcoss -elif [ $mac = l -o $mac = s ] ; then # wcoss_c (i.e. luna and surge) - export machine=wcoss_c - make_nowrf=${make_nowrf:-YES} # to compile with wrf stub instead of WRF lib -fi -debug=${debug:-NO} -export make_post_lib=${make_post_lib:-NO} -export make_post_exec=${make_post_exec:-YES} -export make_nowrf=${make_nowrf:- NO} -export BMPYXML=${BMPYXML:-""} -if [ $machine = wcoss ] ; then - export NETCDFPATH="/usrx/local/NetCDF/3.6.3" - export WRFPATH="/nwprod/sorc/wrf_shared.v1.1.0" - export NWPROD="/nwprod" - export XMLPATH=$NWPROD - export IPPATH=$NWPROD - export SPPATH=/usrx/local/nceplibs - export BACIOPATH=/usrx/local/nceplibs - export ipv="" - export spv=_v2.0.2p - export crtmv=2.0.6 - export crtmv_inc=$crtmv - export xmlv=_v2.0.0 - export baciov=_v2.0.1p - export FC=mpiifort - export CPP="/lib/cpp -P" - export CPPFLAGS="-DLINUX" - export CC=cc - if [ $debug = YES ] ; then - export OPTS="-O0 -openmp " -# export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" - export DEBUG="-g -traceback -convert big_endian -ftrapuv -check bounds -check format -check output_conversion -check pointers -check uninit -fp-stack-check" - else - export OPTS="-O3 -convert big_endian -fp-model source -openmp -xAVX" - export DEBUG="" - fi - export LIST="" - export FREE="-FR" - export TRAPS="" - export PROFILE="" - module unload ics - module load ics/14.0.1 -elif [ $machine = wcoss_c ] ; then - module unload PrgEnv-intel - module load PrgEnv-intel - module unload iobuf - module load iobuf - module unload NetCDF-intel-sandybridge/4.2 - module load NetCDF-intel-sandybridge/3.6.3 - module list - export WRFPATH="/gpfs/hps/nco/ops/nwprod/wrf_shared.v1.1.0-intel" - export FC=ftn - export CPP="/lib/cpp -P" - export CPPFLAGS="-DLINUX" - export CC=cc - if [ $debug = YES ] ; then - export OPTS="-O0 -openmp " - export DEBUG="-g -traceback -convert big_endian -ftrapuv -check bounds -check format -check output_conversion -check pointers -check uninit -fp-stack-check" - else - export OPTS="-O3 -convert big_endian -fp-model source -openmp" -# export OPTS="-O3 -convert big_endian -fp-model source -openmp -xAVX" - export DEBUG="" - fi - export LIST="" - export FREE="-FR" - export TRAPS="" - export PROFILE="" -elif [ $machine = zeus ] ; then - export NETCDFPATH="/apps/netcdf/3.6.3/intel" - export WRFPATH="/scratch2/portfolios/NCEPDEV/meso/save/Dusan.Jovic/WRFV3" - export NWPROD="/contrib/nceplibs/nwprod" - export XMLPATH="/home/Hui-Ya.Chuang" - export IPPATH=$NWPROD - export SPPATH=$NWPROD - export ipv="" - export spv=_v2.0.1 - export crtmv=2.0.7 - export FC="ifort -lmpi" - export CPP="/lib/cpp -P" - export CC=cc - export ARCH="" - export CPPFLAGS="-DLINUX" - if [ $debug = YES ] ; then - export OPTS="-O0 -openmp -g" - export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" - else - export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source -openmp" - export DEBUG="" - fi - export LIST="" - export FREE="-FR" - export TRAPS="" - export PROFILE="" -elif [ $machine = theia ] ; then - export NETCDFPATH="/apps/netcdf/4.3.0-intel" -# export WRFPATH="/scratch4/NCEPDEV/meso/save/Dusan.Jovic/WRFV3" - export WRFPATH="/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/theia/nceplibs/nwprod/lib/sorc/WRFV3" - - export NWPROD="/scratch4/NCEPDEV/global/save/Shrinivas.Moorthi/theia/nceplibs/nwprod" - export ipv=_v2.0.3 - export spv="" -##export spv=_v2.0.1 - export crtmv=2.0.7 - export gfsiov="" - export w3ev=_v2.1.0 - export w3nv="" - export xmlv=_v2.0.0 - export g2tv="" - export baciov=_v2.1.0 - -# export NWPROD="/scratch3/NCEPDEV/nwprod" -# export ipv=_v2.0.0 -# export spv=_v2.0.2 -# export crtmv=2.0.6 -# export crtmv=2.1.3 -# export gfsiov=_v1.1.0 -# export w3ev=_v2.0.5 -# export w3nv=_v2.0.6 -# export xmlv=_v2.0.0 -# export g2tv=_v1.3.0 -# export baciov=_v2.0.1 - - export XMLPATH=$NWPROD - export IPPATH=$NWPROD - export SPPATH=$NWPROD - export BACIOPATH=$NWPROD/lib - - export FC=mpiifort - export CPP="/lib/cpp -P" - export CC=cc - export ARCH="" - export CPPFLAGS="-DLINUX" - if [ $debug = YES ] ; then - export OPTS="-O0 -openmp -g" - export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" - else - export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source -openmp" -# export export OPTS="-O2 -convert big_endian -traceback -g -fp-model source " -# export export OPTS="-O2 -convert big_endian -traceback -g -fp-model source -openmp" - export DEBUG="" - fi - export LIST="" - export FREE="-FR" - export TRAPS="" - export PROFILE="" -elif [ $machine = gaea ] ; then -# export NETCDFPATH="/opt/cray/netcdf/4.1.1.0/netcdf-intel" - export NETCDFPATH="/opt/cray/netcdf/4.3.2/INTEL/140" - export WRFPATH="/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod/lib/sorc/WRFV3" -# export WRFPATH="/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod/lib/sorc/wrf_shared.v1.1.0" - export NWPROD="/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod" - export IPPATH=$NWPROD - export SPPATH=$NWPROD - export baciov=_v2.1.0 - export BACIOPATH=/lustre/f1/unswept/ncep/Shrinivas.Moorthi/nceplibs/nwprod/lib/sorc/bacio_fast_byteswap/bacio${baciov}_4 - export ipv="" - export spv=_v2.0.1 - export xmlv=_v2.0.0 - export FC=ftn - export CPP="/lib/cpp -P" - export ARCH="" - export CPPFLAGS="-DLINUX" - export CC=icc - if [ $debug = YES ] ; then - export OPTS="-O0 -g" - export DEBUG="-g -check all -ftrapuv -convert big_endian -fp-stack-check -fstack-protector -heap-arrays -recursive -traceback" - else - export export OPTS="-O3 -convert big_endian -traceback -g -fp-model source" - export DEBUG="" - fi - export LIST="" - export FREE=-FR - export TRAPS="" - export PROFILE="" - - export gfsiov="" - export crtmv=2.0.7 - export w3ev=_v2.1.0 - export w3nv="" -fi -#export gfsiov=${gfsiov:-_v1.1.0} -export crtmv=${crtmv:-2.0.7} -export crtmv_inc=${crtmv_inc:-v$crtmv} -export XMLPATH=${XMLPATH:-$NWPROD} -export BACIOPATH=${BACIOPATH:-$NWPROD/lib} -export xmlv=${xmlv:-""} -export w3ev=${w3ev:-_v2.0.3} -#export w3nv=${w3nv:-_v2.0.3} -export ipv=${ipv:-""} -export spv=${spv:-""} - -if [ ${CLEAN:-YES} = YES ] ; then make -f Makefile_new$BMPYXML clean ; fi - -export CFLAGS="-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'" -if [ $machine = wcoss_c ] ; then - if [ $make_nowrf = YES ] ; then - export WRF_INC="" - export WRF_LI="" - else - export WRF_INC="-I${WRFPATH}/external/io_quilt -I${WRFPATH}/frame" - export WRF_LIB="${WRFPATH}/main/libwrflib.a ${WRFPATH}/frame/pack_utils.o ${WRFPATH}/frame/module_internal_header_util.o ${WRFPATH}/external/io_grib1/libio_grib1.a ${WRFPATH}/external/io_grib_share/libio_grib_share.a ${WRFPATH}/external/io_int/libwrfio_int.a ${WRFPATH}/external/io_netcdf/libwrfio_nf.a ${WRFPATH}/external/esmf_time_f90/libesmf_time.a ${WRFPATH}/external/RSL_LITE/librsl_lite.a" - fi - NETCDF_LIB="${NETCDF}/lib/libnetcdf.a" - export FFLAGS="${OPTS} ${FREE} ${TRAPS} ${DEBUG} ${WRF_INC} -I${XMLPARSE_INC} -I${G2_INC4} -I${G2TMPL_INC} -I${NEMSIO_INC} -I${SIGIO_INC4} -I${SFCIO_INC4} -I${GFSIO_INC4} -I${W3EMC_INC4} -I${CRTM_INC} -I${NETCDF_INCLUDE} -I${PNG_INC}" - -#export FFLAGS="${OPTS} ${FREE} ${TRAPS} ${DEBUG} -I${WRF_INC} -I${XMLPARSE_INC} -I${G2_INC4} -I${NEMSIO_INC} -I${SIGIO_INC4} -I${SFCIO_INC4} -I${W3EMC_INC4} -I${CRTM_INC} -I${NETCDF_INCLUDE} -I${GFSIO_INC}" - - export LIBS="${XMLPARSE_LIB} ${G2TMPL_LIB} ${G2_LIB4} ${JASPER_LIB} ${PNG_LIB} ${Z_LIB} ${NEMSIO_LIB} ${GFSIO_LIB4} ${SIGIO_LIB4} ${SFCIO_LIB4} ${IP_LIB4} ${SP_LIB4} ${W3EMC_LIB4} ${W3NCO_LIB4} ${BACIO_LIB4} ${CRTM_LIB} ${WRF_LIB} ${NETCDF_LDFLAGS_F}" - -#export LIBS=" ${WRF_LIB} ${XMLPARSE_LIB} ${G2_LIB4} ${G2TMPL_LIB} ${NEMSIO_LIB} ${GFSIO_LIB4} ${SIGIO_LIB4} ${SFCIO_LIB4} ${IP_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${W3EMC_LIB4} ${BACIO_LIB4} ${CRTM_LIB} ${NETCDF_LIB} ${PNG_LIB} ${JASPER_LIB} ${Z_LIB}" -#export LIBS="${XMLPARSE_LIB} ${G2_LIB4} ${G2TMPL_LIB} ${NEMSIO_LIB} ${GFSIO_LIB4} ${SIGIO_LIB4} ${SFCIO_LIB4} ${IP_LIB4} ${SP_LIB4} ${W3NCO_LIB4} ${W3EMC_LIB4} ${BACIO_LIB4} ${CRTM_LIB} ${NETCDF_LIB} ${PNG_LIB} ${JASPER_LIB} ${Z_LIB} ${WRF_LIB}" - -else - SFCIO_INC="-I${NWPROD}/lib/incmod/sfcio_4" - SFCIO_LIB="${NWPROD}/lib/libsfcio_4.a" - -# to use new avg version - NEMSIO_INC="-I/nems/save/Jun.Wang/nceplibs/nemsio/nemsio_avg/incmod" - NEMSIO_LIB="-L/nems/save/Jun.Wang/nceplibs/nemsio/nemsio_avg -lnemsio" - -#NEMSIO_INC="-I${NWPROD}/lib/incmod/nemsio" -#NEMSIO_LIB="-L${NWPROD}/lib -lnemsio" - - BACIO_LIB="-L${BACIOPATH} -lbacio${baciov}_4" - SIGIO_INC="-I${NWPROD}/lib/incmod/sigio_4" - SIGIO_LIB="${NWPROD}/lib/libsigio_4.a" - NCDLIBS="-L${NETCDFPATH} -lnetcdf" - NCDFFLAGS="-I${NETCDFPATH}" - if [ $make_nowrf = YES ] ; then - export WRF_INC="" - export WRF_LI="" - else - export WRF_INC="-I${WRFPATH}/external/io_quilt -I${WRFPATH}/frame" - export WRF_LIB="${WRFPATH}/main/libwrflib.a \ - ${WRFPATH}/frame/pack_utils.o - ${WRFPATH}/frame/module_internal_header_util.o \ - ${WRFPATH}/external/io_grib1/libio_grib1.a \ - ${WRFPATH}/external/io_grib_share/libio_grib_share.a \ - ${WRFPATH}/external/io_int/libwrfio_int.a \ - ${WRFPATH}/external/io_netcdf/libwrfio_nf.a \ - ${WRFPATH}/external/esmf_time_f90/libesmf_time.a \ - ${WRFPATH}/external/RSL_LITE/librsl_lite.a" - fi - - G2_INC="-I${NWPROD}/lib/incmod/g2_4 -I${NWPROD}/lib/incmod/g2tmpl${g2tv}" - G2_LIB="-L${NWPROD}/lib -lg2tmpl${g2tv} -lg2_4 -ljasper -lpng -lz" - - GFSIO_INC="-I${NWPROD}/lib/incmod/gfsio${gfsiov}_4" - GFSIO_LIB="-L${NWPROD}/lib -lgfsio${gfsiov}_4" - - IP_LIB="-L${IPPATH}/lib -lip${ipv}_4" - SP_LIB="-L${SPPATH} -lsp${sp}_4" - - W3_INC="-I${NWPROD}/lib/incmod/w3emc${w3ev}_4" - W3_LIB="-L${NWPROD}/lib -lw3nco${w3nv}_4 -lw3emc${w3ev}_4" - - CRTM_INC="-I${NWPROD}/lib/incmod/crtm_${crtmv_inc}" - CRTM_LIB="-L${NWPROD}/lib -lcrtm_v${crtmv}" - XML_INC="-I${XMLPATH}/lib/incmod/xmlparse${xmlv}" - XML_LIB="-L${XMLPATH}/lib -lxmlparse${xmlv}" - - NETCDF_LIB="${NETCDFPATH}/lib/libnetcdf.a" - NETCDF_INC="-I${NETCDFPATH}/include" - - export FFLAGS="${OPTS} ${FREE} ${TRAPS} ${DEBUG} ${WRF_INC} ${XML_INC} ${G2_INC} ${NEMSIO_INC} ${GFSIO_INC} ${SIGIO_INC} ${SFCIO_INC} ${W3_INC} ${CRTM_INC} ${NETCDF_INC}" - - export LIBS="${WRF_LIB} ${XML_LIB} ${G2_LIB} ${NEMSIO_LIB} ${GFSIO_LIB} ${SIGIO_LIB} ${SFCIO_LIB} ${IP_LIB} ${SP_LIB} ${W3_LIB} ${BACIO_LIB} ${CRTM_LIB} ${NETCDF_LIB}" - -fi -if [ $make_post_lib = NO ] ; then - if [ $make_post_exec = YES ] ; then - if [ $make_nowrf = YES ] ; then - make -f Makefile_nowrf_new${BMPYXML} - else - make -f Makefile_new${BMPYXML} - fi - fi -else - if [ $make_post_exec = YES ] ; then - if [ $make_nowrf = YES ] ; then - make -f Makefile_nowrf_new${BMPYXML} - else - make -f Makefile_new${BMPYXML} - fi - fi - export POSTLIBPATH=${POSTLIBPATH:-$(pwd)} - if [ ${CLEAN:-YES} = YES ] ; then rm -rf $POSTLIBPATH/incmod/post${BMPYXML}_4 ; fi - mkdir -p $POSTLIBPATH/incmod/post${BMPYXML}_4 - make -f Makefile_lib_new${BMPYXML} -fi - - diff --git a/sorc/ncep_post.fd/makefile_LINUX b/sorc/ncep_post.fd/makefile_LINUX deleted file mode 100644 index ea698da36..000000000 --- a/sorc/ncep_post.fd/makefile_LINUX +++ /dev/null @@ -1,189 +0,0 @@ -################################################################################ -# -# Makefile for NCEP Post -# -# Use: -# make - build the executable -# make clean - start with a clean slate -# -# The following macros will be of interest: -# -# TARGET - name of the executable -# FC - name of Fortran compiler -# CPP - name of CPP -# ARCH - architecture -# CPPFLAGS - CPP flags -# OPTS - compiler code optimizations -# LIST - source listing -# SMP - threading -# TRAPS - runtime traps for floating point exceptions -# PROFILE - source code profiling ( -pg ) -# DEBUG - -g -# MEM - user data area and stack size -# MAP - load map -# W3LIB - w3lib -# BACIO - bacio lib -# ESSL - ESSL library -# MASS - MASS library -# HPMLIB - hpm lib -# SEARCH - library search location -# -# This version for eta_post with more intelligent memory allocation -# Jim Tuccillo Feb 2001 -# -# This version for eta_post with asynchronous I/O server. -# Jim Tuccillo June 2001 -# -################################################################################# -# -# Define the name of the executable -# -#TARGET = ../exec/nceppost.x -TARGET = ncep_post -# TARGET = bin_post -# -# CPP, Compiler, and Linker Options -# - - - -## WRFPATH = /misc/whome/mhu/RR13V31/trunk/WRF3.1 -WRFPATH = /mnt/lfs0/projects/wrfruc/mhu/save/WRF_release/WRFV3.2_intel_arw - -NETCDFPATH = ${NETCDF} -FC = mpif90 -CPP = /lib/cpp -C -P -DLINUX -DGSDRAPR $(FDEFS) -ARCH = -CPPFLAGS = -#OPTS = -O -qnosave -qarch=$(ARCH) -qmaxmem=-1 -NS2000 -#OPTS = -C -O -qnosave -qarch=$(ARCH) -qmaxmem=-1 -NS2000 -#OPTS = -O -g -qnosave -qarch=$(ARCH) -qmaxmem=-1 -NS2000 -bmaxdata:0x80000000 -# OPTS = -O3 -ftz -xT -fp-model precise -assume byterecl -convert big_endian -fpe0 -traceback -DLINUX -OPTS = -O3 -ftz -xT -fp-model precise -assume byterecl -fpe0 -traceback -DLINUX -LIST = -FREE = -free -#TRAPS = -qflttrap=ov:und:zero:inv:inex -qcheck -qinitauto=FF -TRAPS = -PROFILE = -DEBUG = -g -MEM = -MAP = -W3LIBDIR = ../libs -ESSL = -MASS = -NCDLIBS = -L$(NETCDFPATH)/lib -lnetcdf -NCDFFLAGS = -I$(NETCDFPATH)/include -WRFFFLAGS = -I$(WRFPATH)/external/io_quilt -CRTMFFLAGS = -I../libs/incmod/crtm2 -W3FLAGS = -I../libs/incmod -SFCFLAG = -I../libs/incmod -WRFLIB = $(WRFPATH)/main/libwrflib.a \ - $(WRFPATH)/frame/pack_utils.o \ - $(WRFPATH)/external/io_int/libwrfio_int.a \ - $(WRFPATH)/external/io_netcdf/libwrfio_nf.a \ - $(WRFPATH)/external/esmf_time_f90/libesmf_time.a \ - $(WRFPATH)/external/RSL_LITE/librsl_lite.a \ - $(WRFPATH)/external/io_grib1/libio_grib1.a \ - $(WRFPATH)/external/io_grib_share/libio_grib_share.a \ - $(WRFPATH)/external/fftpack/fftpack5/libfftpack.a -## g2 -GRB2FLAGS = -I../libs/incmod/g2_4 -I../libs/incmod/g2tmpl -XMLFLAGS = -I ./xml/xml_fortran -GRB2LIB = -L../libs -lg2tmpl -L../libs -lg2 -L$(JASPER)/lib -ljasper -lpng -lz -XMLLIB = ./xml/xml_fortran/xmlparse.a - - -CRTMLIB = - -LAPACK = -L$(MKL) -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lguide - -SEARCH = -# -# Assemble Options -# -FFLAGS = $(OPTS) $(LIST) $(TRAPS) $(PROFILE) $(DEBUG) $(NCDFFLAGS) $(WRFFLAGS) $(CRTMFFLAGS) $(W3FLAGS) $(SFCFLAG) $(GRB2FLAGS) $(XMLFLAGS) -FFLAGST = $(OPTS) $(LIST) $(FREE) $(TRAPS) $(PROFILE) $(DEBUG) $(NCDFFLAGS) $(WRFFLAGS) $(CRTMFFLAGS) $(W3FLAGS) $(SFCFLAG) $(GRB2FLAGS) $(XMLFLAGS) -LDFLAGS = $(MEM) $(MAP) $(SMP) $(PROFILE) -#LIBS = $(ESSL) $(MASS) $(SEARCH) $(NCDLIBS) $(WRFLIB) -L$(W3LIBDIR) -lw3_4 -lbacio_4 -lsp_4 -lsigio_4 -lsfcio_4 -lcrtm2 -LIBS = $(WRFLIB) $(XMLLIB) $(GRB2LIB) \ - -L../libs -lsigio_4 -lsfcio_4 \ - -lbacio_4 -lsp_4 -lcrtm2 -lw3 $(NCDLIBS) $(LAPACK) \ - -# -# -# Threaded object files -# -OBJST= wrf_io_flags.o module_internal_header_util.o getVariable.o getIVariable.o getVariableB.o getIVariableN.o getVariableRSM.o \ - kinds_mod.o gfsio_module.o nemsio_module.o machine.o physcons.o \ - count_recs_wrf_binary_file.o inventory_wrf_binary_file.o \ - next_buf.o retrieve_index.o ZENSUN.o CLDFRAC_ZHAO.o \ - GFSPOST.o GETGBANDSCATTER.o -# -# Non-threaded object files -# -OBJXML= postcntrl_t.o -# -OBJS= VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ - CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o \ - cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o getlvls.o \ - BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ - CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o CALRH_PW.o \ - CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ - CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o \ - CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ - CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o \ - DEWPOINT.o \ - FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ - GET_BITS.o GRIBIT.o INITPOST.o LFMFLD.o INITPOST_BIN.o \ - INITPOST_BIN_MPIIO.o \ - MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o MPI_FIRST.o MPI_LAST.o \ - NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ - PARA_RANGE.o PROCESS.o INITPOST_NMM.o EXCH2.o \ - READCNTRL.o READCNTRL_xml.o SCLFLD.o SERVER.o SETUP_SERVERS.o SMOOTH.o SURFCE.o \ - SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o WRFPOST.o \ - INITPOST_NMM_BIN.o CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ - ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ - INITPOST_RSM.o AVIATION.o DEALLOCATE.o INITPOST_NMM_BIN_MPIIO_IJK.o \ - CALPBL.o MDL2SIGMA2.o INITPOST_GFS.o CALRH_GFS.o LFMFLD_GFS.o CALRAD.o \ - CALRAD_WCLOUD.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ - INITPOST_NEMS.o GETNEMSNDSCATTER.o ICAOHEIGHT.o INITPOST_GFS_NEMS.o GFIP3.o \ - GRIDAVG.o CALUPDHEL.o AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o -# -# Includes -# -##INCLUDES= parm.tbl parmeta parmout parmsoil cuparm -#INCLUDES= parm.tbl cuparm -# -# Common Blocks -# -#COMMS= LOOKUP.comm RQSTFLD.comm CTLBLK.comm \ -# GRIDSPEC.comm CMASSI.comm RHGRD.comm - -#DEPS= $(COMMS) $(INCLUDES) - -.SUFFIXES: - -.SUFFIXES: .F .f .o .f90 - -.F.o: - $(CPP) $(CPPFLAGS) $< > $*.f - $(FC) -c $(FFLAGST) $*.f - rm $*.f - -$(TARGET): $(OBJST) $(OBJXML) $(OBJS) - $(FC) $(LDFLAGS) -o $@ $(OBJST) $(OBJXML) $(OBJS) $(LIBS) - -.f.o: $(OBJST) - $(FC) -c $(FFLAGST) $< - -.f90.o: $(OBJXML) - $(FC) -c $(FFLAGST) $< - -clean: - /bin/rm -f $(TARGET) *.lst *.o *.mod -# -postcntrl_t.f90 : postcntrl_t.xml - echo postcntrl_t > xmlreader.inp - ./xml/xml_fortran/xmlreader - $(FC) $(FFLAGS) postcntrl_t.f90 - diff --git a/sorc/ncep_post.fd/makefile_Linux_gnu b/sorc/ncep_post.fd/makefile_Linux_gnu deleted file mode 100644 index bede2e755..000000000 --- a/sorc/ncep_post.fd/makefile_Linux_gnu +++ /dev/null @@ -1,145 +0,0 @@ -# -# Define the name of the executable -# -TARGET = ncep_post - -# -# CPP, Compiler, and Linker Options -# -FC = mpif90 -fc=gfortran -CC = gcc -CPP = cpp -P -traditional -CPPFLAGS = -CFLAGS = -DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -OPTS = -O3 -fopenmp -FREE = -ffree-form -TRAPS = #-fcheck=bounds,do,mem,pointer,recursion -finit-real=snan -finit-integer=-100000 -ffpe-trap=overflow,zero,invalid -fbacktrace -gdwarf-2 -g -DEBUG = -g - -# -# Now the hard part. NCEPPOST needs 19 libraries, WOW!!!!! -# -NWPROD_LIB ?= ../../lib - -SFCIO_INC = -I${NWPROD_LIB}/incmod/sfcio_4 -SFCIO_LIB = ${NWPROD_LIB}/libsfcio_4.a - -NEMSIO_INC = -I${NWPROD_LIB}/incmod/nemsio -NEMSIO_LIB = -L${NWPROD_LIB} -lnemsio - -BACIO_LIB = -L${NWPROD_LIB} -lbacio_4 - -SIGIO_INC = -I${NWPROD_LIB}/incmod/sigio_4 -SIGIO_LIB = ${NWPROD_LIB}/libsigio_4.a - -WRFPATH = ${NWPROD_LIB}/WRFV3 -WRF_INC = -I$(WRFPATH)/frame -WRF_LIB = $(WRFPATH)/frame/pack_utils.o \ - $(WRFPATH)/frame/module_internal_header_util.o \ - $(WRFPATH)/external/io_grib1/libio_grib1.a \ - $(WRFPATH)/external/io_grib_share/libio_grib_share.a \ - $(WRFPATH)/external/io_int/libwrfio_int.a \ - $(WRFPATH)/external/io_netcdf/libwrfio_nf.a - -G2_INC = -I${NWPROD_LIB}/incmod/g2_4 -I${NWPROD_LIB}/incmod/g2tmpl -G2_LIB = -L${NWPROD_LIB} -lg2tmpl -lg2_4 -L${NWPROD_LIB}/jasper/lib -ljasper -L${NWPROD_LIB}/libpng/lib -lpng -L${NWPROD_LIB}/zlib/lib -lz - - -GFSIO_INC = -I${NWPROD_LIB}/incmod/gfsio_4 -GFSIO_LIB = ${NWPROD_LIB}/libgfsio_4.a - -IP_LIB = -L${NWPROD_LIB} -lip_4 - -SP_LIB = -L${NWPROD_LIB} -lsp_4 - -W3_INC = -I${NWPROD_LIB}/incmod/w3emc_4 -W3_LIB = -L${NWPROD_LIB} -lw3nco_4 -lw3emc_4 - -CRTM_INC = -I${NWPROD_LIB}/incmod/crtm -CRTM_LIB = -L${NWPROD_LIB} -lCRTM - -NETCDFPATH = ${NWPROD_LIB}/netcdf -NETCDF_LIB = $(NETCDFPATH)/lib/libnetcdff.a $(NETCDFPATH)/lib/libnetcdf.a -NETCDF_INC = -I$(NETCDFPATH)/include - -# -# Assemble Options -# -FFLAGS = $(OPTS) $(FREE) $(TRAPS) $(DEBUG) \ - $(WRF_INC) \ - $(G2_INC) \ - $(NEMSIO_INC) \ - $(GFSIO_INC) \ - $(SIGIO_INC) \ - $(SFCIO_INC) \ - $(W3_INC) \ - $(CRTM_INC) \ - $(NETCDF_INC) - -LIBS = $(WRF_LIB) \ - $(G2_LIB) \ - $(NEMSIO_LIB) \ - $(GFSIO_LIB) \ - $(SIGIO_LIB) \ - $(SFCIO_LIB) \ - $(IP_LIB) \ - $(SP_LIB) \ - $(W3_LIB) \ - $(BACIO_LIB) \ - $(CRTM_LIB) \ - $(NETCDF_LIB) - - -OBJS = wrf_io_flags.o getVariable.o getIVariable.o getIVariableN.o \ - kinds_mod.o machine.o physcons.o \ - native_endianness.o blockIO.o initialize_byte_swap_wrf_binary_file.o \ - count_recs_wrf_binary_file.o inventory_wrf_binary_file.o \ - next_buf.o retrieve_index.o ZENSUN.o CLDFRAC_ZHAO.o \ - GFSPOST.o GETGBANDSCATTER.o \ - VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ - CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o xml_perl_data.o \ - cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o \ - SET_LVLSXML.o FILL_PSETFLD.o \ - BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ - CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o \ - CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ - CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALRH_PW.o \ - CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ - CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o DEWPOINT.o \ - FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ - GET_BITS.o GRIBIT.o INITPOST.o LFMFLD.o \ - MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o MPI_FIRST.o MPI_LAST.o \ - NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ - PARA_RANGE.o PROCESS.o INITPOST_NMM.o EXCH2.o \ - READCNTRL.o READ_xml.o SET_OUTFLDS.o SCLFLD.o SERVER.o SETUP_SERVERS.o \ - SMOOTH.o SURFCE.o \ - SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o WRFPOST.o \ - CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ - ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ - AVIATION.o DEALLOCATE.o INITPOST_NMM_BIN_MPIIO.o \ - CALPBL.o MDL2SIGMA2.o INITPOST_GFS.o CALRH_GFS.o LFMFLD_GFS.o \ - CALRAD_WCLOUD_newcrtm.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ - INITPOST_NEMS.o GETNEMSNDSCATTER.o ICAOHEIGHT.o INITPOST_GFS_NEMS.o \ - INITPOST_BIN_MPIIO.o GEO_ZENITH_ANGLE.o GFIP3.o GRIDAVG.o CALUPDHEL.o INITPOST_GFS_SIGIO.o \ - AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o INITPOST_NEMS_MPIIO.o ASSIGNNEMSIOVAR.o \ - INITPOST_GFS_NEMS_MPIIO.o TIMEF.o WRF_STUBS.o - -.SUFFIXES: .F .f .o .f90 .c - -.F.f: - $(CPP) $(CPPFLAGS) $< > $*.f - -$(TARGET): $(OBJS) - $(FC) $(FFLAGS) -o $@ $(OBJS) $(LIBS) - -.f.o: - $(FC) $(FFLAGS) -c $< - -.f90.o: - $(FC) $(FFLAGS) -c $< - -.c.o : - $(CC) $(CFLAGS) -c $< - -clean: - /bin/rm -f $(TARGET) *.lst *.o *.mod diff --git a/sorc/ncep_post.fd/makefile_Linux_intel b/sorc/ncep_post.fd/makefile_Linux_intel deleted file mode 100644 index 56d6a5df4..000000000 --- a/sorc/ncep_post.fd/makefile_Linux_intel +++ /dev/null @@ -1,145 +0,0 @@ -# -# Define the name of the executable -# -TARGET = ncep_post - -# -# CPP, Compiler, and Linker Options -# -FC = mpif90 -fc=ifort -CC = icc -CPP = cpp -P -traditional -CPPFLAGS = -CFLAGS = -DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -OPTS = -O3 -openmp -FREE = -FR -TRAPS = -DEBUG = -g -traceback - -# -# Now the hard part. NCEPPOST needs 19 libraries, WOW!!!!! -# -NWPROD_LIB ?= ../../lib - -SFCIO_INC = -I${NWPROD_LIB}/incmod/sfcio_4 -SFCIO_LIB = ${NWPROD_LIB}/libsfcio_4.a - -NEMSIO_INC = -I${NWPROD_LIB}/incmod/nemsio -NEMSIO_LIB = -L${NWPROD_LIB} -lnemsio - -BACIO_LIB = -L${NWPROD_LIB} -lbacio_4 - -SIGIO_INC = -I${NWPROD_LIB}/incmod/sigio_4 -SIGIO_LIB = ${NWPROD_LIB}/libsigio_4.a - -WRFPATH = ${NWPROD_LIB}/WRFV3 -WRF_INC = -I$(WRFPATH)/frame -WRF_LIB = $(WRFPATH)/frame/pack_utils.o \ - $(WRFPATH)/frame/module_internal_header_util.o \ - $(WRFPATH)/external/io_grib1/libio_grib1.a \ - $(WRFPATH)/external/io_grib_share/libio_grib_share.a \ - $(WRFPATH)/external/io_int/libwrfio_int.a \ - $(WRFPATH)/external/io_netcdf/libwrfio_nf.a - -G2_INC = -I${NWPROD_LIB}/incmod/g2_4 -I${NWPROD_LIB}/incmod/g2tmpl -G2_LIB = -L${NWPROD_LIB} -lg2tmpl -lg2_4 -L${NWPROD_LIB}/jasper/lib -ljasper -L${NWPROD_LIB}/libpng/lib -lpng -L${NWPROD_LIB}/zlib/lib -lz - - -GFSIO_INC = -I${NWPROD_LIB}/incmod/gfsio_4 -GFSIO_LIB = ${NWPROD_LIB}/libgfsio_4.a - -IP_LIB = -L${NWPROD_LIB} -lip_4 - -SP_LIB = -L${NWPROD_LIB} -lsp_4 - -W3_INC = -I${NWPROD_LIB}/incmod/w3emc_4 -W3_LIB = -L${NWPROD_LIB} -lw3nco_4 -lw3emc_4 - -CRTM_INC = -I${NWPROD_LIB}/incmod/crtm -CRTM_LIB = -L${NWPROD_LIB} -lCRTM - -NETCDFPATH = ${NWPROD_LIB}/netcdf -NETCDF_LIB = $(NETCDFPATH)/lib/libnetcdff.a $(NETCDFPATH)/lib/libnetcdf.a -NETCDF_INC = -I$(NETCDFPATH)/include - -# -# Assemble Options -# -FFLAGS = $(OPTS) $(FREE) $(TRAPS) $(DEBUG) \ - $(WRF_INC) \ - $(G2_INC) \ - $(NEMSIO_INC) \ - $(GFSIO_INC) \ - $(SIGIO_INC) \ - $(SFCIO_INC) \ - $(W3_INC) \ - $(CRTM_INC) \ - $(NETCDF_INC) - -LIBS = $(WRF_LIB) \ - $(G2_LIB) \ - $(NEMSIO_LIB) \ - $(GFSIO_LIB) \ - $(SIGIO_LIB) \ - $(SFCIO_LIB) \ - $(IP_LIB) \ - $(SP_LIB) \ - $(W3_LIB) \ - $(BACIO_LIB) \ - $(CRTM_LIB) \ - $(NETCDF_LIB) - - -OBJS = wrf_io_flags.o getVariable.o getIVariable.o getIVariableN.o \ - kinds_mod.o machine.o physcons.o \ - native_endianness.o blockIO.o initialize_byte_swap_wrf_binary_file.o \ - count_recs_wrf_binary_file.o inventory_wrf_binary_file.o \ - next_buf.o retrieve_index.o ZENSUN.o CLDFRAC_ZHAO.o \ - GFSPOST.o GETGBANDSCATTER.o \ - VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ - CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o xml_perl_data.o \ - cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o \ - SET_LVLSXML.o FILL_PSETFLD.o \ - BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ - CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o \ - CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ - CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALRH_PW.o \ - CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ - CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o DEWPOINT.o \ - FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ - GET_BITS.o GRIBIT.o INITPOST.o LFMFLD.o \ - MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o MPI_FIRST.o MPI_LAST.o \ - NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ - PARA_RANGE.o PROCESS.o INITPOST_NMM.o EXCH2.o \ - READCNTRL.o READ_xml.o SET_OUTFLDS.o SCLFLD.o SERVER.o SETUP_SERVERS.o \ - SMOOTH.o SURFCE.o \ - SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o WRFPOST.o \ - CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ - ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ - AVIATION.o DEALLOCATE.o INITPOST_NMM_BIN_MPIIO.o \ - CALPBL.o MDL2SIGMA2.o INITPOST_GFS.o CALRH_GFS.o LFMFLD_GFS.o \ - CALRAD_WCLOUD_newcrtm.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ - INITPOST_NEMS.o GETNEMSNDSCATTER.o ICAOHEIGHT.o INITPOST_GFS_NEMS.o \ - INITPOST_BIN_MPIIO.o GEO_ZENITH_ANGLE.o GFIP3.o GRIDAVG.o CALUPDHEL.o INITPOST_GFS_SIGIO.o \ - AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o INITPOST_NEMS_MPIIO.o ASSIGNNEMSIOVAR.o \ - INITPOST_GFS_NEMS_MPIIO.o TIMEF.o WRF_STUBS.o - -.SUFFIXES: .F .f .o .f90 .c - -.F.f: - $(CPP) $(CPPFLAGS) $< > $*.f - -$(TARGET): $(OBJS) - $(FC) $(FFLAGS) -o $@ $(OBJS) $(LIBS) - -.f.o: - $(FC) $(FFLAGS) -c $< - -.f90.o: - $(FC) $(FFLAGS) -c $< - -.c.o : - $(CC) $(CFLAGS) -c $< - -clean: - /bin/rm -f $(TARGET) *.lst *.o *.mod diff --git a/sorc/ncep_post.fd/makefile_Linux_pgi b/sorc/ncep_post.fd/makefile_Linux_pgi deleted file mode 100644 index 1433ed505..000000000 --- a/sorc/ncep_post.fd/makefile_Linux_pgi +++ /dev/null @@ -1,145 +0,0 @@ -# -# Define the name of the executable -# -TARGET = ncep_post - -# -# CPP, Compiler, and Linker Options -# -FC = mpif90 -fc=pgf95 -CC = pgcc -CPP = cpp -P -traditional -CPPFLAGS = -CFLAGS = -DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -OPTS = -O3 -FREE = -Mfree -TRAPS = -DEBUG = -g -traceback - -# -# Now the hard part. NCEPPOST needs 19 libraries, WOW!!!!! -# -NWPROD_LIB ?= ../../lib - -SFCIO_INC = -I${NWPROD_LIB}/incmod/sfcio_4 -SFCIO_LIB = ${NWPROD_LIB}/libsfcio_4.a - -NEMSIO_INC = -I${NWPROD_LIB}/incmod/nemsio -NEMSIO_LIB = -L${NWPROD_LIB} -lnemsio - -BACIO_LIB = -L${NWPROD_LIB} -lbacio_4 - -SIGIO_INC = -I${NWPROD_LIB}/incmod/sigio_4 -SIGIO_LIB = ${NWPROD_LIB}/libsigio_4.a - -WRFPATH = ${NWPROD_LIB}/WRFV3 -WRF_INC = -I$(WRFPATH)/frame -WRF_LIB = $(WRFPATH)/frame/pack_utils.o \ - $(WRFPATH)/frame/module_internal_header_util.o \ - $(WRFPATH)/external/io_grib1/libio_grib1.a \ - $(WRFPATH)/external/io_grib_share/libio_grib_share.a \ - $(WRFPATH)/external/io_int/libwrfio_int.a \ - $(WRFPATH)/external/io_netcdf/libwrfio_nf.a - -G2_INC = -I${NWPROD_LIB}/incmod/g2_4 -I${NWPROD_LIB}/incmod/g2tmpl -G2_LIB = -L${NWPROD_LIB} -lg2tmpl -lg2_4 -L${NWPROD_LIB}/jasper/lib -ljasper -L${NWPROD_LIB}/libpng/lib -lpng -L${NWPROD_LIB}/zlib/lib -lz - - -GFSIO_INC = -I${NWPROD_LIB}/incmod/gfsio_4 -GFSIO_LIB = ${NWPROD_LIB}/libgfsio_4.a - -IP_LIB = -L${NWPROD_LIB} -lip_4 - -SP_LIB = -L${NWPROD_LIB} -lsp_4 - -W3_INC = -I${NWPROD_LIB}/incmod/w3emc_4 -W3_LIB = -L${NWPROD_LIB} -lw3nco_4 -lw3emc_4 - -CRTM_INC = -I${NWPROD_LIB}/incmod/crtm -CRTM_LIB = -L${NWPROD_LIB} -lCRTM - -NETCDFPATH = ${NWPROD_LIB}/netcdf -NETCDF_LIB = $(NETCDFPATH)/lib/libnetcdff.a $(NETCDFPATH)/lib/libnetcdf.a -NETCDF_INC = -I$(NETCDFPATH)/include - -# -# Assemble Options -# -FFLAGS = $(OPTS) $(FREE) $(TRAPS) $(DEBUG) \ - $(WRF_INC) \ - $(G2_INC) \ - $(NEMSIO_INC) \ - $(GFSIO_INC) \ - $(SIGIO_INC) \ - $(SFCIO_INC) \ - $(W3_INC) \ - $(CRTM_INC) \ - $(NETCDF_INC) - -LIBS = $(WRF_LIB) \ - $(G2_LIB) \ - $(NEMSIO_LIB) \ - $(GFSIO_LIB) \ - $(SIGIO_LIB) \ - $(SFCIO_LIB) \ - $(IP_LIB) \ - $(SP_LIB) \ - $(W3_LIB) \ - $(BACIO_LIB) \ - $(CRTM_LIB) \ - $(NETCDF_LIB) - - -OBJS = wrf_io_flags.o getVariable.o getIVariable.o getIVariableN.o \ - kinds_mod.o machine.o physcons.o \ - native_endianness.o blockIO.o initialize_byte_swap_wrf_binary_file.o \ - count_recs_wrf_binary_file.o inventory_wrf_binary_file.o \ - next_buf.o retrieve_index.o ZENSUN.o CLDFRAC_ZHAO.o \ - GFSPOST.o GETGBANDSCATTER.o \ - VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ - CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o xml_perl_data.o \ - cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o \ - SET_LVLSXML.o FILL_PSETFLD.o \ - BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ - CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o \ - CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ - CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALRH_PW.o \ - CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ - CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o DEWPOINT.o \ - FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ - GET_BITS.o GRIBIT.o INITPOST.o LFMFLD.o \ - MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o MPI_FIRST.o MPI_LAST.o \ - NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ - PARA_RANGE.o PROCESS.o INITPOST_NMM.o EXCH2.o \ - READCNTRL.o READ_xml.o SET_OUTFLDS.o SCLFLD.o SERVER.o SETUP_SERVERS.o \ - SMOOTH.o SURFCE.o \ - SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o WRFPOST.o \ - CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ - ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ - AVIATION.o DEALLOCATE.o INITPOST_NMM_BIN_MPIIO.o \ - CALPBL.o MDL2SIGMA2.o INITPOST_GFS.o CALRH_GFS.o LFMFLD_GFS.o \ - CALRAD_WCLOUD_newcrtm.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ - INITPOST_NEMS.o GETNEMSNDSCATTER.o ICAOHEIGHT.o INITPOST_GFS_NEMS.o \ - INITPOST_BIN_MPIIO.o GEO_ZENITH_ANGLE.o GFIP3.o GRIDAVG.o CALUPDHEL.o INITPOST_GFS_SIGIO.o \ - AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o INITPOST_NEMS_MPIIO.o ASSIGNNEMSIOVAR.o \ - INITPOST_GFS_NEMS_MPIIO.o TIMEF.o WRF_STUBS.o - -.SUFFIXES: .F .f .o .f90 .c - -.F.f: - $(CPP) $(CPPFLAGS) $< > $*.f - -$(TARGET): $(OBJS) - $(FC) $(FFLAGS) -o $@ $(OBJS) $(LIBS) - -.f.o: - $(FC) $(FFLAGS) -c $< - -.f90.o: - $(FC) $(FFLAGS) -c $< - -.c.o : - $(CC) $(CFLAGS) -c $< - -clean: - /bin/rm -f $(TARGET) *.lst *.o *.mod diff --git a/sorc/ncep_post.fd/makefile_nems b/sorc/ncep_post.fd/makefile_nems deleted file mode 100644 index e512faf6d..000000000 --- a/sorc/ncep_post.fd/makefile_nems +++ /dev/null @@ -1,155 +0,0 @@ -################################################################################ -# -# Makefile for NCEP Post -# -# Use: -# make - build the executable -# make clean - start with a clean slate -# -# The following macros will be of interest: -# -# TARGET - name of the executable -# FC - name of Fortran compiler -# CPP - name of CPP -# ARCH - architecture -# CPPFLAGS - CPP flags -# OPTS - compiler code optimizations -# LIST - source listing -# SMP - threading -# TRAPS - runtime traps for floating point exceptions -# PROFILE - source code profiling ( -pg ) -# DEBUG - -g -# MEM - user data area and stack size -# MAP - load map -# W3LIB - w3lib -# BACIO - bacio lib -# ESSL - ESSL library -# MASS - MASS library -# HPMLIB - hpm lib -# SEARCH - library search location -# -# This version for eta_post with more intelligent memory allocation -# Jim Tuccillo Feb 2001 -# -# This version for eta_post with asynchronous I/O server. -# Jim Tuccillo June 2001 - -# This version for NEMS_POST -# Jun Wang June 2010 -# -################################################################################# -# -# Define the name of the executable -# - POSTLIBPATH=.. - TARGET = ${POSTLIBPATH}/libnceppost.a - INCMOD= ${POSTLIBPATH}/incmod/post_4 - AR = ar - ARFLAGS = -rv - -# -# CPP, Compiler, and Linker Options -# - -FC = mpfort -compiler ifort -CPP = /lib/cpp -P -ARCH = auto -CPPFLAGS = -DLINUX -OPTS = -O -fp-model strict -LIST = -FREE = -FR -TRAPS = -PROFILE = -DEBUG = -g -CFLAGS = -DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -W3LIBDIR = /nwprod/lib - -CRTM_INC = -I/nwprod/lib/incmod/crtm_2.0.6 -W3_INC = -I/nwprod/lib/incmod/w3emc_v2.0.3_4 -SIGIO_INC = -I/nwprod/lib/incmod/sigio_v1.0.1_4 -GFSIO_INC = -I/nwprod/lib/incmod/gfsio_v1.1.0_4 -W3_INC = -I/nwprod/lib/incmod/w3emc_v2.0.3_4 -G2_INC = -I/nwprod/lib/incmod/g2_4 -I/nwprod/lib/incmod/g2tmpl -XML_INC = -I/nwprod/lib/incmod/xmlparse - -CRTMFFLAGS = -I/nwprod/lib/incmod/crtm_2.0.2 -SIGIOFLAG = -I/nwprod/lib/incmod/sigio_4 -GFSIOFLAG = -I/nwprod/lib/incmod/gfsio_4 - -W3FLAGS = -I/nwprod/lib/incmod/w3_v2.2.3_4 -G2TESTLIBDIR=/nco/sib/gribdev/lib -G2TMPLTESTLIBDIR=/climate/save/wx20wa/lib -XMLDIR=/climate/save/wx20wa/lib - -GRB2FLAGS = -I${G2TESTLIBDIR}/incmod/g2_4 -I${G2TMPLTESTLIBDIR}/incmod/g2tmpl -XMLFLAGS = -I${XMLDIR}/incmod/xmlparse - - - -SEARCH = -# -# Assemble Options -# -FFLAGS = $(OPTS) $(FREE) $(TRAPS) $(DEBUG) $(CRTM_INC) $(W3_INC) $(G2_INC) $(XML_INC) $(SIGIO_INC) $(GFSIO_INC) -FFLAGST = $(OPTS) $(FREE) $(TRAPS) $(DEBUG) $(CRTM_INC) $(W3_INC) $(SIGIO_INC) $(GFSIO_INC) - -# -# Threaded object files -# -OBJST= kinds_mod.o machine.o physcons.o ZENSUN.o CLDFRAC_ZHAO.o GFSPOST.o -# -# Non-threaded object files -# -OBJS= VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ - CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o \ - cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o \ - SET_LVLSXML.o FILL_PSETFLD.o \ - BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ - CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o \ - CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ - CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALRH_PW.o \ - CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ - CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o DEWPOINT.o \ - FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ - GET_BITS.o GRIBIT.o LFMFLD.o \ - MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o \ - NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ - PARA_RANGE.o PROCESS.o EXCH2.o \ - READCNTRL.o READ_xml.o SET_OUTFLDS.o SCLFLD.o \ - SMOOTH.o SURFCE.o \ - SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o \ - CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ - ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ - AVIATION.o DEALLOCATE.o \ - CALPBL.o MDL2SIGMA2.o CALRH_GFS.o LFMFLD_GFS.o \ - CALRAD_WCLOUD_newcrtm.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ - ICAOHEIGHT.o \ - GEO_ZENITH_ANGLE.o GFIP3.o GRIDAVG.o CALUPDHEL.o \ - AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o - - -.SUFFIXES: .F .f .o .f90 .c - -.F.f: - $(CPP) $(CPPFLAGS) $< > $*.f - -$(TARGET): $(OBJST) $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJST) $(OBJS) $(LIBS) - mv *.mod $(INCMOD) - -.f.o: - $(FC) $(FFLAGS) -c $< - -.f90.o: - $(FC) $(FFLAGS) -c $< - -.c.o : - ${CC} ${CFLAGS} -c $< - -clean: - /bin/rm -f $(TARGET) *.lst *.o *.mod -# -postcntrl_t.o : postcntrl_t.f90 - $(FC) $(FFLAGS) postcntrl_t.f90 - - diff --git a/sorc/ncep_post.fd/makefile_wcoss b/sorc/ncep_post.fd/makefile_wcoss deleted file mode 100644 index bce02da4b..000000000 --- a/sorc/ncep_post.fd/makefile_wcoss +++ /dev/null @@ -1,188 +0,0 @@ -# -# Define the name of the executable -# -TARGET = ../../exec/ncep_post - -# -# CPP, Compiler, and Linker Options -# -FC = mpfort -compiler ifort -CPP = /lib/cpp -P -CPPFLAGS = -DLINUX -#OPTS = -O -fp-model strict -traceback -check uninit -check bounds -check format -fpe0 -#OPTS = -O -fp-model strict -OPTS = -O0 -fp-model strict -g -traceback -FREE = -FR -TRAPS = -DEBUG = -g - -CFLAGS = -DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -# -# Now the hard part. NCEPPOST needs 19 libraries, WOW!!!!! -# - -SFCIO_VER=v1.0.0 -NEMSIO_VER=v2.2.1 -BACIO_VER=v2.0.1 -SIGIO_VER=v1.0.1 -WRF_VER=v1.1.0 -G2_VER=v2.5.0 -G2TMPL_VER=v1.3.0 -JASPER_VER=v1.900.1 -PNG_VER=v1.2.44 -Z_VER=v1.2.6 -XMLPARSE_VER=v2.0.0 -GFSIO_VER=v1.1.0 -IP_VER=v2.0.0 -SP_VER=v2.0.2 -W3EMC_VER=v2.2.0 -W3NCO_VER=v2.0.6 -CRTM_VER=v2.0.6 - -SFCIO_INC4 = -I/nwprod/lib/sfcio/$(SFCIO_VER)/incmod/sfcio_$(SFCIO_VER)_4 -SFCIO_LIB4 = /nwprod/lib/sfcio/$(SFCIO_VER)/libsfcio_${SFCIO_VER}_4.a - -NEMSIO_INC = -I/nwprod/lib/nemsio/$(NEMSIO_VER)/incmod/nemsio_$(NEMSIO_VER) -NEMSIO_LIB = /nwprod/lib/nemsio/$(NEMSIO_VER)/libnemsio_$(NEMSIO_VER).a - -BACIO_LIB4 = /nwprod/lib/bacio/$(BACIO_VER)/libbacio_$(BACIO_VER)_4.a - -SIGIO_INC4 = -I/nwprod/lib/sigio/$(SIGIO_VER)/incmod/sigio_$(SIGIO_VER)_4 -SIGIO_LIB4 = /nwprod/lib/sigio/$(SIGIO_VER)/libsigio_$(SIGIO_VER)_4.a - -WRFPATH = /nwprod/sorc/wrf_shared.$(WRF_VER) -WRF_INC = -I$(WRFPATH)/external/io_quilt -I$(WRFPATH)/frame -WRF_LIB = $(WRFPATH)/main/libwrflib.a \ - $(WRFPATH)/frame/pack_utils.o \ - $(WRFPATH)/frame/module_internal_header_util.o \ - $(WRFPATH)/external/io_grib1/libio_grib1.a \ - $(WRFPATH)/external/io_grib_share/libio_grib_share.a \ - $(WRFPATH)/external/io_int/libwrfio_int.a \ - $(WRFPATH)/external/io_netcdf/libwrfio_nf.a \ - $(WRFPATH)/external/esmf_time_f90/libesmf_time.a \ - $(WRFPATH)/external/RSL_LITE/librsl_lite.a - - -G2_INC4 = -I/nwprod/lib/g2/$(G2_VER)/incmod/g2_$(G2_VER)_4 -G2TMPL_INC = -I/nwprod/lib/g2tmpl/$(G2TMPL_VER)/incmod/g2tmpl -G2_LIB4 = /nwprod/lib/g2/$(G2_VER)/libg2_$(G2_VER)_4.a -G2TMPL_LIB = /nwprod/lib/g2tmpl/$(G2TMPL_VER)/libg2tmpl.a -JASPER_LIB = /nwprod/lib/jasper/$(JASPER_VER)/libjasper_$(JASPER_VER).a -PNG_LIB = /nwprod/lib/png/$(PNG_VER)/libpng.a -Z_LIB = /nwprod/lib/z/$(Z_VER)/libz_$(Z_VER).a - -XMLPARSE_INC = -I/nwprod/lib/xmlparse/$(XMLPARSE_VER)/incmod/xmlparse_$(XMLPARSE_VER) -XMLPARSE_LIB = /nwprod/lib/xmlparse/$(XMLPARSE_VER)/libxmlparse_$(XMLPARSE_VER).a - -GFSIO_INC4 = -I/nwprod/lib/gfsio/$(GFSIO_VER)/incmod/gfsio_$(GFSIO_VER)_4 -GFSIO_LIB4 = /nwprod/lib/gfsio/$(GFSIO_VER)/libgfsio_$(GFSIO_VER)_4.a - -IP_LIB4 = /nwprod/lib/ip/$(IP_VER)/libip_$(IP_VER)_4.a - -#SP_LIB = /gpfs/gp1/u/James.R.Taft/NWPROD/lib/libsp_4.v0001.a -SP_LIB4 = /nwprod/lib/sp/$(SP_VER)/libsp_$(SP_VER)_4.a - -W3EMC_INC4 = -I/nwprod/lib/w3emc/$(W3EMC_VER)/incmod/w3emc_$(W3EMC_VER)_4 -W3EMC_LIB4 = /nwprod/lib/w3emc/$(W3EMC_VER)/libw3emc_$(W3EMC_VER)_4.a -W3NCO_LIB4 = /nwprod/lib/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -CRTM_INC = -I/nwprod/lib/crtm/$(CRTM_VER)/incmod/crtm_$(CRTM_VER) -CRTM_LIB = /nwprod/lib/crtm/$(CRTM_VER)/libcrtm_$(CRTM_VER).a - -NETCDFPATH = /usrx/local/NetCDF/3.6.3 -NETCDF_LIB = $(NETCDFPATH)/lib/libnetcdf.a -NETCDF_INC = -I$(NETCDFPATH)/include - -# -# Assemble Options -# -FFLAGS = $(OPTS) $(FREE) $(TRAPS) $(DEBUG) \ - $(WRF_INC) \ - $(XMLPARSE_INC) \ - $(G2_INC4) \ - $(G2TMPL_INC) \ - $(NEMSIO_INC) \ - $(GFSIO_INC4) \ - $(SIGIO_INC4) \ - $(SFCIO_INC4) \ - $(W3EMC_INC4) \ - $(CRTM_INC) \ - $(NETCDF_INC) - -LIBS = $(WRF_LIB) \ - $(XMLPARSE_LIB) \ - $(G2TMPL_LIB) \ - $(G2_LIB4) \ - $(JASPER_LIB) \ - $(PNG_LIB) \ - $(Z_LIB) \ - $(NEMSIO_LIB) \ - $(GFSIO_LIB4) \ - $(SIGIO_LIB4) \ - $(SFCIO_LIB4) \ - $(IP_LIB) \ - $(SP_LIB4) \ - $(W3NCO_LIB4) \ - $(W3EMC_LIB4) \ - $(BACIO_LIB4) \ - $(CRTM_LIB) \ - $(NETCDF_LIB) - - -OBJS = wrf_io_flags.o getVariable.o getIVariable.o getIVariableN.o \ - kinds_mod.o machine.o physcons.o \ - native_endianness.o blockIO.o initialize_byte_swap_wrf_binary_file.o \ - count_recs_wrf_binary_file.o inventory_wrf_binary_file.o \ - next_buf.o retrieve_index.o ZENSUN.o CLDFRAC_ZHAO.o \ - GFSPOST.o GETGBANDSCATTER.o \ - VRBLS2D_mod.o VRBLS3D_mod.o VRBLS4D_mod.o MASKS_mod.o PMICRPH.o SOIL_mod.o \ - CMASSI.o CTLBLK.o GRIDSPEC.o LOOKUP.o PARAMR.o RHGRD.o RQSTFLD.o xml_perl_data.o \ - cuparm.o params.o svptbl.o get_postfilename.o grib2_module.o \ - SET_LVLSXML.o FILL_PSETFLD.o \ - BNDLYR.o BOUND.o CALCAPE.o CALDWP.o CALDRG.o CALHEL.o CALLCL.o \ - CALMCVG.o CALPOT.o CALPW.o CALRH.o CALRCH.o CALRH_GSD.o \ - CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVIS_GSD.o CALVOR.o CALWXT.o \ - CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALRH_PW.o \ - CALWXT_EXPLICIT.o CALWXT_DOMINANT.o \ - CLDRAD.o CLMAX.o COLLECT.o COLLECT_LOC.o DEWPOINT.o \ - FDLVL.o FGAMMA.o FIXED.o FRZLVL.o FRZLVL2.o \ - GET_BITS.o GRIBIT.o INITPOST.o LFMFLD.o \ - MAPSSLP.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o MPI_FIRST.o MPI_LAST.o \ - NGMFLD.o NGMSLP.o OTLFT.o OTLIFT.o SLP_new.o SLP_NMM.o EXCH.o \ - PARA_RANGE.o PROCESS.o INITPOST_NMM.o EXCH2.o \ - READCNTRL.o READ_xml.o SET_OUTFLDS.o SCLFLD.o SERVER.o SETUP_SERVERS.o \ - SMOOTH.o SURFCE.o \ - SPLINE.o TABLE.o TABLEQ.o TRPAUS.o TTBLEX.o WETBULB.o WRFPOST.o \ - CALMICT.o MICROINIT.o GPVS.o MDL2SIGMA.o \ - ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o SNFRAC_GFS.o \ - AVIATION.o DEALLOCATE.o INITPOST_NMM_BIN_MPIIO.o \ - CALPBL.o MDL2SIGMA2.o INITPOST_GFS.o CALRH_GFS.o LFMFLD_GFS.o \ - CALRAD_WCLOUD_newcrtm.o MDL2THANDPV.o CALPBLREGIME.o POLEAVG.o \ - INITPOST_NEMS.o GETNEMSNDSCATTER.o ICAOHEIGHT.o INITPOST_GFS_NEMS.o \ - INITPOST_BIN_MPIIO.o GEO_ZENITH_ANGLE.o GFIP3.o GRIDAVG.o CALUPDHEL.o INITPOST_GFS_SIGIO.o \ - gtg_config.o gtg_filter.o gtg_trophts.o gtg_itfa.o gtg_indices.o \ - AllGETHERV_GSD.o MSFPS.o SELECT_CHANNELS.o ALLOCATE_ALL.o INITPOST_NEMS_MPIIO.o ASSIGNNEMSIOVAR.o \ - INITPOST_GFS_NEMS_MPIIO.o - - -.SUFFIXES: .F .f .o .f90 .c - -.F.f: - $(CPP) $(CPPFLAGS) $< > $*.f - -$(TARGET): $(OBJS) - $(FC) -openmp -o $@ $(OBJST) $(OBJS) $(LIBS) - -.f.o: - $(FC) $(FFLAGS) -c $< - -.f90.o: - $(FC) $(FFLAGS) -c $< - -.c.o : - ${CC} ${CFLAGS} -c $< - - -clean: - /bin/rm -f *.lst *.o *.mod -# /bin/rm -f $(TARGET) *.lst *.o *.mod From b3ecbeda5491dd9ec52b9689f6fcd51613ee4094 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 25 Feb 2020 14:18:16 -0700 Subject: [PATCH 71/85] CMakeLists.txt: install postxconfig-NT-GFS-F00.txt and postxconfig-NT-GFS.txt in share directory --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c79d62299..cfbd02630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,5 +93,6 @@ if(NOT TARGET crtm) find_package(crtm REQUIRED) endif() - add_subdirectory(sorc/ncep_post.fd) + +install(FILES parm/postxconfig-NT-GFS.txt parm/postxconfig-NT-GFS-F00.txt DESTINATION share) \ No newline at end of file From 8718f0b9976b4ab9bf88b686f53275ff02f8b2c2 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Tue, 25 Feb 2020 16:57:14 -0500 Subject: [PATCH 72/85] Update version @fossell says post is at version 8.0.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 524cb5524..ae9a76b92 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.1 +8.0.0 From a1e6445dfaccd03468ec6ca0d86167449b791398 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 26 Feb 2020 13:07:29 -0700 Subject: [PATCH 73/85] Update submodule pointer for cmake --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index f90bde507..4db1a06b0 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit f90bde507355ee522f57e6b146bfc05c91a9afaa +Subproject commit 4db1a06b06d403c27e1516399747ef92284ec27b From 653cdc316840e71224ea5f7f60d789d7f839e43b Mon Sep 17 00:00:00 2001 From: Dusan Jovic <48258889+DusanJovic-NOAA@users.noreply.github.com> Date: Wed, 26 Feb 2020 19:23:15 -0500 Subject: [PATCH 74/85] Fix Out of Bound Exception in GFSPOST.F (#100) * Fix out-of-bound error in tpause routine in GFSPOST.F * Fix use of undefined variables. --- sorc/ncep_post.fd/GFSPOST.F | 4 ++-- sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f | 4 ++-- sorc/ncep_post.fd/INITPOST_NETCDF.f | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sorc/ncep_post.fd/GFSPOST.F b/sorc/ncep_post.fd/GFSPOST.F index 823aaf7ed..ae43a9f1b 100644 --- a/sorc/ncep_post.fd/GFSPOST.F +++ b/sorc/ncep_post.fd/GFSPOST.F @@ -419,7 +419,7 @@ subroutine tpause(km,p,u,v,t,h,ptp,utp,vtp,ttp,htp,shrtp) integer klim(2),k,kd,ktp ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! find tropopause level - call rsearch1(km-2,p(2),2,ptplim(1),klim(1)) + call rsearch1(km-2,p(2),2,ptplim,klim) klim(1)=klim(1)+1 klim(2)=klim(2)+2 ! klim(1) > klim(2) or loops does not run ; klim(2) has a @@ -519,7 +519,7 @@ subroutine mxwind(km,p,u,v,t,h,pmw,umw,vmw,tmw,hmw) real spd(km),spdmw,wmw,dhd,dhu,shrd,shru,dhmw,ub,vb,spdb ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! find maximum wind level - call rsearch1(km,p(1),2,pmwlim(1),klim(1)) + call rsearch1(km,p(1),2,pmwlim,klim) ! klim(1)=klim(1)+1 klim(2)=klim(2)+1 ! spd(klim(1):klim(2))=sqrt(u(klim(1):klim(2))**2+v(klim(1):klim(2))**2) diff --git a/sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f b/sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f index 36557b75a..914606704 100644 --- a/sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f +++ b/sorc/ncep_post.fd/INITPOST_GFS_NETCDF.f @@ -135,7 +135,7 @@ SUBROUTINE INITPOST_GFS_NETCDF(ncid3d) ! DECLARE VARIABLES. ! ! REAL fhour - integer nfhour ! forecast hour from nems io file +! integer nfhour ! forecast hour from nems io file integer fhzero !bucket real dtp !physics time step REAL RINC(5) @@ -573,7 +573,7 @@ SUBROUTINE INITPOST_GFS_NETCDF(ncid3d) deallocate(glat1d,glon1d) print*,'idate = ',(idate(i),i=1,7) - print*,'nfhour = ',nfhour +! print*,'nfhour = ',nfhour ! sample print point ii = im/2 diff --git a/sorc/ncep_post.fd/INITPOST_NETCDF.f b/sorc/ncep_post.fd/INITPOST_NETCDF.f index 9984b2388..72f51b64a 100644 --- a/sorc/ncep_post.fd/INITPOST_NETCDF.f +++ b/sorc/ncep_post.fd/INITPOST_NETCDF.f @@ -2795,7 +2795,7 @@ subroutine read_netcdf_3d_scatter(me,ncid,ifhr,im,jm,jsta,jsta_2l & ! iret = nf90_get_var(ncid,varid,dummy2,start=(/1,1,l,ifhr/), & ! count=(/im,jm,1,1/)) if (iret /= 0) then - print*,VarName,l," not found -Assigned missing values" + print*,VarName," not found -Assigned missing values" do l=1,lm do j=1,jm do i=1,im From 7e9797b355d2b86ea9e274534f86adc42e866b95 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Wed, 26 Feb 2020 19:26:06 -0500 Subject: [PATCH 75/85] Feature/cleanup (#95) * cleanup post Change-Id: Ie52af5ff79ac4122e79d7a46e89ee2077188b0a4 * we dont depend on C HDF5 library. remove. Change-Id: I26aa7c0bf7ed2783de1a9967d961d0260dee8b54 * use transitive properties. apply OpenMP flags if OpenMP is found. Formatting using cmake-format Change-Id: Ic08ce6bc85a7d949c779ec597241c8cb4c20db86 * add debug gnu flags. compile_definitions does not like the quotes around long long, remove Change-Id: Iccd5bb496944f75a79500729051dd571303cb50f * Update CMakeLists.txt * EMC_post is a Fortran only project. blockIO.c is not used, so do not include in building * Update version @fossell says post is at version 8.0.0 --- .gitignore | 10 + CMakeLists.txt | 63 +++-- VERSION | 1 + sorc/CMakeLists.txt | 1 + sorc/ncep_post.fd/CMakeLists.txt | 418 ++++++++++++++++--------------- 5 files changed, 262 insertions(+), 231 deletions(-) create mode 100644 .gitignore create mode 100644 VERSION create mode 100644 sorc/CMakeLists.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..354ebb137 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +build/ +install/ + +*.[ao] +*.mod +*.so +*.exe +*.x + +*.swp diff --git a/CMakeLists.txt b/CMakeLists.txt index cfbd02630..8a51d5a91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,32 +1,13 @@ cmake_minimum_required(VERSION 3.15) -project(ncep_post VERSION 1.1.1) -set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION} CACHE INTERNAL "${PROJECT_NAME} version number") -enable_language (Fortran) +file(STRINGS "VERSION" pVersion) -option(OPENMP "use OpenMP threading" OFF) - -if (NOT CMAKE_BUILD_TYPE) - set (CMAKE_BUILD_TYPE RELEASE CACHE STRING - "Choose the type of build, options are: PRODUCTION Debug Release." - FORCE) -endif() - -if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(IntelComp true ) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang*") - set(GNUComp true ) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*") - set(PGIComp true ) -endif() +project( + ncep_post + VERSION ${pVersion} + LANGUAGES Fortran) -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE) -if(NOT BUILD_RELEASE ) - STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) -endif() -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEBUG" BUILD_DEBUG) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) @@ -35,15 +16,33 @@ if(POLICY CMP0012) cmake_policy(SET CMP0012 NEW) endif() -find_package(MPI REQUIRED) -if(OPENMP) - find_package(OpenMP) +option(OPENMP "use OpenMP threading" OFF) + +if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE + "Release" + CACHE STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") endif() + +if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") + message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") +endif() + +find_package(MPI REQUIRED) find_package(PNG REQUIRED) find_package(ZLIB REQUIRED) -find_package(HDF5 COMPONENTS C Fortran HL REQUIRED) -find_package(NetCDF REQUIRED) find_package(Jasper REQUIRED) +find_package(HDF5 COMPONENTS Fortran HL REQUIRED) +find_package(NetCDF REQUIRED) + +if(OPENMP) + find_package(OpenMP REQUIRED COMPONENTS Fortran) +endif() + +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true) if(NOT TARGET sigio_4) find_package(sigio REQUIRED) @@ -93,6 +92,6 @@ if(NOT TARGET crtm) find_package(crtm REQUIRED) endif() -add_subdirectory(sorc/ncep_post.fd) +add_subdirectory(sorc) -install(FILES parm/postxconfig-NT-GFS.txt parm/postxconfig-NT-GFS-F00.txt DESTINATION share) \ No newline at end of file +install(FILES parm/postxconfig-NT-GFS.txt parm/postxconfig-NT-GFS-F00.txt DESTINATION share) diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..ae9a76b92 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +8.0.0 diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt new file mode 100644 index 000000000..b454c0fb2 --- /dev/null +++ b/sorc/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(ncep_post.fd) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 2b7b33c7e..06f29c578 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -1,215 +1,235 @@ - set(LIB_SRC - ${CMAKE_CURRENT_SOURCE_DIR}/AllGETHERV_GSD.f - ${CMAKE_CURRENT_SOURCE_DIR}/ALLOCATE_ALL.f - ${CMAKE_CURRENT_SOURCE_DIR}/ASSIGNNEMSIOVAR.f - ${CMAKE_CURRENT_SOURCE_DIR}/AVIATION.f - ${CMAKE_CURRENT_SOURCE_DIR}/blockIO.c - ${CMAKE_CURRENT_SOURCE_DIR}/BNDLYR.f - ${CMAKE_CURRENT_SOURCE_DIR}/BOUND.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALCAPE.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALDRG.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALDWP.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALGUST.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALHEL.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALLCL.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALMCVG.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALMICT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALPBL.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALPBLREGIME.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALPOT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALPW.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRAD_WCLOUD_newcrtm.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRCH.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRH.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GFS.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GSD.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_PW.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALSTRM.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALTAU.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALTHTE.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALUPDHEL.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALVIS.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALVIS_GSD.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALVOR.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_BOURG.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_DOMINANT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_EXPLICIT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_RAMER.f - ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_REVISED.f - ${CMAKE_CURRENT_SOURCE_DIR}/CANRES.f - ${CMAKE_CURRENT_SOURCE_DIR}/CLDFRAC_ZHAO.f - ${CMAKE_CURRENT_SOURCE_DIR}/CLDRAD.f - ${CMAKE_CURRENT_SOURCE_DIR}/CLMAX.f - ${CMAKE_CURRENT_SOURCE_DIR}/CMASSI.f - ${CMAKE_CURRENT_SOURCE_DIR}/COLLECT.f - ${CMAKE_CURRENT_SOURCE_DIR}/COLLECT_LOC.f - ${CMAKE_CURRENT_SOURCE_DIR}/CTLBLK.f - ${CMAKE_CURRENT_SOURCE_DIR}/cuparm.f - ${CMAKE_CURRENT_SOURCE_DIR}/DEALLOCATE.f - ${CMAKE_CURRENT_SOURCE_DIR}/DEWPOINT.f - ${CMAKE_CURRENT_SOURCE_DIR}/ETCALC.f - ${CMAKE_CURRENT_SOURCE_DIR}/EXCH2.f - ${CMAKE_CURRENT_SOURCE_DIR}/EXCH.f - ${CMAKE_CURRENT_SOURCE_DIR}/FDLVL.f - ${CMAKE_CURRENT_SOURCE_DIR}/FGAMMA.f - ${CMAKE_CURRENT_SOURCE_DIR}/FILL_PSETFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/FIXED.f - ${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL2.f - ${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL.f - ${CMAKE_CURRENT_SOURCE_DIR}/GEO_ZENITH_ANGLE.f - ${CMAKE_CURRENT_SOURCE_DIR}/GET_BITS.f - ${CMAKE_CURRENT_SOURCE_DIR}/GETGBANDSCATTER.f - ${CMAKE_CURRENT_SOURCE_DIR}/getIVariableN.f - ${CMAKE_CURRENT_SOURCE_DIR}/GETNEMSNDSCATTER.f - ${CMAKE_CURRENT_SOURCE_DIR}/get_postfilename.f - ${CMAKE_CURRENT_SOURCE_DIR}/getVariable.f - ${CMAKE_CURRENT_SOURCE_DIR}/GFIP3.f - ${CMAKE_CURRENT_SOURCE_DIR}/GFSPOST.F - ${CMAKE_CURRENT_SOURCE_DIR}/GPVS.f - ${CMAKE_CURRENT_SOURCE_DIR}/grib2_module.f - ${CMAKE_CURRENT_SOURCE_DIR}/GRIBIT.F - ${CMAKE_CURRENT_SOURCE_DIR}/GRIDAVG.f - ${CMAKE_CURRENT_SOURCE_DIR}/GRIDSPEC.f - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_algo.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_compute.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_config.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_ctlblk.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_filter.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_indices.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/gtg_smoothseams.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/ICAOHEIGHT.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST.F - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS_MPIIO.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_SIGIO.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS_MPIIO.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NETCDF.f - ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NMM.f - ${CMAKE_CURRENT_SOURCE_DIR}/kinds_mod.F - ${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD_GFS.f - ${CMAKE_CURRENT_SOURCE_DIR}/LOOKUP.f - ${CMAKE_CURRENT_SOURCE_DIR}/machine.f - ${CMAKE_CURRENT_SOURCE_DIR}/map_routines.f90 - ${CMAKE_CURRENT_SOURCE_DIR}/MAPSSLP.f - ${CMAKE_CURRENT_SOURCE_DIR}/MASKS_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2AGL.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2P.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA2.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDL2THANDPV.f - ${CMAKE_CURRENT_SOURCE_DIR}/MDLFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/MICROINIT.F - ${CMAKE_CURRENT_SOURCE_DIR}/MISCLN.f - ${CMAKE_CURRENT_SOURCE_DIR}/MIXLEN.f - ${CMAKE_CURRENT_SOURCE_DIR}/MPI_FIRST.f - ${CMAKE_CURRENT_SOURCE_DIR}/MPI_LAST.f - ${CMAKE_CURRENT_SOURCE_DIR}/MSFPS.f - ${CMAKE_CURRENT_SOURCE_DIR}/native_endianness.f - ${CMAKE_CURRENT_SOURCE_DIR}/NGMFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/NGMSLP.f - ${CMAKE_CURRENT_SOURCE_DIR}/OTLFT.f - ${CMAKE_CURRENT_SOURCE_DIR}/OTLIFT.f - ${CMAKE_CURRENT_SOURCE_DIR}/PARAMR.f - ${CMAKE_CURRENT_SOURCE_DIR}/params.F - ${CMAKE_CURRENT_SOURCE_DIR}/PARA_RANGE.f - ${CMAKE_CURRENT_SOURCE_DIR}/physcons.f - ${CMAKE_CURRENT_SOURCE_DIR}/PMICRPH.f - ${CMAKE_CURRENT_SOURCE_DIR}/POLEAVG.f - ${CMAKE_CURRENT_SOURCE_DIR}/PROCESS.f - ${CMAKE_CURRENT_SOURCE_DIR}/READCNTRL.F - ${CMAKE_CURRENT_SOURCE_DIR}/READ_xml.f - ${CMAKE_CURRENT_SOURCE_DIR}/retrieve_index.f - ${CMAKE_CURRENT_SOURCE_DIR}/RHGRD.f - ${CMAKE_CURRENT_SOURCE_DIR}/RQSTFLD.F - ${CMAKE_CURRENT_SOURCE_DIR}/SCLFLD.f - ${CMAKE_CURRENT_SOURCE_DIR}/SELECT_CHANNELS.f - ${CMAKE_CURRENT_SOURCE_DIR}/SERVER.f - ${CMAKE_CURRENT_SOURCE_DIR}/SET_LVLSXML.f - ${CMAKE_CURRENT_SOURCE_DIR}/SET_OUTFLDS.f - ${CMAKE_CURRENT_SOURCE_DIR}/SETUP_SERVERS.f - ${CMAKE_CURRENT_SOURCE_DIR}/SLP_new.f - ${CMAKE_CURRENT_SOURCE_DIR}/SLP_NMM.f - ${CMAKE_CURRENT_SOURCE_DIR}/SMOOTH.f - ${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC.f - ${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC_GFS.f - ${CMAKE_CURRENT_SOURCE_DIR}/SOIL_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/SPLINE.f - ${CMAKE_CURRENT_SOURCE_DIR}/SURFCE.f - ${CMAKE_CURRENT_SOURCE_DIR}/svptbl.f - ${CMAKE_CURRENT_SOURCE_DIR}/TABLE.f - ${CMAKE_CURRENT_SOURCE_DIR}/TABLEQ.f - ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS.f - ${CMAKE_CURRENT_SOURCE_DIR}/TTBLEX.f - ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS2D_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS3D_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS4D_mod.f - ${CMAKE_CURRENT_SOURCE_DIR}/WETBULB.f - ${CMAKE_CURRENT_SOURCE_DIR}/WETFRZLVL.f - ${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.f - ${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.h - ${CMAKE_CURRENT_SOURCE_DIR}/xml_perl_data.f - ${CMAKE_CURRENT_SOURCE_DIR}/ZENSUN.f) + AllGETHERV_GSD.f + ALLOCATE_ALL.f + ASSIGNNEMSIOVAR.f + AVIATION.f + BNDLYR.f + BOUND.f + CALCAPE.f + CALDRG.f + CALDWP.f + CALGUST.f + CALHEL.f + CALLCL.f + CALMCVG.f + CALMICT.f + CALPBL.f + CALPBLREGIME.f + CALPOT.f + CALPW.f + CALRAD_WCLOUD_newcrtm.f + CALRCH.f + CALRH.f + CALRH_GFS.f + CALRH_GSD.f + CALRH_PW.f + CALSTRM.f + CALTAU.f + CALTHTE.f + CALUPDHEL.f + CALVIS.f + CALVIS_GSD.f + CALVOR.f + CALWXT_BOURG.f + CALWXT_DOMINANT.f + CALWXT_EXPLICIT.f + CALWXT.f + CALWXT_RAMER.f + CALWXT_REVISED.f + CANRES.f + CLDFRAC_ZHAO.f + CLDRAD.f + CLMAX.f + CMASSI.f + COLLECT.f + COLLECT_LOC.f + CTLBLK.f + cuparm.f + DEALLOCATE.f + DEWPOINT.f + ETCALC.f + EXCH2.f + EXCH.f + FDLVL.f + FGAMMA.f + FILL_PSETFLD.f + FIXED.f + FRZLVL2.f + FRZLVL.f + GEO_ZENITH_ANGLE.f + GET_BITS.f + GETGBANDSCATTER.f + getIVariableN.f + GETNEMSNDSCATTER.f + get_postfilename.f + getVariable.f + GFIP3.f + GFSPOST.F + GPVS.f + grib2_module.f + GRIBIT.F + GRIDAVG.f + GRIDSPEC.f + gtg_algo.f90 + gtg_compute.f90 + gtg_config.f90 + gtg_ctlblk.f90 + gtg_filter.f90 + gtg_indices.f90 + gtg_smoothseams.f90 + ICAOHEIGHT.f + INITPOST.F + INITPOST_GFS.f + INITPOST_GFS_NEMS.f + INITPOST_GFS_NEMS_MPIIO.f + INITPOST_GFS_SIGIO.f + INITPOST_NEMS.f + INITPOST_NEMS_MPIIO.f + INITPOST_NETCDF.f + INITPOST_NMM.f + kinds_mod.F + LFMFLD.f + LFMFLD_GFS.f + LOOKUP.f + machine.f + map_routines.f90 + MAPSSLP.f + MASKS_mod.f + MDL2AGL.f + MDL2P.f + MDL2SIGMA2.f + MDL2SIGMA.f + MDL2THANDPV.f + MDLFLD.f + MICROINIT.F + MISCLN.f + MIXLEN.f + MPI_FIRST.f + MPI_LAST.f + MSFPS.f + native_endianness.f + NGMFLD.f + NGMSLP.f + OTLFT.f + OTLIFT.f + PARAMR.f + params.F + PARA_RANGE.f + physcons.f + PMICRPH.f + POLEAVG.f + PROCESS.f + READCNTRL.F + READ_xml.f + retrieve_index.f + RHGRD.f + RQSTFLD.F + SCLFLD.f + SELECT_CHANNELS.f + SERVER.f + SET_LVLSXML.f + SET_OUTFLDS.f + SETUP_SERVERS.f + SLP_new.f + SLP_NMM.f + SMOOTH.f + SNFRAC.f + SNFRAC_GFS.f + SOIL_mod.f + SPLINE.f + SURFCE.f + svptbl.f + TABLE.f + TABLEQ.f + TRPAUS.f + TTBLEX.f + VRBLS2D_mod.f + VRBLS3D_mod.f + VRBLS4D_mod.f + WETBULB.f + WETFRZLVL.f + wrf_io_flags.f + wrf_io_flags.h + xml_perl_data.f + ZENSUN.f) -file(GLOB EXE_SRC *.f *.f90 *.F) -file(GLOB EXE_C_SRC *.c) +set(EXE_SRC + CALCAPE2.f + CALHEL2.f + CALVESSEL.f + GFSPOSTSIG.F + INITPOST_GFS_NETCDF.f + MDL2STD_P.f + TIMEF.f + WRFPOST.f + getlvls.f + intio_tags.f + io_int_stubs.f) -list(REMOVE_ITEM EXE_SRC ${LIB_SRC}) -list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) -list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS + "-g -traceback -fp-model source -free -convert big_endian") + set(CMAKE_Fortran_FLAGS_RELEASE "-O3") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS + "-g -fbacktrace -ffree-form -ffree-line-length-none -fconvert=big-endian") + set(CMAKE_Fortran_FLAGS_RELEASE "-O3") + set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check") +endif() -if(IntelComp) - set(fortran_flags "-free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}") - set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") -elseif(GNUComp) - set(fortran_flags "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}") - if(APPLE) - set(c_flags "-DAPPLE -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") - elseif(UNIX) - set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") - endif(APPLE) -else() - message("unknown compiler!") - exit() +if(APPLE) + add_compile_definitions(APPLE) +elseif(UNIX) + add_compile_definitions(LINUX) endif() +add_compile_definitions("funder" "FortranByte=char" "FortranInt=int" + "FortranLlong=long long") -set(EXENAME ncep_post) set(LIBNAME nceppost) - -add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC}) -add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC}) - -set_source_files_properties(${EXE_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) -set_source_files_properties(${LIB_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) -set_source_files_properties(${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${c_flags}) -if(OPENMP) - set_target_properties(${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) -endif() +set(EXENAME ncep_post) set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include") -set_target_properties(${EXENAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") -set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") - -target_include_directories(${LIBNAME} PUBLIC ${MPI_C_INCLUDE_PATH} - ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) -target_link_libraries(${LIBNAME} sp_4 sigio_4 sfcio_4 gfsio_4 - nemsio ip_4 w3emc_4 w3nco_4 g2tmpl g2_4 crtm bacio_4 ${PNG_LIBRARIES} ${JASPER_LIBRARY}) +add_library(${LIBNAME} ${LIB_SRC}) +set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY + ${module_dir}) +target_include_directories(${LIBNAME} PUBLIC ${NETCDF_INCLUDES} ${module_dir}) +target_link_libraries( + ${LIBNAME} + sp_4 + sigio_4 + sfcio_4 + gfsio_4 + nemsio + ip_4 + w3emc_4 + w3nco_4 + g2tmpl + g2_4 + crtm + bacio_4 + MPI::MPI_Fortran + PNG::PNG + ${JASPER_LIBRARY}) -target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) +if(OpenMP_Fortran_FOUND) + target_link_libraries(${LIBNAME} OpenMP::OpenMP_Fortran) +endif() -install(TARGETS ${EXENAME} - RUNTIME DESTINATION bin +install( + TARGETS ${LIBNAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) +install(DIRECTORY ${module_dir} DESTINATION include) -install(TARGETS ${LIBNAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) +add_executable(${EXENAME} ${EXE_SRC}) +target_link_libraries( + ${EXENAME} + ${LIBNAME} + ${NETCDF_LIBRARIES_F90} + ${NETCDF_LIBRARIES} + ${HDF5_HL_LIBRARIES} + ${HDF5_LIBRARIES} + ${CMAKE_DL_LIBS}) -install(DIRECTORY ${module_dir} DESTINATION include_4) +install(TARGETS ${EXENAME} RUNTIME DESTINATION bin) From 065045b8e620d6735f8d368699a517be526ac5e0 Mon Sep 17 00:00:00 2001 From: WenMeng-NOAA <48260754+WenMeng-NOAA@users.noreply.github.com> Date: Wed, 26 Feb 2020 19:56:33 -0500 Subject: [PATCH 76/85] Revert "Feature/cleanup (#95)" This reverts commit 7e9797b355d2b86ea9e274534f86adc42e866b95. --- .gitignore | 10 - CMakeLists.txt | 63 ++--- VERSION | 1 - sorc/CMakeLists.txt | 1 - sorc/ncep_post.fd/CMakeLists.txt | 418 +++++++++++++++---------------- 5 files changed, 231 insertions(+), 262 deletions(-) delete mode 100644 .gitignore delete mode 100644 VERSION delete mode 100644 sorc/CMakeLists.txt diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 354ebb137..000000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -build/ -install/ - -*.[ao] -*.mod -*.so -*.exe -*.x - -*.swp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a51d5a91..cfbd02630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,32 @@ cmake_minimum_required(VERSION 3.15) +project(ncep_post VERSION 1.1.1) +set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION} CACHE INTERNAL "${PROJECT_NAME} version number") -file(STRINGS "VERSION" pVersion) +enable_language (Fortran) -project( - ncep_post - VERSION ${pVersion} - LANGUAGES Fortran) +option(OPENMP "use OpenMP threading" OFF) + +if (NOT CMAKE_BUILD_TYPE) + set (CMAKE_BUILD_TYPE RELEASE CACHE STRING + "Choose the type of build, options are: PRODUCTION Debug Release." + FORCE) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set(IntelComp true ) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang*") + set(GNUComp true ) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*") + set(PGIComp true ) +endif() -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE) +if(NOT BUILD_RELEASE ) + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) +endif() +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEBUG" BUILD_DEBUG) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) @@ -16,33 +35,15 @@ if(POLICY CMP0012) cmake_policy(SET CMP0012 NEW) endif() -option(OPENMP "use OpenMP threading" OFF) - -if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") - message(STATUS "Setting build type to 'Release' as none was specified.") - set(CMAKE_BUILD_TYPE - "Release" - CACHE STRING "Choose the type of build." FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" - "MinSizeRel" "RelWithDebInfo") -endif() - -if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") - message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") -endif() - find_package(MPI REQUIRED) +if(OPENMP) + find_package(OpenMP) +endif() find_package(PNG REQUIRED) find_package(ZLIB REQUIRED) -find_package(Jasper REQUIRED) -find_package(HDF5 COMPONENTS Fortran HL REQUIRED) +find_package(HDF5 COMPONENTS C Fortran HL REQUIRED) find_package(NetCDF REQUIRED) - -if(OPENMP) - find_package(OpenMP REQUIRED COMPONENTS Fortran) -endif() - -set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true) +find_package(Jasper REQUIRED) if(NOT TARGET sigio_4) find_package(sigio REQUIRED) @@ -92,6 +93,6 @@ if(NOT TARGET crtm) find_package(crtm REQUIRED) endif() -add_subdirectory(sorc) +add_subdirectory(sorc/ncep_post.fd) -install(FILES parm/postxconfig-NT-GFS.txt parm/postxconfig-NT-GFS-F00.txt DESTINATION share) +install(FILES parm/postxconfig-NT-GFS.txt parm/postxconfig-NT-GFS-F00.txt DESTINATION share) \ No newline at end of file diff --git a/VERSION b/VERSION deleted file mode 100644 index ae9a76b92..000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -8.0.0 diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt deleted file mode 100644 index b454c0fb2..000000000 --- a/sorc/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(ncep_post.fd) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 06f29c578..2b7b33c7e 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -1,235 +1,215 @@ + set(LIB_SRC - AllGETHERV_GSD.f - ALLOCATE_ALL.f - ASSIGNNEMSIOVAR.f - AVIATION.f - BNDLYR.f - BOUND.f - CALCAPE.f - CALDRG.f - CALDWP.f - CALGUST.f - CALHEL.f - CALLCL.f - CALMCVG.f - CALMICT.f - CALPBL.f - CALPBLREGIME.f - CALPOT.f - CALPW.f - CALRAD_WCLOUD_newcrtm.f - CALRCH.f - CALRH.f - CALRH_GFS.f - CALRH_GSD.f - CALRH_PW.f - CALSTRM.f - CALTAU.f - CALTHTE.f - CALUPDHEL.f - CALVIS.f - CALVIS_GSD.f - CALVOR.f - CALWXT_BOURG.f - CALWXT_DOMINANT.f - CALWXT_EXPLICIT.f - CALWXT.f - CALWXT_RAMER.f - CALWXT_REVISED.f - CANRES.f - CLDFRAC_ZHAO.f - CLDRAD.f - CLMAX.f - CMASSI.f - COLLECT.f - COLLECT_LOC.f - CTLBLK.f - cuparm.f - DEALLOCATE.f - DEWPOINT.f - ETCALC.f - EXCH2.f - EXCH.f - FDLVL.f - FGAMMA.f - FILL_PSETFLD.f - FIXED.f - FRZLVL2.f - FRZLVL.f - GEO_ZENITH_ANGLE.f - GET_BITS.f - GETGBANDSCATTER.f - getIVariableN.f - GETNEMSNDSCATTER.f - get_postfilename.f - getVariable.f - GFIP3.f - GFSPOST.F - GPVS.f - grib2_module.f - GRIBIT.F - GRIDAVG.f - GRIDSPEC.f - gtg_algo.f90 - gtg_compute.f90 - gtg_config.f90 - gtg_ctlblk.f90 - gtg_filter.f90 - gtg_indices.f90 - gtg_smoothseams.f90 - ICAOHEIGHT.f - INITPOST.F - INITPOST_GFS.f - INITPOST_GFS_NEMS.f - INITPOST_GFS_NEMS_MPIIO.f - INITPOST_GFS_SIGIO.f - INITPOST_NEMS.f - INITPOST_NEMS_MPIIO.f - INITPOST_NETCDF.f - INITPOST_NMM.f - kinds_mod.F - LFMFLD.f - LFMFLD_GFS.f - LOOKUP.f - machine.f - map_routines.f90 - MAPSSLP.f - MASKS_mod.f - MDL2AGL.f - MDL2P.f - MDL2SIGMA2.f - MDL2SIGMA.f - MDL2THANDPV.f - MDLFLD.f - MICROINIT.F - MISCLN.f - MIXLEN.f - MPI_FIRST.f - MPI_LAST.f - MSFPS.f - native_endianness.f - NGMFLD.f - NGMSLP.f - OTLFT.f - OTLIFT.f - PARAMR.f - params.F - PARA_RANGE.f - physcons.f - PMICRPH.f - POLEAVG.f - PROCESS.f - READCNTRL.F - READ_xml.f - retrieve_index.f - RHGRD.f - RQSTFLD.F - SCLFLD.f - SELECT_CHANNELS.f - SERVER.f - SET_LVLSXML.f - SET_OUTFLDS.f - SETUP_SERVERS.f - SLP_new.f - SLP_NMM.f - SMOOTH.f - SNFRAC.f - SNFRAC_GFS.f - SOIL_mod.f - SPLINE.f - SURFCE.f - svptbl.f - TABLE.f - TABLEQ.f - TRPAUS.f - TTBLEX.f - VRBLS2D_mod.f - VRBLS3D_mod.f - VRBLS4D_mod.f - WETBULB.f - WETFRZLVL.f - wrf_io_flags.f - wrf_io_flags.h - xml_perl_data.f - ZENSUN.f) + ${CMAKE_CURRENT_SOURCE_DIR}/AllGETHERV_GSD.f + ${CMAKE_CURRENT_SOURCE_DIR}/ALLOCATE_ALL.f + ${CMAKE_CURRENT_SOURCE_DIR}/ASSIGNNEMSIOVAR.f + ${CMAKE_CURRENT_SOURCE_DIR}/AVIATION.f + ${CMAKE_CURRENT_SOURCE_DIR}/blockIO.c + ${CMAKE_CURRENT_SOURCE_DIR}/BNDLYR.f + ${CMAKE_CURRENT_SOURCE_DIR}/BOUND.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALCAPE.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALDRG.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALDWP.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALGUST.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALHEL.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALLCL.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALMCVG.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALMICT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALPBL.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALPBLREGIME.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALPOT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALPW.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRAD_WCLOUD_newcrtm.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRCH.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRH.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GFS.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_GSD.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALRH_PW.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALSTRM.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALTAU.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALTHTE.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALUPDHEL.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALVIS.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALVIS_GSD.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALVOR.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_BOURG.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_DOMINANT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_EXPLICIT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_RAMER.f + ${CMAKE_CURRENT_SOURCE_DIR}/CALWXT_REVISED.f + ${CMAKE_CURRENT_SOURCE_DIR}/CANRES.f + ${CMAKE_CURRENT_SOURCE_DIR}/CLDFRAC_ZHAO.f + ${CMAKE_CURRENT_SOURCE_DIR}/CLDRAD.f + ${CMAKE_CURRENT_SOURCE_DIR}/CLMAX.f + ${CMAKE_CURRENT_SOURCE_DIR}/CMASSI.f + ${CMAKE_CURRENT_SOURCE_DIR}/COLLECT.f + ${CMAKE_CURRENT_SOURCE_DIR}/COLLECT_LOC.f + ${CMAKE_CURRENT_SOURCE_DIR}/CTLBLK.f + ${CMAKE_CURRENT_SOURCE_DIR}/cuparm.f + ${CMAKE_CURRENT_SOURCE_DIR}/DEALLOCATE.f + ${CMAKE_CURRENT_SOURCE_DIR}/DEWPOINT.f + ${CMAKE_CURRENT_SOURCE_DIR}/ETCALC.f + ${CMAKE_CURRENT_SOURCE_DIR}/EXCH2.f + ${CMAKE_CURRENT_SOURCE_DIR}/EXCH.f + ${CMAKE_CURRENT_SOURCE_DIR}/FDLVL.f + ${CMAKE_CURRENT_SOURCE_DIR}/FGAMMA.f + ${CMAKE_CURRENT_SOURCE_DIR}/FILL_PSETFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/FIXED.f + ${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL2.f + ${CMAKE_CURRENT_SOURCE_DIR}/FRZLVL.f + ${CMAKE_CURRENT_SOURCE_DIR}/GEO_ZENITH_ANGLE.f + ${CMAKE_CURRENT_SOURCE_DIR}/GET_BITS.f + ${CMAKE_CURRENT_SOURCE_DIR}/GETGBANDSCATTER.f + ${CMAKE_CURRENT_SOURCE_DIR}/getIVariableN.f + ${CMAKE_CURRENT_SOURCE_DIR}/GETNEMSNDSCATTER.f + ${CMAKE_CURRENT_SOURCE_DIR}/get_postfilename.f + ${CMAKE_CURRENT_SOURCE_DIR}/getVariable.f + ${CMAKE_CURRENT_SOURCE_DIR}/GFIP3.f + ${CMAKE_CURRENT_SOURCE_DIR}/GFSPOST.F + ${CMAKE_CURRENT_SOURCE_DIR}/GPVS.f + ${CMAKE_CURRENT_SOURCE_DIR}/grib2_module.f + ${CMAKE_CURRENT_SOURCE_DIR}/GRIBIT.F + ${CMAKE_CURRENT_SOURCE_DIR}/GRIDAVG.f + ${CMAKE_CURRENT_SOURCE_DIR}/GRIDSPEC.f + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_algo.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_compute.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_config.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_ctlblk.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_filter.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_indices.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/gtg_smoothseams.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/ICAOHEIGHT.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST.F + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_NEMS_MPIIO.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_GFS_SIGIO.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NEMS_MPIIO.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NETCDF.f + ${CMAKE_CURRENT_SOURCE_DIR}/INITPOST_NMM.f + ${CMAKE_CURRENT_SOURCE_DIR}/kinds_mod.F + ${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/LFMFLD_GFS.f + ${CMAKE_CURRENT_SOURCE_DIR}/LOOKUP.f + ${CMAKE_CURRENT_SOURCE_DIR}/machine.f + ${CMAKE_CURRENT_SOURCE_DIR}/map_routines.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/MAPSSLP.f + ${CMAKE_CURRENT_SOURCE_DIR}/MASKS_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2AGL.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2P.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA2.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2SIGMA.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDL2THANDPV.f + ${CMAKE_CURRENT_SOURCE_DIR}/MDLFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/MICROINIT.F + ${CMAKE_CURRENT_SOURCE_DIR}/MISCLN.f + ${CMAKE_CURRENT_SOURCE_DIR}/MIXLEN.f + ${CMAKE_CURRENT_SOURCE_DIR}/MPI_FIRST.f + ${CMAKE_CURRENT_SOURCE_DIR}/MPI_LAST.f + ${CMAKE_CURRENT_SOURCE_DIR}/MSFPS.f + ${CMAKE_CURRENT_SOURCE_DIR}/native_endianness.f + ${CMAKE_CURRENT_SOURCE_DIR}/NGMFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/NGMSLP.f + ${CMAKE_CURRENT_SOURCE_DIR}/OTLFT.f + ${CMAKE_CURRENT_SOURCE_DIR}/OTLIFT.f + ${CMAKE_CURRENT_SOURCE_DIR}/PARAMR.f + ${CMAKE_CURRENT_SOURCE_DIR}/params.F + ${CMAKE_CURRENT_SOURCE_DIR}/PARA_RANGE.f + ${CMAKE_CURRENT_SOURCE_DIR}/physcons.f + ${CMAKE_CURRENT_SOURCE_DIR}/PMICRPH.f + ${CMAKE_CURRENT_SOURCE_DIR}/POLEAVG.f + ${CMAKE_CURRENT_SOURCE_DIR}/PROCESS.f + ${CMAKE_CURRENT_SOURCE_DIR}/READCNTRL.F + ${CMAKE_CURRENT_SOURCE_DIR}/READ_xml.f + ${CMAKE_CURRENT_SOURCE_DIR}/retrieve_index.f + ${CMAKE_CURRENT_SOURCE_DIR}/RHGRD.f + ${CMAKE_CURRENT_SOURCE_DIR}/RQSTFLD.F + ${CMAKE_CURRENT_SOURCE_DIR}/SCLFLD.f + ${CMAKE_CURRENT_SOURCE_DIR}/SELECT_CHANNELS.f + ${CMAKE_CURRENT_SOURCE_DIR}/SERVER.f + ${CMAKE_CURRENT_SOURCE_DIR}/SET_LVLSXML.f + ${CMAKE_CURRENT_SOURCE_DIR}/SET_OUTFLDS.f + ${CMAKE_CURRENT_SOURCE_DIR}/SETUP_SERVERS.f + ${CMAKE_CURRENT_SOURCE_DIR}/SLP_new.f + ${CMAKE_CURRENT_SOURCE_DIR}/SLP_NMM.f + ${CMAKE_CURRENT_SOURCE_DIR}/SMOOTH.f + ${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC.f + ${CMAKE_CURRENT_SOURCE_DIR}/SNFRAC_GFS.f + ${CMAKE_CURRENT_SOURCE_DIR}/SOIL_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/SPLINE.f + ${CMAKE_CURRENT_SOURCE_DIR}/SURFCE.f + ${CMAKE_CURRENT_SOURCE_DIR}/svptbl.f + ${CMAKE_CURRENT_SOURCE_DIR}/TABLE.f + ${CMAKE_CURRENT_SOURCE_DIR}/TABLEQ.f + ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS.f + ${CMAKE_CURRENT_SOURCE_DIR}/TTBLEX.f + ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS2D_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS3D_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/VRBLS4D_mod.f + ${CMAKE_CURRENT_SOURCE_DIR}/WETBULB.f + ${CMAKE_CURRENT_SOURCE_DIR}/WETFRZLVL.f + ${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.f + ${CMAKE_CURRENT_SOURCE_DIR}/wrf_io_flags.h + ${CMAKE_CURRENT_SOURCE_DIR}/xml_perl_data.f + ${CMAKE_CURRENT_SOURCE_DIR}/ZENSUN.f) -set(EXE_SRC - CALCAPE2.f - CALHEL2.f - CALVESSEL.f - GFSPOSTSIG.F - INITPOST_GFS_NETCDF.f - MDL2STD_P.f - TIMEF.f - WRFPOST.f - getlvls.f - intio_tags.f - io_int_stubs.f) +file(GLOB EXE_SRC *.f *.f90 *.F) +file(GLOB EXE_C_SRC *.c) -if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") - set(CMAKE_Fortran_FLAGS - "-g -traceback -fp-model source -free -convert big_endian") - set(CMAKE_Fortran_FLAGS_RELEASE "-O3") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") - set(CMAKE_Fortran_FLAGS - "-g -fbacktrace -ffree-form -ffree-line-length-none -fconvert=big-endian") - set(CMAKE_Fortran_FLAGS_RELEASE "-O3") - set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check") -endif() +list(REMOVE_ITEM EXE_SRC ${LIB_SRC}) +list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/TRPAUS_NAM.f) +list(REMOVE_ITEM EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/WRF_STUBS.f) -if(APPLE) - add_compile_definitions(APPLE) -elseif(UNIX) - add_compile_definitions(LINUX) +if(IntelComp) + set(fortran_flags "-free -O3 -convert big_endian -traceback -g -fp-model source ${OpenMP_Fortran_FLAGS}") + set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") +elseif(GNUComp) + set(fortran_flags "-ffree-form -ffree-line-length-none -fconvert=big-endian -fbacktrace -g ${OpenMP_Fortran_FLAGS}") + if(APPLE) + set(c_flags "-DAPPLE -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") + elseif(UNIX) + set(c_flags "-DLINUX -Dfunder -DFortranByte=char -DFortranInt=int -DFortranLlong='long long'") + endif(APPLE) +else() + message("unknown compiler!") + exit() endif() -add_compile_definitions("funder" "FortranByte=char" "FortranInt=int" - "FortranLlong=long long") -set(LIBNAME nceppost) set(EXENAME ncep_post) +set(LIBNAME nceppost) + +add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC}) +add_library(${LIBNAME} ${LIB_SRC} ${EXE_C_SRC}) + +set_source_files_properties(${EXE_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) +set_source_files_properties(${LIB_SRC} PROPERTIES COMPILE_FLAGS ${fortran_flags}) +set_source_files_properties(${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${c_flags}) +if(OPENMP) + set_target_properties(${EXENAME} PROPERTIES LINK_FLAGS ${OpenMP_Fortran_FLAGS}) +endif() set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include") +set_target_properties(${EXENAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") +set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") -add_library(${LIBNAME} ${LIB_SRC}) -set_target_properties(${LIBNAME} PROPERTIES Fortran_MODULE_DIRECTORY - ${module_dir}) -target_include_directories(${LIBNAME} PUBLIC ${NETCDF_INCLUDES} ${module_dir}) -target_link_libraries( - ${LIBNAME} - sp_4 - sigio_4 - sfcio_4 - gfsio_4 - nemsio - ip_4 - w3emc_4 - w3nco_4 - g2tmpl - g2_4 - crtm - bacio_4 - MPI::MPI_Fortran - PNG::PNG - ${JASPER_LIBRARY}) +target_include_directories(${LIBNAME} PUBLIC ${MPI_C_INCLUDE_PATH} + ${MPI_Fortran_INCLUDE_PATH} ${NETCDF_INCLUDES} ${module_dir}) -if(OpenMP_Fortran_FOUND) - target_link_libraries(${LIBNAME} OpenMP::OpenMP_Fortran) -endif() +target_link_libraries(${LIBNAME} sp_4 sigio_4 sfcio_4 gfsio_4 + nemsio ip_4 w3emc_4 w3nco_4 g2tmpl g2_4 crtm bacio_4 ${PNG_LIBRARIES} ${JASPER_LIBRARY}) + +target_link_libraries(${EXENAME} ${LIBNAME} ${OpenMP_Fortran_FLAGS} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${CMAKE_DL_LIBS} ) -install( - TARGETS ${LIBNAME} +install(TARGETS ${EXENAME} + RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -install(DIRECTORY ${module_dir} DESTINATION include) -add_executable(${EXENAME} ${EXE_SRC}) -target_link_libraries( - ${EXENAME} - ${LIBNAME} - ${NETCDF_LIBRARIES_F90} - ${NETCDF_LIBRARIES} - ${HDF5_HL_LIBRARIES} - ${HDF5_LIBRARIES} - ${CMAKE_DL_LIBS}) +install(TARGETS ${LIBNAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) -install(TARGETS ${EXENAME} RUNTIME DESTINATION bin) +install(DIRECTORY ${module_dir} DESTINATION include_4) From 3b7871aced3f2eb562939547609ad3945b6e9622 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 27 Feb 2020 10:08:07 -0500 Subject: [PATCH 77/85] remove unused compile definitions and update cmake pointer Change-Id: Ie47cf16ebc25928bf30bfd05d4f25678219571a6 --- cmake | 2 +- sorc/ncep_post.fd/CMakeLists.txt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake b/cmake index f90bde507..4db1a06b0 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit f90bde507355ee522f57e6b146bfc05c91a9afaa +Subproject commit 4db1a06b06d403c27e1516399747ef92284ec27b diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 06f29c578..329d97323 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -182,8 +182,6 @@ if(APPLE) elseif(UNIX) add_compile_definitions(LINUX) endif() -add_compile_definitions("funder" "FortranByte=char" "FortranInt=int" - "FortranLlong=long long") set(LIBNAME nceppost) set(EXENAME ncep_post) From bb210d4b893d78cc9f56e8efcd9d6d819bc2e1f9 Mon Sep 17 00:00:00 2001 From: Tracy Date: Fri, 24 Jan 2020 13:53:57 -0700 Subject: [PATCH 78/85] Fix ID index in WRF-CHEM SMOKE block, which currently causes failed build in debug mode --- sorc/ncep_post.fd/MDL2P.f | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sorc/ncep_post.fd/MDL2P.f b/sorc/ncep_post.fd/MDL2P.f index bd948b895..d2f5c13c1 100644 --- a/sorc/ncep_post.fd/MDL2P.f +++ b/sorc/ncep_post.fd/MDL2P.f @@ -2090,9 +2090,9 @@ SUBROUTINE MDL2P(iostatusD3D) ENDDO ENDDO if(grib == 'grib1')then - ID(1:46)=0 + ID(1:25)=0 ID(02)=141 ! Parameter Table 141 - ID(36)=2 +! ID(36)=2 CALL GRIBIT(IGET(738),LP,GRID1,IM,JM) elseif(grib == 'grib2') then cfld = cfld + 1 From 06e204f12b42bb91feea76f3dfc80c1c8bc76ec7 Mon Sep 17 00:00:00 2001 From: Kate Fossell Date: Thu, 27 Feb 2020 11:55:49 -0700 Subject: [PATCH 79/85] remove unnecessary commented line --- sorc/ncep_post.fd/MDL2P.f | 1 - 1 file changed, 1 deletion(-) diff --git a/sorc/ncep_post.fd/MDL2P.f b/sorc/ncep_post.fd/MDL2P.f index d2f5c13c1..9f631b3da 100644 --- a/sorc/ncep_post.fd/MDL2P.f +++ b/sorc/ncep_post.fd/MDL2P.f @@ -2092,7 +2092,6 @@ SUBROUTINE MDL2P(iostatusD3D) if(grib == 'grib1')then ID(1:25)=0 ID(02)=141 ! Parameter Table 141 -! ID(36)=2 CALL GRIBIT(IGET(738),LP,GRID1,IM,JM) elseif(grib == 'grib2') then cfld = cfld + 1 From 5857e0b0fa7f6a4c18239b5eeb49d7906d59970b Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 27 Feb 2020 19:32:40 -0700 Subject: [PATCH 80/85] NetCDF static fix (#1) * CMakeLists.txt: add MODULE to find_package calls * Cleanup of NetCDF in CMakeLists.txt --- CMakeLists.txt | 2 -- sorc/ncep_post.fd/CMakeLists.txt | 3 --- 2 files changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a51d5a91..0079b96ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,9 +33,7 @@ endif() find_package(MPI REQUIRED) find_package(PNG REQUIRED) -find_package(ZLIB REQUIRED) find_package(Jasper REQUIRED) -find_package(HDF5 COMPONENTS Fortran HL REQUIRED) find_package(NetCDF REQUIRED) if(OPENMP) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index 329d97323..efe1b2822 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -224,10 +224,7 @@ add_executable(${EXENAME} ${EXE_SRC}) target_link_libraries( ${EXENAME} ${LIBNAME} - ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} - ${HDF5_HL_LIBRARIES} - ${HDF5_LIBRARIES} ${CMAKE_DL_LIBS}) install(TARGETS ${EXENAME} RUNTIME DESTINATION bin) From 4bad862b168c1fde5b047862c220529e667c0942 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 27 Feb 2020 21:36:52 -0500 Subject: [PATCH 81/85] update cmake submodule pointer Change-Id: I763882fd6ecc4b8cc64a60eddabccfdb7046040d --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 4db1a06b0..994d66f7a 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 4db1a06b06d403c27e1516399747ef92284ec27b +Subproject commit 994d66f7a0ec252d6270e637cecaad9686184cce From 7fc3c7334c8175155175db65f558ca80cab14276 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 28 Feb 2020 18:50:52 -0700 Subject: [PATCH 82/85] Add MODULE to find_package(NetCDF) call (#3) --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0079b96ed..8b3a8ebe0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ endif() find_package(MPI REQUIRED) find_package(PNG REQUIRED) find_package(Jasper REQUIRED) -find_package(NetCDF REQUIRED) +find_package(NetCDF MODULE REQUIRED) if(OPENMP) find_package(OpenMP REQUIRED COMPONENTS Fortran) From 373063a3bef72f65fd005710e380dafce1cd02d7 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 28 Feb 2020 21:00:10 -0500 Subject: [PATCH 83/85] update cmake submodule pointer Change-Id: I69015efa425658645567e9d9f22d5e51301c1a0b --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 994d66f7a..b605db0df 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 994d66f7a0ec252d6270e637cecaad9686184cce +Subproject commit b605db0df4f8fb1110aaba989dbffad5312752b9 From 54c21e6a8fe5eb5132e42b2acff8698183202aac Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 9 Mar 2020 09:43:09 -0600 Subject: [PATCH 84/85] Change version from 8.0.0 to 1.0.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ae9a76b92..3eefcb9dd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.0.0 +1.0.0 From acc33bb578152374ae89ce45f41a01d7d79b5dd8 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 21 May 2020 22:08:39 +0000 Subject: [PATCH 85/85] fix the install path of compiled Fortran module files --- sorc/ncep_post.fd/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/ncep_post.fd/CMakeLists.txt b/sorc/ncep_post.fd/CMakeLists.txt index efe1b2822..e3cd549bb 100644 --- a/sorc/ncep_post.fd/CMakeLists.txt +++ b/sorc/ncep_post.fd/CMakeLists.txt @@ -218,7 +218,7 @@ install( TARGETS ${LIBNAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -install(DIRECTORY ${module_dir} DESTINATION include) +install(DIRECTORY ${module_dir} DESTINATION ${CMAKE_INSTALL_PREFIX}) add_executable(${EXENAME} ${EXE_SRC}) target_link_libraries(