Skip to content

Commit d9b66d9

Browse files
Make rte-rrtmgp a local repo
1 parent 7417440 commit d9b66d9

File tree

185 files changed

+39521
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+39521
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
target-branch: "develop"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Continuous Integration
2+
on: [push, pull_request]
3+
4+
jobs:
5+
CI:
6+
runs-on: ubuntu-22.04
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
cxx-compiler: [gcc]
11+
env:
12+
CC: ${{ matrix.cxx-compiler }}
13+
CXX: ${{ matrix.cxx-compiler }}
14+
15+
steps:
16+
#
17+
# Checks-out repository under $GITHUB_WORKSPACE
18+
#
19+
- uses: actions/checkout@v3
20+
with:
21+
submodules: recursive
22+
#
23+
# Synchronize the package index
24+
#
25+
- name: Synchronize the package index
26+
run: sudo apt-get update
27+
28+
- name: Install dependencies
29+
run: |
30+
sudo apt-get update -qq
31+
sudo apt-get install -y gfortran libnetcdf-dev cmake libboost-dev python3-pip python3-setuptools nco
32+
sudo apt-get install ${{ matrix.cxx-compiler }}
33+
pip3 install --user numpy netcdf4 dask[array] xarray
34+
35+
- name: Build
36+
run: |
37+
mkdir build
38+
cd build
39+
cmake -DSYST=ubuntu_22lts ..
40+
make
41+
42+
- name: Run tests
43+
run: |
44+
cd rfmip
45+
./make_links.sh
46+
python3 stage_files.py
47+
python3 rfmip_init.py
48+
python3 rfmip_run.py
49+
cd ../allsky
50+
./make_links.sh
51+
python3 allsky_init.py
52+
python3 allsky_run.py
53+
54+
- name: Check results
55+
run: |
56+
cd rfmip
57+
python3 compare-to-reference.py --fail=7.e-4
58+
cd ../allsky
59+
python3 allsky_check.py
60+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "rte-rrtmgp"]
2+
path = rte-rrtmgp
3+
url = https://github.com/earth-system-radiation/rte-rrtmgp
4+
[submodule "rrtmgp-data"]
5+
path = rrtmgp-data
6+
url = https://github.com/earth-system-radiation/rrtmgp-data
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
dist: bionic
2+
3+
branches:
4+
only:
5+
- master
6+
7+
language: cpp
8+
9+
compiler:
10+
- gcc
11+
- clang
12+
13+
before_install:
14+
- sudo apt-get update -qq
15+
- sudo apt-get install -y gfortran libnetcdf-dev cmake libboost-dev python3-pip python3-setuptools nco
16+
- pip3 install --user numpy netcdf4 dask[array] xarray
17+
18+
before_script:
19+
- mkdir build
20+
- cd build
21+
- cmake -DSYST=ubuntu ..
22+
- make
23+
- cd ..
24+
25+
script:
26+
- cd rfmip
27+
- ./make_links.sh
28+
- python3 stage_files.py
29+
- python3 rfmip_init.py
30+
- python3 rfmip_run.py
31+
- python3 compare-to-reference.py --fail=7.e-4
32+
- cd ..
33+
- cd allsky
34+
- ./make_links.sh
35+
- python3 allsky_init.py
36+
- python3 allsky_run.py
37+
- python3 compare-to-reference.py
38+
39+
#notifications:
40+
# slack: microhh:hA8nIix9Z34cn6uG8xnz8Uiu
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#
2+
# This file is part of a C++ interface to the Radiative Transfer for Energetics (RTE)
3+
#
4+
cmake_minimum_required (VERSION 3.12)
5+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/config)
6+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
7+
8+
# Set the precision of the build.
9+
if(USESP)
10+
message(STATUS "Precision: Single (32-bits floats)")
11+
add_compile_definitions(RTE_USE_SP)
12+
else()
13+
message(STATUS "Precision: Double (64-bits floats)")
14+
endif()
15+
16+
# Load system specific settings if not set, force default.cmake.
17+
if(NOT SYST)
18+
set(SYST default)
19+
endif()
20+
include(${SYST} OPTIONAL RESULT_VARIABLE SYSTINC)
21+
22+
# Trigger fatal error if illegal module is loaded.
23+
if(${SYSTINC} STREQUAL "NOTFOUND")
24+
message(FATAL_ERROR "Config file config/" ${SYST} ".cmake does not exist.")
25+
endif()
26+
27+
# Set the default build type to RELEASE.
28+
if(NOT CMAKE_BUILD_TYPE)
29+
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING
30+
"Choose the type of build, options are: None Debug Release." FORCE)
31+
else()
32+
string(TOUPPER ${CMAKE_BUILD_TYPE} TEMP)
33+
set(CMAKE_BUILD_TYPE ${TEMP} CACHE STRING
34+
"Choose the type of build, options are: None Debug Release." FORCE)
35+
endif()
36+
37+
# Start the project only after the system specific settings are loaded.
38+
if(USECUDA)
39+
project(rte-rrtmgp-cpp C CXX Fortran CUDA)
40+
else()
41+
project(rte-rrtmgp-cpp C CXX Fortran)
42+
endif()
43+
44+
# Load the CUDA module in case CUDA is enabled and display status message.
45+
if(USECUDA)
46+
message(STATUS "CUDA: Enabled.")
47+
add_definitions("-DUSECUDA")
48+
else()
49+
message(STATUS "CUDA: Disabled.")
50+
endif()
51+
52+
# Only set the compiler flags when the cache is created
53+
# to enable editing of the flags in the CMakeCache.txt file.
54+
if(NOT HASCACHE)
55+
set(CMAKE_C_FLAGS ${USER_C_FLAGS} CACHE STRING
56+
"Flags used by the C-compiler during all build types." FORCE)
57+
set(CMAKE_C_FLAGS_DEBUG ${USER_C_FLAGS_DEBUG} CACHE STRING
58+
"Flags used by the C-compiler during debug builds." FORCE)
59+
set(CMAKE_C_FLAGS_RELEASE ${USER_C_FLAGS_RELEASE} CACHE STRING
60+
"Flags used by the C-compiler during release builds." FORCE)
61+
62+
set(CMAKE_CXX_FLAGS ${USER_CXX_FLAGS} CACHE STRING
63+
"Flags used by the CXX-compiler during all build types." FORCE)
64+
set(CMAKE_CXX_FLAGS_DEBUG ${USER_CXX_FLAGS_DEBUG} CACHE STRING
65+
"Flags used by the CXX-compiler during debug builds." FORCE)
66+
set(CMAKE_CXX_FLAGS_RELEASE ${USER_CXX_FLAGS_RELEASE} CACHE STRING
67+
"Flags used by the CXX-compiler during release builds." FORCE)
68+
69+
set(CMAKE_Fortran_FLAGS ${USER_FC_FLAGS} CACHE STRING
70+
"Flags used by the Fortran-compiler during all build types." FORCE)
71+
set(CMAKE_Fortran_FLAGS_DEBUG ${USER_FC_FLAGS_DEBUG} CACHE STRING
72+
"Flags used by the Fortran-compiler during debug builds." FORCE)
73+
set(CMAKE_Fortran_FLAGS_RELEASE ${USER_FC_FLAGS_RELEASE} CACHE STRING
74+
"Flags used by the Fortran-compiler during release builds." FORCE)
75+
76+
if(USECUDA)
77+
set(CMAKE_CUDA_FLAGS ${USER_CUDA_FLAGS} CACHE STRING
78+
"Flags used by the CXX-compiler during all build types." FORCE)
79+
set(CMAKE_CUDA_FLAGS_DEBUG ${USER_CUDA_FLAGS_DEBUG} CACHE STRING
80+
"Flags used by the CXX-compiler during debug builds." FORCE)
81+
set(CMAKE_CUDA_FLAGS_RELEASE ${USER_CUDA_FLAGS_RELEASE} CACHE STRING
82+
"Flags used by the CXX-compiler during release builds." FORCE)
83+
endif()
84+
85+
message(STATUS "Build Type: " ${CMAKE_BUILD_TYPE})
86+
set(HASCACHE TRUE CACHE BOOL "CMakeCache.txt created." FORCE)
87+
88+
# Make sure that ccmake only contains build type.
89+
mark_as_advanced(HASCACHE)
90+
mark_as_advanced(CMAKE_INSTALL_PREFIX)
91+
endif()
92+
93+
# Print the C++ and CUDA compiler flags to the screen.
94+
if(CMAKE_BUILD_TYPE STREQUAL "RELEASE")
95+
message(STATUS "CXX-compiler flags: " ${CMAKE_CXX_FLAGS} " " ${CMAKE_CXX_FLAGS_RELEASE})
96+
message(STATUS "Fortran-compiler flags: " ${CMAKE_CXX_FLAGS} " " ${CMAKE_CXX_FLAGS_RELEASE})
97+
else()
98+
message(STATUS "CXX-compiler flags: " ${CMAKE_CXX_FLAGS} " " ${CMAKE_CXX_FLAGS_DEBUG})
99+
message(STATUS "Fortran-compiler flags: " ${CMAKE_CXX_FLAGS} " " ${CMAKE_CXX_FLAGS_DEBUG})
100+
endif()
101+
if(USECUDA)
102+
if(CMAKE_BUILD_TYPE STREQUAL "RELEASE")
103+
message(STATUS "NVCC-compiler flags: " ${CMAKE_CUDA_FLAGS} " " ${CMAKE_CUDA_FLAGS_RELEASE})
104+
else()
105+
message(STATUS "NVCC-compiler flags: " ${CMAKE_CUDA_FLAGS} " " ${CMAKE_CUDA_FLAGS_DEBUG})
106+
endif()
107+
endif()
108+
109+
add_subdirectory(src_kernels)
110+
add_subdirectory(src)
111+
if(USECUDA)
112+
add_subdirectory(src_kernels_cuda)
113+
add_subdirectory(src_cuda)
114+
add_subdirectory(src_kernels_cuda_rt)
115+
add_subdirectory(src_cuda_rt)
116+
endif()
117+
add_subdirectory(src_test)
118+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2015-2018, Atmospheric and Environmental Research and Regents of the University of Colorado.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)