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

Update micm interface #89

Merged
merged 12 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 2 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: build

on:
push:
pull_request:
types: [opened, reopened]
on: [pull_request,workflow_dispatch]

jobs:
test_micm_api:
Expand All @@ -15,4 +12,4 @@ jobs:
- name: build Docker image
run: docker build -t musica -f test/docker/Dockerfile.musica .
- name: run tests in container
run: docker run --name test-container -t musica bash -c 'ctest'
run: docker run --name test-container -t musica bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"'
33 changes: 33 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
===============================================================

Tag name:atmos_phys0_02_005
Originator(s): kshores
Date: 26 Mar 2024
One-line Summary: Update MUSICA git tag
Github PR URL: https://github.com/ESCOMP/atmospheric_physics/pull/89

Purpose of changes (include the issue number and title text for each relevant GitHub issue):
- Update the MUSICA git tag

This PR fixes the following NCAR/atmospheric_physics Github issues:

- [Update MUSICA tag](https://github.com/NCAR/musica/issues/72)

Code reviewed by: cacraigucar, boulderdaze

List all existing files that have been added (A), modified (M), or deleted (D),
and describe the changes:

M .github/workflows/test.yaml
- Clean-up Github Action workflow

M musica/micm/micm.F90
M test/CMakeLists.txt
M test/docker/Dockerfile.musica
M test/musica/micm/CMakeLists.txt
- Update MICM interface

List and Describe any test failures: No known test failures.

Summarize any changes to answers: None

===============================================================

Tag name:atmos_phys0_02_004
Originator(s): boulderdaze
Date: 12 Mar 2024
Expand Down
8 changes: 2 additions & 6 deletions musica/micm/micm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module micm
public :: micm_init, micm_run, micm_final
private :: convert_to_mol_per_cubic_meter, convert_to_mass_mixing_ratio

type(micm_t), allocatable :: micm_obj
type(micm_t), pointer :: micm_obj

contains

Expand All @@ -26,10 +26,7 @@ subroutine micm_init(config_path, iulog, errcode, errmsg)
errcode = 0
errmsg = ''

allocate(micm_obj)
micm_obj = micm_t(config_path)

errcode = micm_obj%create_solver()
micm_obj => micm_t(config_path, errcode)

if (errcode /= 0) then
errmsg = "[fatal] [micm] Failed to create MICM solver. Parsing configuration failed. &
Expand Down Expand Up @@ -136,7 +133,6 @@ subroutine micm_final(iulog, errcode, errmsg)
errmsg = ''

write(iulog,*) "[debug] [micm] Deallocating MICM object..."
if (allocated(micm_obj)) deallocate(micm_obj)

end subroutine micm_final

Expand Down
8 changes: 4 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_MODULE_PATH}/SetDefaults.cmake)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

# --------------------------------------------------------------------------------
# NOTE: If 'ENABLE_MICM_TEST' on, this is not a stand-alone cmake project anymore.
# NOTE: If 'CCPP_ENABLE_MUSICA_TESTS' on, this is not a stand-alone cmake project anymore.
# MICM CCPP wrapper needs MUSICA library and ccpp-framework/src.
# To 'ENABLE_MICM_TEST', you either build a cmake project through
# To 'CCPP_ENABLE_MUSICA_TESTS', you either build a cmake project through
# 'docker/Dockerfile.musica' or follow the build instructions in the file.
# The following '$ENV' variables are set by the docker file.
# --------------------------------------------------------------------------------
option(ENABLE_MICM_TEST "Build the micm test" OFF)
option(CCPP_ENABLE_MUSICA_TESTS "Build the micm test" OFF)

if (ENABLE_MICM_TEST)
if (CCPP_ENABLE_MUSICA_TESTS)
set(MUSICA_VERSION $ENV{MUSICA_VERSION})
set(MICM_SRC_PATH ${CMAKE_SOURCE_DIR}/../musica/micm)
set(CCPP_SRC_PATH ${CMAKE_SOURCE_DIR}/$ENV{CCPP_SRC_PATH})
Expand Down
46 changes: 15 additions & 31 deletions test/docker/Dockerfile.musica
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,37 @@ RUN apt update \
cmake \
cmake-curses-gui \
curl \
g++ \
gcc \
gfortran \
git \
lcov \
libcurl4-openssl-dev \
libhdf5-dev \
libnetcdff-dev \
m4 \
make \
nlohmann-json3-dev \
tree \
valgrind \
vim \
zlib1g-dev \
git \
lcov \
make \
libnetcdff-dev \
valgrind \
gcc \
gfortran \
g++ \
tree \
&& apt clean

ENV FC=gfortran
ENV FFLAGS="-I/usr/include/"

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 \
&& mkdir build \
&& cd build \
&& cmake -D SKIP_DOC_GEN:BOOL=TRUE .. \
&& make install

ENV JSON_FORTRAN_HOME="/usr/local/jsonfortran-gnu-8.2.0"

# Install MUSICA (MUSICA-C)
RUN git clone --depth 1 https://github.com/NCAR/musica.git
RUN git clone https://github.com/NCAR/musica.git
RUN cd musica \
&& git fetch \
&& git checkout v0.6.0 \
&& cmake \
-S . \
-B build \
-D USE_MUSICA=ON \
-D USE_MUSICA_FORTRAN=OFF \
-D MAKE_MUSICA_FORTRAN_INSTALLABLE=ON \
-D ENABLE_MICM=ON \
-D ENABLE_TESTS=OFF \
-D ENABLE_TUVX=OFF \
-D MUSICA_ENABLE_TESTS=OFF \
&& cd build \
&& make install -j 8

RUN ln -s /usr/local/musica-0.5.0/lib/libmusica.a /usr/local/lib/libmusica.a
ENV MUSICA_VERSION="0.5.0"
&& make install

COPY . atmospheric_physics

Expand All @@ -64,7 +48,7 @@ ENV CCPP_SRC_PATH="lib/ccpp-framework/src"
RUN cd atmospheric_physics/test \
&& cmake -S. \
-B build \
-D ENABLE_MICM_TEST=ON \
-D CCPP_ENABLE_MUSICA_TESTS=ON \
&& cmake --build ./build

RUN cd atmospheric_physics \
Expand Down
14 changes: 5 additions & 9 deletions test/musica/micm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
find_package(PkgConfig REQUIRED)
pkg_check_modules(netcdff IMPORTED_TARGET REQUIRED netcdf-fortran)

find_package(musica ${MUSICA_VERSION} REQUIRED)
message(STATUS " MUSICA version ${MUSICA_VERSION}")

include(FetchContent)

FetchContent_Declare(musica
GIT_REPOSITORY https://github.com/NCAR/musica.git
GIT_TAG 8ab0aa0
GIT_TAG v0.6.1
)

set(USE_MUSICA OFF)
set(USE_MUSICA_FORTRAN ON)
set(MAKE_MUSICA_FORTRAN_INSTALLABLE OFF)
set(ENABLE_TUVX OFF)
set(ENABLE_TESTS OFF)
set(MUSICA_ENABLE_TESTS OFF)
set(MUSICA_BUILD_C_CXX_INTERFACE OFF)
set(MUSICA_BUILD_FORTRAN_INTERFACE ON)
set(MUSICA_ENABLE_TUVX OFF)

FetchContent_MakeAvailable(musica)

Expand Down