-
Notifications
You must be signed in to change notification settings - Fork 65
Testing refactor #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing refactor #612
Changes from 112 commits
bcf4097
340c2f9
1285ea9
c707b20
fd66d0f
278b2bd
9ce27bf
68f2575
c256bed
e7f84f4
c886348
20feac2
efff984
84cdd96
cc43fda
890ea0e
cfe3921
9b66008
df44e3a
585405f
afee04c
8270b07
96dd11a
d4c4fb8
ad60987
5346e6a
d536aa7
eee0f1d
9f90b8e
c0ccfaf
84a2e3e
b447039
d6218a3
6959e43
2fe885b
4b15859
cfb1fdb
4006597
fc79f04
e802031
082c332
dfc0ec1
c0e01f1
b4d3ae1
d8a5731
9f82c57
8b5ead1
cfe8c54
a801b9a
ce104f9
a5c6884
a9a21c6
a1bbde0
af03ea5
15646da
8155f81
f5b4af2
1e38c9f
675dec7
4deed39
9603f77
48e2f2a
f4fab29
7e8ea47
8c5ee10
6fb121e
a175756
017da94
f11f92d
142381e
1d0d0db
a3fd180
2ba46ea
74bde66
40ecc20
d1e5195
6b6a410
bd52ac5
32b75e6
f45f3fd
29b657d
d0e1095
c8b3568
3c896c4
7b96750
1f30515
cf398b5
dfa3bf0
2071507
23f6ce7
eda7676
fd9d58e
fe9da6e
00fc8a9
6ff1205
4b7f00e
6f87d73
1df0d8a
9533fca
850a295
d3a2eb2
c5a615d
20956e6
b52536a
ab128aa
0cb54ce
5a4b60b
996c108
fd910da
8b33cb8
674de31
ebff27f
e10df98
6cfd499
b8f5334
461f42e
9e8498e
cda0028
3013128
da2d9d2
d2577a2
75cbe98
ca34e38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,46 +4,108 @@ project(ccpp_framework | |
| VERSION 5.0.0 | ||
| LANGUAGES Fortran) | ||
|
|
||
| include(cmake/ccpp_capgen.cmake) | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set package definitions | ||
| set(PACKAGE "ccpp-framework") | ||
| set(AUTHORS "Dom Heinzeller" "Grant Firl" "Mike Kavulich" "Dustin Swales" "Courtney Peverley") | ||
|
||
| string(TIMESTAMP YEAR "%Y") | ||
|
|
||
| option(CCPP_FRAMEWORK_BUILD_DOCUMENTATION | ||
| "Create and install the HTML documentation (requires Doxygen)" OFF) | ||
peverwhee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| option(OPENMP "Enable OpenMP support for the framework" OFF) | ||
| option(CCPP_FRAMEWORK_ENABLE_TESTS "Enable building/running CCPP regression tests" OFF) | ||
climbfuji marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| option(CCPP_RUN_ADVECTION_TEST "Enable advection regression test" OFF) | ||
| option(CCPP_RUN_CAPGEN_TEST "Enable capgen regression test" OFF) | ||
| option(CCPP_RUN_DDT_HOST_TEST "Enable ddt host regression test" OFF) | ||
| option(CCPP_RUN_VAR_COMPATIBILITY_TEST "Enable variable compatibility regression test" OFF) | ||
| option(BUILD_SHARED_LIBS "Build a static library" OFF) | ||
climbfuji marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| set(CCPP_VERBOSITY "0" CACHE STRING "Verbosity level of output (default: 0)") | ||
|
|
||
| # Warn user on conflicting test options | ||
| if(CCPP_RUN_ADVECTION_TEST OR | ||
| CCPP_RUN_CAPGEN_TEST OR | ||
| CCPP_RUN_DDT_HOST_TEST OR | ||
| CCPP_RUN_VAR_COMPATIBILITY_TEST) | ||
| set(CCPP_MANUALLY_DECLARED_TEST ON BOOL) | ||
| endif() | ||
| if(CCPP_MANUALLY_DECLARED_TEST AND CCPP_FRAMEWORK_ENABLE_TESTS) | ||
| message(WARNING "Detected a manual test flag and the flag to run all tests. If only expected to run a single test, please unset CCPP_FRAMEWORK_ENABLE_TESTS option.") | ||
| endif() | ||
| set(CCPP_RUNNING_TESTS CCPP_FRAMEWORK_ENABLE_TESTS OR CCPP_MANUALLY_DECLARED_TEST) | ||
|
|
||
| # If running tests, set appropriate flags to help with debugging test issues. | ||
| if(CCPP_RUNNING_TESTS) | ||
| if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") | ||
| ADD_COMPILE_OPTIONS(-fcheck=all) | ||
| ADD_COMPILE_OPTIONS(-fbacktrace) | ||
| ADD_COMPILE_OPTIONS(-ffpe-trap=zero) | ||
| ADD_COMPILE_OPTIONS(-finit-real=nan) | ||
| ADD_COMPILE_OPTIONS(-ggdb) | ||
| ADD_COMPILE_OPTIONS(-ffree-line-length-none) | ||
| ADD_COMPILE_OPTIONS(-cpp) | ||
| elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") | ||
| ADD_COMPILE_OPTIONS(-fpe0) | ||
| ADD_COMPILE_OPTIONS(-warn) | ||
| ADD_COMPILE_OPTIONS(-traceback) | ||
| ADD_COMPILE_OPTIONS(-debug extended) | ||
| ADD_COMPILE_OPTIONS(-fpp) | ||
| ADD_COMPILE_OPTIONS(-diag-disable=10448) | ||
| elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM") | ||
| ADD_COMPILE_OPTIONS(-fpe0) | ||
| ADD_COMPILE_OPTIONS(-warn) | ||
| ADD_COMPILE_OPTIONS(-traceback) | ||
| ADD_COMPILE_OPTIONS(-debug full) | ||
| ADD_COMPILE_OPTIONS(-fpp) | ||
| elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVIDIA" OR ${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC") | ||
| ADD_COMPILE_OPTIONS(-Mnoipa) | ||
| ADD_COMPILE_OPTIONS(-traceback) | ||
| ADD_COMPILE_OPTIONS(-Mfree) | ||
| ADD_COMPILE_OPTIONS(-Ktrap=fp) | ||
| ADD_COMPILE_OPTIONS(-Mpreprocess) | ||
| else() | ||
| message (WARNING "This program may not be able to be compiled with compiler :${CMAKE_Fortran_COMPILER_ID}") | ||
| endif() | ||
| endif() | ||
|
|
||
| # Use rpaths on MacOSX | ||
| set(CMAKE_MACOSX_RPATH 1) | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set MPI flags for Fortran with MPI F08 interface | ||
| find_package(MPI REQUIRED Fortran) | ||
| find_package(MPI COMPONENTS Fortran REQUIRED) | ||
| if(NOT MPI_Fortran_HAVE_F08_MODULE) | ||
| message(FATAL_ERROR "MPI implementation does not support the Fortran 2008 mpi_f08 interface") | ||
| endif() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set OpenMP flags for C/C++/Fortran | ||
| if (OPENMP) | ||
| if(OPENMP) | ||
| find_package(OpenMP REQUIRED) | ||
| set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") | ||
| set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
|
||
| set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}") | ||
| endif (OPENMP) | ||
| endif() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set a default build type if none was specified | ||
| if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
| message(STATUS "Setting build type to 'Release' as none was specified.") | ||
| set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) | ||
| # Set the possible values of build type for cmake-gui | ||
| set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "Coverage") | ||
| set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) | ||
| endif() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Pass debug/release flag to Fortran files for preprocessor | ||
| if(CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
| add_definitions(-DDEBUG) | ||
climbfuji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Add the sub-directories | ||
| add_subdirectory(src) | ||
|
|
||
| if(CCPP_RUNNING_TESTS) | ||
| enable_testing() | ||
| add_subdirectory(test) | ||
| endif() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Request a static build | ||
| option(BUILD_SHARED_LIBS "Build a static library" OFF) | ||
| if (CCPP_FRAMEWORK_BUILD_DOCUMENTATION) | ||
| find_package(Doxygen REQUIRED) | ||
| add_subdirectory(doc) | ||
| endif() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Add the sub-directories | ||
| add_subdirectory(src) | ||
| add_subdirectory(doc) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| # CMake wrapper for ccpp_capgen.py | ||
| # Currently meant to be a CMake API needed for generating caps for regression tests. | ||
| # | ||
| # CAPGEN_DEBUG - ON/OFF (Default: OFF) - Enables debug capability through ccpp_capgen.py | ||
| # CAPGEN_EXPECT_THROW_ERROR - ON/OFF (Default: OFF) - Scans ccpp_capgen.py log for error string and errors if not found. | ||
| # HOST_NAME - String name of host | ||
| # OUTPUT_ROOT - String path to put generated caps | ||
| # VERBOSITY - Number of --verbose flags to pass to capgen | ||
| # HOSTFILES - CMake list of host metadata filenames | ||
| # SCHEMEFILES - CMake list of scheme metadata files | ||
| # SUITES - CMake list of suite xml files | ||
| function(ccpp_capgen) | ||
| set(optionalArgs CAPGEN_DEBUG CAPGEN_EXPECT_THROW_ERROR) | ||
| set(oneValueArgs HOST_NAME OUTPUT_ROOT VERBOSITY) | ||
| set(multi_value_keywords HOSTFILES SCHEMEFILES SUITES) | ||
|
|
||
| cmake_parse_arguments(arg "${optionalArgs}" "${oneValueArgs}" "${multi_value_keywords}" ${ARGN}) | ||
|
|
||
| # Error if script file not found. | ||
| set(CCPP_CAPGEN_CMD_LIST "${CMAKE_SOURCE_DIR}/scripts/ccpp_capgen.py") | ||
| if(NOT EXISTS ${CCPP_CAPGEN_CMD_LIST}) | ||
| message(FATAL_ERROR "function(ccpp_capgen): Could not find ccpp_capgen.py. Looked for ${CCPP_CAPGEN_CMD_LIST}.") | ||
| endif() | ||
|
|
||
| # Interpret parsed arguments | ||
| if(DEFINED arg_CAPGEN_DEBUG) | ||
| list(APPEND CCPP_CAPGEN_CMD_LIST "--debug") | ||
| endif() | ||
| if(DEFINED arg_HOSTFILES) | ||
| list(JOIN arg_HOSTFILES "," HOSTFILES_SEPARATED) | ||
| list(APPEND CCPP_CAPGEN_CMD_LIST "--host-files" "${HOSTFILES_SEPARATED}") | ||
| endif() | ||
| if(DEFINED arg_SCHEMEFILES) | ||
| list(JOIN arg_SCHEMEFILES "," SCHEMEFILES_SEPARATED) | ||
| list(APPEND CCPP_CAPGEN_CMD_LIST "--scheme-files" "${SCHEMEFILES_SEPARATED}") | ||
| endif() | ||
| if(DEFINED arg_SUITES) | ||
| list(JOIN arg_SUITES "," SUITES_SEPARATED) | ||
| list(APPEND CCPP_CAPGEN_CMD_LIST "--suites" "${SUITES_SEPARATED}") | ||
| endif() | ||
| if(DEFINED arg_HOST_NAME) | ||
| list(APPEND CCPP_CAPGEN_CMD_LIST "--host-name" "${arg_HOST_NAME}") | ||
| endif() | ||
| if(DEFINED arg_OUTPUT_ROOT) | ||
| message(STATUS "Creating output directory: ${arg_OUTPUT_ROOT}") | ||
| file(MAKE_DIRECTORY "${arg_OUTPUT_ROOT}") | ||
| list(APPEND CCPP_CAPGEN_CMD_LIST "--output-root" "${arg_OUTPUT_ROOT}") | ||
| endif() | ||
| if(DEFINED arg_VERBOSITY) | ||
| string(REPEAT "--verbose" ${arg_VERBOSITY} VERBOSE_PARAMS_SEPERATED) | ||
| separate_arguments(VERBOSE_PARAMS UNIX_COMMAND "${VERBOSE_PARAMS_SEPERATED}") | ||
| list(APPEND CCPP_CAPGEN_CMD_LIST ${VERBOSE_PARAMS}) | ||
| endif() | ||
|
|
||
| message(STATUS "Running ccpp_capgen.py from ${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
|
||
| unset(CAPGEN_OUT) # Unset CAPGEN_OUT to prevent incorrect output on subsequent calls. | ||
| execute_process(COMMAND ${CCPP_CAPGEN_CMD_LIST} | ||
| WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" | ||
| OUTPUT_VARIABLE CAPGEN_OUT | ||
| ERROR_VARIABLE CAPGEN_OUT | ||
| RESULT_VARIABLE RES | ||
| COMMAND_ECHO STDOUT) | ||
|
|
||
| message(STATUS "ccpp-capgen stdout: ${CAPGEN_OUT}") | ||
|
|
||
| if(arg_CAPGEN_EXPECT_THROW_ERROR) | ||
| # Determine if the process succeeded but had an expected string in the process log. | ||
| string(FIND "${CAPGEN_OUT}" "Variables of type ccpp_constituent_properties_t only allowed in register phase" ERROR_INDEX) | ||
|
|
||
| if (ERROR_INDEX GREATER -1) | ||
| message(STATUS "Capgen build produces expected error message.") | ||
| else() | ||
| message(FATAL_ERROR "CCPP cap generation did not generate expected error. Expected 'Variables of type constituent_properties_t only allowed in register phase.") | ||
| endif() | ||
| else() | ||
| if(RES EQUAL 0) | ||
| message(STATUS "ccpp-capgen completed successfully") | ||
| else() | ||
| message(FATAL_ERROR "CCPP cap generation FAILED: result = ${RES}") | ||
| endif() | ||
| endif() | ||
| endfunction() | ||
|
|
||
| # CMake wrapper for ccpp_datafile.py | ||
| # Currently meant to be a CMake API needed for generating caps for regression tests. | ||
| # | ||
| # DATATABLE - Path to generated datatable.xml file | ||
| # REPORT_NAME - String report name to get list of generated files form capgen (typically --ccpp-files) | ||
| function(ccpp_datafile) | ||
| set(oneValueArgs DATATABLE REPORT_NAME) | ||
| cmake_parse_arguments(arg "" "${oneValueArgs}" "" ${ARGN}) | ||
|
|
||
| set(CCPP_DATAFILE_CMD "${CMAKE_SOURCE_DIR}/scripts/ccpp_datafile.py") | ||
|
|
||
| if(NOT EXISTS ${CCPP_DATAFILE_CMD}) | ||
| message(FATAL_ERROR "function(ccpp_datafile): Could not find ccpp_datafile.py. Looked for ${CCPP_DATAFILE_CMD}.") | ||
| endif() | ||
|
|
||
| if(NOT DEFINED arg_REPORT_NAME) | ||
| message(FATAL_ERROR "function(ccpp_datafile): REPORT_NAME not set. Must specify the report to generate to run cpp_datafile.py") | ||
| endif() | ||
| list(APPEND CCPP_DATAFILE_CMD "${arg_REPORT_NAME}") | ||
|
|
||
| if(NOT DEFINED arg_DATATABLE) | ||
| message(FATAL_ERROR "function(ccpp_datafile): DATATABLE not set. A datatable file must be configured to call ccpp_datafile.") | ||
| endif() | ||
| list(APPEND CCPP_DATAFILE_CMD "${arg_DATATABLE}") | ||
|
|
||
| message(STATUS "Running ccpp_datafile from ${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
|
||
| unset(CCPP_CAPS) | ||
| execute_process(COMMAND ${CCPP_DATAFILE_CMD} | ||
| WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" | ||
| OUTPUT_VARIABLE CCPP_CAPS | ||
| RESULT_VARIABLE RES | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| ERROR_STRIP_TRAILING_WHITESPACE | ||
| COMMAND_ECHO STDOUT) | ||
| message(STATUS "CCPP_CAPS = ${CCPP_CAPS}") | ||
| if(RES EQUAL 0) | ||
| message(STATUS "CCPP cap files retrieved") | ||
| else() | ||
| message(FATAL_ERROR "CCPP cap file retrieval FAILED: result = ${RES}") | ||
| endif() | ||
| string(REPLACE "," ";" CCPP_CAPS_LIST ${CCPP_CAPS}) # Convert "," separated list from python back to ";" separated list for CMake. | ||
| set(CCPP_CAPS_LIST "${CCPP_CAPS_LIST}" PARENT_SCOPE) | ||
| endfunction() | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Building the documentation | ||
|
|
||
| Similar to building the source code, building the documentation can be done by: | ||
|
|
||
| ```bash | ||
| $ cmake -S<project_root_source_directory> -B<build_directory> -DCCPP_FRAMEWORK_BUILD_DOCUMENTATION=ON | ||
| cd build_directory | ||
| make doc | ||
| ``` | ||
|
|
||
| and the compiled documentation should be in `<build_directory>/doc/html`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,9 +12,10 @@ set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_I | |
| # Define the executable and what to link | ||
| add_library(ccpp_framework STATIC ${SOURCES_F90}) | ||
| target_link_libraries(ccpp_framework PUBLIC MPI::MPI_Fortran) | ||
| set_target_properties(ccpp_framework PROPERTIES VERSION ${PROJECT_VERSION} | ||
| set_target_properties(ccpp_framework PROPERTIES | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my comment above. Using the correct target_link_libraries for OpenMP will make line 18 unnecessary |
||
| VERSION ${PROJECT_VERSION} | ||
| SOVERSION ${PROJECT_VERSION_MAJOR} | ||
| LINK_FLAGS ${CMAKE_Fortran_FLAGS}) | ||
| LINK_FLAGS "${CMAKE_Fortran_FLAGS}") | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Installation | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.