Skip to content

Commit

Permalink
Merge pull request #4 from JCSDA/develop
Browse files Browse the repository at this point in the history
Develop into master
  • Loading branch information
danholdaway authored Oct 27, 2020
2 parents 10efc96 + 280feab commit fa04429
Show file tree
Hide file tree
Showing 127 changed files with 78,517 additions and 14,763 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
*DS_Store*
*.swp
._*

build/
110 changes: 72 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# (C) Copyright 2017 UCAR.
# (C) Copyright 2017-2020 UCAR.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.

################################################################################
# FV3
# FV3JEDILM
################################################################################

cmake_minimum_required( VERSION 3.3.2 FATAL_ERROR )

project( fv3 C CXX Fortran )
project( fv3jedilm VERSION 1.0.0 LANGUAGES Fortran C )

set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH} )

set( CMAKE_DIRECTORY_LABELS "fv3-jedi-lm" )

set( ECBUILD_DEFAULT_BUILD_TYPE Release )
set( ENABLE_OS_TESTS OFF CACHE BOOL "Disable OS tests" FORCE )
set( ENABLE_LARGE_FILE_SUPPORT OFF CACHE BOOL "Disable testing of large file support" FORCE )
Expand All @@ -29,70 +31,102 @@ ecbuild_requires_macro_version( 2.7 )
ecbuild_declare_project()

ecbuild_enable_fortran( REQUIRED )
ecbuild_add_cxx11_flags()

set( FV3_LINKER_LANGUAGE CXX )

################################################################################
# Dependencies
################################################################################

## Boost
#set( Boost_MINIMUM_VERSION "1.47" )
#find_package( Boost ${Boost_MINIMUM_VERSION} REQUIRED
# COMPONENTS unit_test_framework )
#include_directories( ${Boost_INCLUDE_DIR} )
# MKL / LAPACK
# Default: use MKL as LAPACK implementation.
# Set -DENABLE_MKL=Off to disable use of MKL and prefer LAPACK
option( ENABLE_MKL "Use MKL for LAPACK implementation (if available)" ON )
if( ENABLE_MKL )
find_package( MKL )
endif()
if( MKL_FOUND )
set( LAPACK_LIBRARIES ${MKL_LIBRARIES} )
else()
find_package( LAPACK REQUIRED )
endif()

#openMP
find_package( OpenMP COMPONENTS Fortran )

# MPI
ecbuild_add_option( FEATURE MPI DEFAULT ON
DESCRIPTION "Support for MPI distributed parallelism"
REQUIRED_PACKAGES "MPI COMPONENTS CXX Fortran" )
ecbuild_find_mpi( COMPONENTS CXX Fortran REQUIRED )
REQUIRED_PACKAGES "MPI COMPONENTS Fortran" )
ecbuild_find_mpi( COMPONENTS Fortran REQUIRED )
ecbuild_include_mpi()
link_libraries(${MPI_CXX_LIBRARIES} ${MPI_Fortran_LIBRARIES})
link_libraries(${MPI_Fortran_LIBRARIES})

# NetCDF
set( NETCDF_F90 ON CACHE BOOL "Compile with Fortran NetCDF" )
find_package( NetCDF REQUIRED )
include_directories( ${NETCDF_INCLUDE_DIR} )

# fms
ecbuild_use_package( PROJECT fms REQUIRED )
include_directories( ${FMS_INCLUDE_DIRS} )
find_package( NetCDF REQUIRED COMPONENTS Fortran )
include_directories( ${NETCDF_INCLUDE_DIRS} )

################################################################################
# Definitions
################################################################################
# Set default model
if (NOT FV3_FORECAST_MODEL MATCHES "GEOS" AND NOT FV3_FORECAST_MODEL MATCHES "UFS")
set(FV3_FORECAST_MODEL "FV3CORE")
endif()

set(COMPDEFS "-DsysLinux;-DESMA64;-DHAS_NETCDF4;-DHAS_NETCDF3;-DH5_HAVE_PARALLEL;-DNETCDF_NEED_NF_MPIIO;-DEIGHT_BYTE;-DSPMD;-DTIMING;-Duse_libMPI;-Duse_netCDF;-DHAVE_SHMEM;-DMAPL_MODE;-DOLDMPP")

add_definitions( ${COMPDEFS} )
# fms
if (FV3_FORECAST_MODEL MATCHES "FV3CORE")
ecbuild_use_package( PROJECT fms REQUIRED )
include_directories( ${FMS_INCLUDE_DIRS} )
list( APPEND FV3JEDILM_TPLS fms )
endif()

# geos
if(FV3_FORECAST_MODEL MATCHES "GEOS")
find_package(MAPL REQUIRED PATHS ${FV3_FORECAST_MODEL_ROOT}/lib/cmake/MAPL )
find_package(GEOSgcm REQUIRED PATHS ${FV3_FORECAST_MODEL_ROOT}/lib/cmake/GEOSgcm )
if (FV3_PRECISION MATCHES DOUBLE OR NOT FV3_PRECISION)
link_libraries(fms_r8)
else()
link_libraries(fms_r4)
endif()
endif()

# ufs
if(FV3_FORECAST_MODEL MATCHES "UFS")
# Set CMAKE_PREFIX_PATH to include the install location of ufs
find_package(fms REQUIRED )
find_package(fv3atm REQUIRED )
find_package(ufs REQUIRED )
link_libraries(fms)
link_libraries(NetCDF::NetCDF_Fortran)
# Install includes
get_target_property(fmsinc fms INTERFACE_INCLUDE_DIRECTORIES)
include_directories( ${fmsinc} )
endif()

################################################################################
# Export package info
################################################################################

list( APPEND FV3_TPLS MPI fms )
list( APPEND FV3JEDILM_TPLS MPI )

set( FV3_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
${CMAKE_Fortran_MODULE_DIRECTORY} )
set( FV3_LIBRARIES fv3 )
set( FV3JEDILM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/src
${CMAKE_Fortran_MODULE_DIRECTORY} )
set( FV3JEDILM_LIBRARIES fv3jedilm )

get_directory_property( FV3_DEFINITIONS COMPILE_DEFINITIONS )
get_directory_property( FV3JEDILM_DEFINITIONS COMPILE_DEFINITIONS )

foreach( _tpl ${FV3_TPLS} )
foreach( _tpl ${FV3JEDILM_TPLS} )
string( TOUPPER ${_tpl} TPL )
list( APPEND FV3_EXTRA_DEFINITIONS ${${TPL}_DEFINITIONS} ${${TPL}_TPL_DEFINITIONS} )
list( APPEND FV3_EXTRA_INCLUDE_DIRS ${${TPL}_INCLUDE_DIRS} ${${TPL}_TPL_INCLUDE_DIRS} )
list( APPEND FV3_EXTRA_LIBRARIES ${${TPL}_LIBRARIES} ${${TPL}_TPL_LIBRARIES} )
list( APPEND FV3JEDILM_EXTRA_DEFINITIONS ${${TPL}_DEFINITIONS} ${${TPL}_TPL_DEFINITIONS} )
list( APPEND FV3JEDILM_EXTRA_INCLUDE_DIRS ${${TPL}_INCLUDE_DIRS} ${${TPL}_TPL_INCLUDE_DIRS} )
list( APPEND FV3JEDILM_EXTRA_LIBRARIES ${${TPL}_LIBRARIES} ${${TPL}_TPL_LIBRARIES} )
endforeach()

################################################################################
# Sources
################################################################################

include( fv3_compiler_flags )
include_directories( ${FV3_INCLUDE_DIRS} ${FV3_EXTRA_INCLUDE_DIRS} )
include( fv3jedilm_compiler_flags )
include_directories( ${FV3JEDILM_INCLUDE_DIRS} ${FV3JEDILM_EXTRA_INCLUDE_DIRS} )

add_subdirectory( src )

Expand All @@ -101,7 +135,7 @@ add_subdirectory( src )
################################################################################

# prepares a tar.gz of the sources and/or binaries
ecbuild_install_project( NAME fv3 )
ecbuild_install_project( NAME fv3jedilm )

# print the summary of the configuration
ecbuild_print_summary()
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# fv3
# Linearized forecast model for FV3-JEDI

The Linearized version (tangent linear and adjoint) of the FV3 dynamical core and GEOS model physics. The scientific parts of this system were built by NASA's Global Modeling and Assimilation Office. The infrastructure parts by the Joint Center for Satellite Data Assimilation, UCAR.

This is not a standalone system and is designed to be built with [FV3-JEDI](https://github.com/JCSDA/fv3-jedi).
56 changes: 0 additions & 56 deletions cmake/compiler_flags_Cray_Fortran.cmake

This file was deleted.

48 changes: 0 additions & 48 deletions cmake/compiler_flags_GNU_C.cmake

This file was deleted.

52 changes: 0 additions & 52 deletions cmake/compiler_flags_GNU_Fortran.cmake

This file was deleted.

48 changes: 0 additions & 48 deletions cmake/compiler_flags_Intel_C.cmake

This file was deleted.

Loading

0 comments on commit fa04429

Please sign in to comment.