From 58afd361a578fc6f44fb35700abb09b2362ecfb1 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Fri, 22 Mar 2024 16:47:09 -0500 Subject: [PATCH 01/12] new interface --- musica/micm/micm.F90 | 8 ++---- test/CMakeLists.txt | 8 +++--- test/docker/Dockerfile.musica | 46 +++++++++++---------------------- test/musica/micm/CMakeLists.txt | 16 +++++------- 4 files changed, 28 insertions(+), 50 deletions(-) diff --git a/musica/micm/micm.F90 b/musica/micm/micm.F90 index cbc94caf..988df9d2 100644 --- a/musica/micm/micm.F90 +++ b/musica/micm/micm.F90 @@ -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 @@ -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. & @@ -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 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 74db2091..5b02cc8c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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}) diff --git a/test/docker/Dockerfile.musica b/test/docker/Dockerfile.musica index 27bb7cef..5a0e6139 100644 --- a/test/docker/Dockerfile.musica +++ b/test/docker/Dockerfile.musica @@ -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 atmo_fixes \ && 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 @@ -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 \ diff --git a/test/musica/micm/CMakeLists.txt b/test/musica/micm/CMakeLists.txt index 65c65d53..95e339e1 100644 --- a/test/musica/micm/CMakeLists.txt +++ b/test/musica/micm/CMakeLists.txt @@ -1,6 +1,3 @@ -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}") @@ -8,14 +5,14 @@ include(FetchContent) FetchContent_Declare(musica GIT_REPOSITORY https://github.com/NCAR/musica.git - GIT_TAG 8ab0aa0 + GIT_TAG atmo_fixes + GIT_SUBMODULES ) -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) @@ -38,6 +35,7 @@ target_sources(test_micm_api target_link_libraries(test_micm_api PRIVATE + musica::musica musica::musica-fortran ) From 52e1bb5bfa94960b09958f61676f927766ac9ab4 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Fri, 22 Mar 2024 17:04:59 -0500 Subject: [PATCH 02/12] using better linkage --- test/musica/micm/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/test/musica/micm/CMakeLists.txt b/test/musica/micm/CMakeLists.txt index 95e339e1..5ce58fee 100644 --- a/test/musica/micm/CMakeLists.txt +++ b/test/musica/micm/CMakeLists.txt @@ -35,7 +35,6 @@ target_sources(test_micm_api target_link_libraries(test_micm_api PRIVATE - musica::musica musica::musica-fortran ) From ba7c419c4250166023b4b11dc3fc2c56bd3eb3b4 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Sat, 23 Mar 2024 16:10:08 -0500 Subject: [PATCH 03/12] using main --- test/musica/micm/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/musica/micm/CMakeLists.txt b/test/musica/micm/CMakeLists.txt index 5ce58fee..467a9a87 100644 --- a/test/musica/micm/CMakeLists.txt +++ b/test/musica/micm/CMakeLists.txt @@ -5,8 +5,7 @@ include(FetchContent) FetchContent_Declare(musica GIT_REPOSITORY https://github.com/NCAR/musica.git - GIT_TAG atmo_fixes - GIT_SUBMODULES + GIT_TAG main ) set(MUSICA_ENABLE_TESTS OFF) From 75e4e0d8510550c8f21c47da875b27a3bf592c17 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Sat, 23 Mar 2024 16:14:38 -0500 Subject: [PATCH 04/12] branch --- .github/workflows/test.yaml | 5 +---- test/docker/Dockerfile.musica | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fef84aea..998a668d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,9 +1,6 @@ name: build -on: - push: - pull_request: - types: [opened, reopened] +on: [pull_request,workflow_dispatch] jobs: test_micm_api: diff --git a/test/docker/Dockerfile.musica b/test/docker/Dockerfile.musica index 5a0e6139..49c196bb 100644 --- a/test/docker/Dockerfile.musica +++ b/test/docker/Dockerfile.musica @@ -29,7 +29,6 @@ ENV FFLAGS="-I/usr/include/" RUN git clone https://github.com/NCAR/musica.git RUN cd musica \ && git fetch \ - && git checkout atmo_fixes \ && cmake \ -S . \ -B build \ From 2f6b2559d0e2052c0deab0e458307fb07f2f330e Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 26 Mar 2024 13:58:30 -0500 Subject: [PATCH 05/12] using a musica tag --- test/musica/micm/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/musica/micm/CMakeLists.txt b/test/musica/micm/CMakeLists.txt index 467a9a87..487041b7 100644 --- a/test/musica/micm/CMakeLists.txt +++ b/test/musica/micm/CMakeLists.txt @@ -5,7 +5,7 @@ include(FetchContent) FetchContent_Declare(musica GIT_REPOSITORY https://github.com/NCAR/musica.git - GIT_TAG main + GIT_TAG v0.6.1 ) set(MUSICA_ENABLE_TESTS OFF) From b3f6f99994211cc9c2768eb9ff7463fa110c3de4 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 26 Mar 2024 14:25:56 -0500 Subject: [PATCH 06/12] updating changelog --- doc/ChangeLog | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index f315694e..df365cb8 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,32 @@ =============================================================== +Tag name:atmos_phys0_02_004 +Originator(s): kshores +Date: 12 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: + +See [https://github.com/ESCOMP/atmospheric_physics/pull/89](https://github.com/ESCOMP/atmospheric_physics/pull/89) +for a list of changed files and what changed. + +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 From c8db49f3815ee1bc4a339b72087879106cc8dc35 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 26 Mar 2024 14:27:39 -0500 Subject: [PATCH 07/12] updating tag number --- doc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index df365cb8..14a6cf5e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,6 @@ =============================================================== -Tag name:atmos_phys0_02_004 +Tag name:atmos_phys0_02_005 Originator(s): kshores Date: 12 Mar 2024 One-line Summary: Update MUSICA git tag From f9d3e33ebb906d7dc9407a313d11ae42894c27e7 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 26 Mar 2024 14:27:57 -0500 Subject: [PATCH 08/12] updating date --- doc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 14a6cf5e..95224967 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,7 +2,7 @@ Tag name:atmos_phys0_02_005 Originator(s): kshores -Date: 12 Mar 2024 +Date: 26 Mar 2024 One-line Summary: Update MUSICA git tag Github PR URL: https://github.com/ESCOMP/atmospheric_physics/pull/89 From 6272fd0379d54038190c5c3904d78e17928848f7 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Mon, 15 Apr 2024 15:05:31 -0500 Subject: [PATCH 09/12] writing changelog by hand rather than pointing to a PR link --- doc/ChangeLog | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 95224967..426c8f91 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -18,8 +18,14 @@ Code reviewed by: cacraigucar, boulderdaze List all existing files that have been added (A), modified (M), or deleted (D), and describe the changes: -See [https://github.com/ESCOMP/atmospheric_physics/pull/89](https://github.com/ESCOMP/atmospheric_physics/pull/89) -for a list of changed files and what changed. +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. From fabe391ac538ac8cbe52b6af6728d1d5c1b0bafd Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Mon, 15 Apr 2024 16:01:14 -0500 Subject: [PATCH 10/12] reruning on failed to see more errors --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 998a668d..b26d2664 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -12,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' \ No newline at end of file + run: docker run --name test-container -t musica bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"' \ No newline at end of file From 7a76c13d09f145a1036485e6a7304098f2f1d826 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Mon, 15 Apr 2024 16:40:07 -0500 Subject: [PATCH 11/12] checking out tag --- test/docker/Dockerfile.musica | 1 + 1 file changed, 1 insertion(+) diff --git a/test/docker/Dockerfile.musica b/test/docker/Dockerfile.musica index 49c196bb..247878d1 100644 --- a/test/docker/Dockerfile.musica +++ b/test/docker/Dockerfile.musica @@ -29,6 +29,7 @@ ENV FFLAGS="-I/usr/include/" RUN git clone https://github.com/NCAR/musica.git RUN cd musica \ && git fetch \ + && git checkout 0.6.0 \ && cmake \ -S . \ -B build \ From 7d9f5e574898910e9a7588768b6f3aa72694def1 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Mon, 15 Apr 2024 16:44:56 -0500 Subject: [PATCH 12/12] correcting tag --- test/docker/Dockerfile.musica | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/docker/Dockerfile.musica b/test/docker/Dockerfile.musica index 247878d1..7d14fc13 100644 --- a/test/docker/Dockerfile.musica +++ b/test/docker/Dockerfile.musica @@ -29,7 +29,7 @@ ENV FFLAGS="-I/usr/include/" RUN git clone https://github.com/NCAR/musica.git RUN cd musica \ && git fetch \ - && git checkout 0.6.0 \ + && git checkout v0.6.0 \ && cmake \ -S . \ -B build \