Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

MUSICA v0.4.0 #37

Merged
merged 62 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
2103bae
util only build of musica core
K20shores Jul 12, 2023
9e66a76
update docker ignore
boulderdaze Jul 20, 2023
1c778c1
update readme
boulderdaze Jul 20, 2023
9ad6b6b
add fortran interface for micm
boulderdaze Jul 20, 2023
d666e1d
remove ccpp
boulderdaze Jul 20, 2023
8dac202
fixed the acroynom
boulderdaze Jul 21, 2023
3736ddc
add fortran interface
boulderdaze Jul 21, 2023
f74d19f
adding direct link to the musica paper
K20shores Jul 24, 2023
c68e3df
add the source
boulderdaze Jul 24, 2023
9a5c5e9
fix the spacing
boulderdaze Jul 24, 2023
6efa7be
Remove linking
boulderdaze Jul 24, 2023
403dac0
Update CMakeLists.txt
boulderdaze Jul 24, 2023
284d5e9
Update src/fortran_interface/micm/interface.F90
boulderdaze Jul 24, 2023
c6b72b8
remove file path
boulderdaze Jul 24, 2023
16e12e6
remove file path
boulderdaze Jul 24, 2023
0897f82
relocate the adding src directory after musica fortran
boulderdaze Jul 24, 2023
e363561
add fortran interface
boulderdaze Jul 24, 2023
9a89a52
scaffold for separating musica from fortran interface
boulderdaze Jul 28, 2023
abf9370
update musica/musica cmake
boulderdaze Jul 31, 2023
618974c
enable test
boulderdaze Jul 31, 2023
51d9082
add test for musica'
boulderdaze Jul 31, 2023
0cebe93
update docker file for musica (disable building tuvx)
boulderdaze Aug 1, 2023
cfcaf77
add a new line
boulderdaze Aug 1, 2023
b74ca11
add musica-fortran
boulderdaze Aug 4, 2023
01d5305
docker for musica-fortran
boulderdaze Aug 4, 2023
86c9357
fix a typo
boulderdaze Aug 4, 2023
914ce1e
testing test yml
boulderdaze Aug 7, 2023
6541ef6
update docker for mpi
boulderdaze Aug 7, 2023
ee93d4b
update dockerfile for mpi and openmp
boulderdaze Aug 7, 2023
48e8ce8
roll back test yml
boulderdaze Aug 7, 2023
146078c
modify test yml
boulderdaze Aug 7, 2023
a1e3d75
add tuvx
boulderdaze Aug 7, 2023
e745ba2
test yml
boulderdaze Aug 7, 2023
95374f0
move cmake file to the top level
boulderdaze Aug 9, 2023
9e76cea
add cmake at the top level
boulderdaze Aug 9, 2023
910739a
fix bugs
boulderdaze Aug 10, 2023
8c77d99
add changes
boulderdaze Aug 11, 2023
1cebf6b
musica fortran with intel compilers
boulderdaze Aug 14, 2023
0522ec9
move options to the top level
boulderdaze Aug 15, 2023
997279b
cmake dependent options for musica
boulderdaze Aug 15, 2023
5e26fef
docker files
boulderdaze Aug 15, 2023
f8a690b
changes to make mpi test work
boulderdaze Aug 16, 2023
ef9a804
roll back test setup
boulderdaze Aug 16, 2023
4f466ac
remove ccpp
boulderdaze Aug 16, 2023
a8a9ea2
update the git tag
boulderdaze Aug 16, 2023
c1648b1
remove unnecessary code
boulderdaze Aug 16, 2023
66e727f
remove unnecessary
boulderdaze Aug 16, 2023
38c7885
test freeing up space
boulderdaze Aug 16, 2023
9593eec
test freeing up space
boulderdaze Aug 16, 2023
29f3d0e
testing different way to use musica fortran
K20shores Aug 24, 2023
0cc0192
removing tests
K20shores Aug 24, 2023
d17209c
commit
K20shores Aug 24, 2023
f2dddf0
removing diagnostic messages
K20shores Aug 24, 2023
3b4235b
Merge pull request #34 from NCAR/modifications
boulderdaze Aug 25, 2023
79e6ae4
correct build path
boulderdaze Aug 25, 2023
231b762
Merge pull request #30 from NCAR/fortran_wrapper
boulderdaze Aug 25, 2023
4f790db
udpdated to the new version of the plan
K20shores Sep 25, 2023
72405d2
updating tag numbers for micm and musica core, and cmake version number
K20shores Sep 25, 2023
c1574fe
Merge pull request #36 from NCAR/dev_plan_update
K20shores Sep 25, 2023
6aba290
updated tuv-x version
K20shores Sep 25, 2023
bf1b77b
commenting out interface
K20shores Sep 25, 2023
70fd6bd
updating reference
K20shores Sep 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
# add things to copy
!CMakeLists.txt
!Dockerfile
!Dockerfile.ccpp
!Dockerfile.mpi
!Dockerfile.mpi_openmp
!Dockerfile.openmp
!ccpp
!cmake
!musica
!musica-fortran
!docs
!include
!cmake
!lib
!packaging
!src
!test
!test
!.gitmodules
!.git
16 changes: 15 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,18 @@ jobs:
- name: build Docker image
run: docker build -t musica-mpi-openmp -f Dockerfile.mpi_openmp .
- name: run tests in container
run: docker run --name test-container -t musica-mpi-openmp bash -c 'make test'
run: docker run --name test-container -t musica-mpi-openmp bash -c 'make test'
build_test_connections_musica-fortran:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- name: delete unnessary tools to free up space
run: rm -rf /opt/hostedtoolcache

- uses: actions/checkout@v2
with:
submodules: recursive
- name: build Docker image
run: docker build -t musica-fortran -f Dockerfile.fortran .
- name: run tests in container
run: docker run --name test-container -t musica-fortran bash -c 'make test'
195 changes: 35 additions & 160 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
################################################################################
# Preamble

cmake_minimum_required(VERSION 3.21)
set(CMAKE_USER_MAKE_RULES_OVERRIDE "cmake/SetDefaults.cmake")

project(
musica
VERSION 0.3.0
VERSION 0.4.0
LANGUAGES Fortran CXX C
)

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_LIST_DIR}/cmake")
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_MODULE_PATH}/SetDefaults.cmake")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake")

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
################################################################################
include(CMakeDependentOption)

message ( STATUS "CMake build configuration for musica(${CMAKE_BUILD_TYPE}) ${PROJECT_VERSION}" )
# Library options to build
option(USE_MUSICA "Use MUSICA" ON)
message(STATUS "Building MUSICA sources into a library : ${USE_MUSICA}")

include(musica_util)
checkout_submodules()
option(USE_MUSICA_FORTRAN "Use MUSICA Fortran interface" OFF)
message(STATUS "Building MUSICA-Fortran sources into a library : ${USE_MUSICA_FORTRAN}")

################################################################################
# Projet wide setup options
include(CMakeDependentOption)
cmake_dependent_option(
ENABLE_TESTS "Builds tests that ensures each enabled MUSICA component can be used" ON "USE_MUSICA" OFF)
message(STATUS "Build tests for MUSICA : ${ENABLE_TESTS}")

option( ENABLE_TESTS "Builds tests that ensures each enabled MUSICA component can be used" OFF )
cmake_dependent_option(
ENABLE_TUVX "Builds TUV-x, a photolysis calculator library" ON "USE_MUSICA" OFF)
message(STATUS "Build TUV-x : ${ENABLE_TUVX}")

option( ENABLE_TUVX "Builds TUV-x, a photolysis calculator library" ON )
option( ENABLE_MICM "Adds MICM, a model independent chemical mechanism solver" ON )
cmake_dependent_option(
ENABLE_MICM "Adds MICM, a model independent chemical mechanism solver" ON "USE_MUSICA" OFF)
message(STATUS "Build MICM : ${ENABLE_MICM}")

option( ENABLE_CCPP "Builds the CCPP library" OFF )
cmake_dependent_option(
ENABLE_MPI "Enable MPI parallel support" OFF "USE_MUSICA" OFF)
message(STATUS "Enable MPI parallel support : ${ENABLE_MPI}")

option( ENABLE_MPI "Enable MPI parallel support" OFF)
option( ENABLE_OPENMP "Enable OpemMP support" OFF )
cmake_dependent_option(
ENABLE_OPENMP "Enable OpemMP support" OFF "USE_MUSICA" OFF)
message(STATUS "Enable OpemMP support : ${ENABLE_OPENMP}")

option( CREATE_ENVIRONMENT_MODULE "Creates an Lmod environment module file that can be installed on the same machine this library is installed to." OFF )
cmake_dependent_option(
CREATE_ENVIRONMENT_MODULE "Creates an Lmod environment module file that can be installed on the same machine this library is installed to." OFF "USE_MUSICA" OFF)
message(STATUS "Creates an Lmod environment module : ${CREATE_ENVIRONMENT_MODULE}")

if(CREATE_ENVIRONMENT_MODULE)
set(INSTALL_MODULE_FILE_PATH "" CACHE STRING "This is the path of the modulefiles location that the Lmod files should be installed to.")
endif()

# Set up include and lib directories
set( MUSICA_MOD_DIR "${PROJECT_BINARY_DIR}/include" )
set( MUSICA_LIB_DIR "${PROJECT_BINARY_DIR}/libs" )

include(GNUInstallDirs)
set(INSTALL_PREFIX "musica-${PROJECT_VERSION}")
set(INSTALL_MOD_DIR "${INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
Expand Down Expand Up @@ -78,146 +80,19 @@ elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI")
endif()

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

include(cmake/dependencies.cmake)

##############################################################################
# MUSICA targets

####################
# MUSICA
add_library(musica STATIC)
add_library(musica::musica ALIAS musica)

set_target_properties(musica PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${MUSICA_LIB_DIR}
Fortran_MODULE_DIRECTORY ${MUSICA_MOD_DIR}
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)

target_link_libraries(musica
PUBLIC
PkgConfig::netcdff
${JSON_LIB}
)

target_include_directories(musica
PUBLIC
$<BUILD_INTERFACE:${MUSICA_MOD_DIR}>
$<INSTALL_INTERFACE:${INSTALL_MOD_DIR}>
)

target_include_directories(musica
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${INSTALL_MOD_DIR}>
)

add_subdirectory(src)

####################
# MUSICA-core
add_library(musicacore_object)
add_library(musica::musicacore ALIAS musicacore_object)
add_subdirectory(lib/musica-core/src)

set_target_properties(musicacore_object PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${MUSICA_LIB_DIR}
Fortran_MODULE_DIRECTORY ${MUSICA_MOD_DIR}
)

target_include_directories(musicacore_object
PUBLIC
$<BUILD_INTERFACE:${MUSICA_MOD_DIR}>
$<INSTALL_INTERFACE:${INSTALL_MOD_DIR}>
)

target_link_libraries(musicacore_object
PUBLIC
PkgConfig::netcdff
)

# add the sources to musica
target_sources(musica
PRIVATE
$<TARGET_OBJECTS:musicacore_object>
)

####################
# TUV-x
if (ENABLE_TUVX)
add_definitions(-DMUSICA_USE_TUVX)

set(TUVX_MOD_DIR ${MUSICA_MOD_DIR})
set(TUVX_LIB_DIR ${MUSICA_LIB_DIR})
add_subdirectory(lib/tuv-x/src)

set_target_properties(tuvx_object PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${MUSICA_LIB_DIR}
Fortran_MODULE_DIRECTORY ${MUSICA_MOD_DIR}
)

target_include_directories(tuvx_object
PUBLIC
$<BUILD_INTERFACE:${MUSICA_MOD_DIR}>
$<INSTALL_INTERFACE:${INSTALL_MOD_DIR}>
)

target_link_libraries(tuvx_object
PUBLIC
musicacore_object
)

# add the sources to musica
target_sources(musica
PRIVATE
$<TARGET_OBJECTS:tuvx_object>
)
if(USE_MUSICA)
add_subdirectory(musica)
endif()

####################
# MICM
if (ENABLE_MICM)
add_definitions(-DMUSICA_USE_MICM)
target_compile_features(musica PUBLIC cxx_std_20)

target_include_directories(musica
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib/micm/include>
$<INSTALL_INTERFACE:${INSTALL_MOD_DIR}>
)

install(
DIRECTORY
${PROJECT_SOURCE_DIR}/lib/micm/include/micm
DESTINATION
${INSTALL_MOD_DIR}
)
# MUSICA-Fortran
if(USE_MUSICA_FORTRAN)
add_subdirectory(musica-fortran)
endif()

####################
# CCPP

if(ENABLE_CCPP)
add_subdirectory(ccpp)
endif()


################################################################################
# Tests

# only include packaging if we are the top level project being built
if(PROJECT_IS_TOP_LEVEL AND ENABLE_TESTS)
if(ENABLE_TESTS)
enable_testing()
add_subdirectory(test)
add_subdirectory(musica/test)
endif()

################################################################################
# Packaging

# only include packaging if we are the top level project being built
if(PROJECT_IS_TOP_LEVEL)
add_subdirectory(packaging)
endif()
28 changes: 15 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,28 @@ RUN dnf -y update \
valgrind \
&& dnf clean all

# install json-fortran
# Install json-fortran
RUN curl -LO https://github.com/jacobwilliams/json-fortran/archive/8.2.0.tar.gz \
&& tar -zxvf 8.2.0.tar.gz \
&& cd json-fortran-8.2.0 \
&& export FC=gfortran \
&& mkdir build \
&& cd build \
&& cmake -D SKIP_DOC_GEN:BOOL=TRUE .. \
&& make install

# copy the musica core code
COPY . /musica/
# Set environment variables
ENV FC=gfortran
ENV JSON_FORTRAN_HOME="/usr/local/jsonfortran-gnu-8.2.0"

# get a tag and build the model
RUN mkdir /build \
&& cd /build \
&& export JSON_FORTRAN_HOME="/usr/local/jsonfortran-gnu-8.2.0" \
&& cmake \
-D ENABLE_TESTS=ON \
../musica \
&& make install -j 8
# Copy the musica code
COPY . musica

WORKDIR /build
# Build
RUN cd musica \
&& cmake -S . \
-B build \
-D ENABLE_TESTS=ON \
&& cd build \
&& make install -j 8

WORKDIR musica/build
67 changes: 0 additions & 67 deletions Dockerfile.ccpp

This file was deleted.

Loading
Loading