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

Add recipe for rte-rrtmgp #28640

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
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
29 changes: 29 additions & 0 deletions recipes/rte-rrtmgp/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2015-2018, Atmospheric and Environmental Research and Regents of the University of Colorado.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 changes: 46 additions & 0 deletions recipes/rte-rrtmgp/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@echo off
:: Stop on any error
setlocal ENABLEEXTENSIONS

set BUILD_DIR=build
set BUILD_TYPE=Debug

set "HOST=x86_64-w64-mingw32"
set "FC=%HOST%-gfortran.exe"
set FCFLAGS="-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan -fbacktrace"

set BUILD_TESTING=ON
set RTE_ENABLE_SP=OFF
set KERNEL_MODE=default
set FAILURE_THRESHOLD='7.e-4'

:: Ensure the directories exist
if not exist %BUILD_DIR% mkdir %BUILD_DIR%
if not exist %PREFIX%/lib mkdir %PREFIX%/lib
if not exist %PREFIX%/include mkdir %PREFIX%/include

:: Note: $CMAKE_ARGS is automatically provided by conda-forge.
:: It sets default paths and platform-independent CMake arguments.
cmake -S . -B %BUILD_DIR% ^
%CMAKE_ARGS% ^
-DCMAKE_Fortran_COMPILER=%FC% ^
-DCMAKE_Fortran_FLAGS=%FCFLAGS% ^
-DRTE_ENABLE_SP=%RTE_ENABLE_SP% ^
-DKERNEL_MODE=%KERNEL_MODE% ^
-DBUILD_TESTING=%BUILD_TESTING% ^
-DFAILURE_THRESHOLD=%FAILURE_THRESHOLD% ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-G Ninja

:: Compile
cmake --build %BUILD_DIR% --parallel

:: Install the necessery files into the package
cmake --install %BUILD_DIR% --prefix %PREFIX%

:: Run tests
ctest --output-on-failure --test-dir %BUILD_DIR% -V

if /I "%RUN_VALIDATION_PLOTS%"=="True" (
cmake --build %BUILD_DIR% --target validation-plots
)
44 changes: 44 additions & 0 deletions recipes/rte-rrtmgp/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
# Stop on any error
set -e

BUILD_DIR=build
BUILD_TYPE=Debug

FFLAGS='-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fmodule-private -fimplicit-none -finit-real=nan'

BUILD_TESTING=ON
RTE_ENABLE_SP=OFF
KERNEL_MODE=default
FAILURE_THRESHOLD='7.e-4'

# Ensure the directories exist
mkdir -p "${BUILD_DIR}"
mkdir -p $PREFIX/lib
mkdir -p $PREFIX/include

# Note: $CMAKE_ARGS is automatically provided by conda-forge.
# It sets default paths and platform-independent CMake arguments.
cmake -S . -B ${BUILD_DIR} \
${CMAKE_ARGS} \
-DCMAKE_Fortran_COMPILER=$FC \
-DCMAKE_Fortran_FLAGS="$FFLAGS" \
-DRTE_ENABLE_SP=$RTE_ENABLE_SP \
-DKERNEL_MODE=$KERNEL_MODE \
-DBUILD_TESTING=$BUILD_TESTING \
-DFAILURE_THRESHOLD=$FAILURE_THRESHOLD \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-G Ninja

# Compile
cmake --build ${BUILD_DIR} --parallel

# Install the necessery files into the package
cmake --install ${BUILD_DIR} --prefix "${PREFIX}"

# Run tests
ctest --output-on-failure --test-dir ${BUILD_DIR} -V

if [ "$RUN_VALIDATION_PLOTS" = "True" ]; then
cmake --build build --target validation-plots
fi
87 changes: 87 additions & 0 deletions recipes/rte-rrtmgp/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{% set name = "rte-rrtmgp" %}
{% set version = "0.0.1" %}
{% set run_validation_plots = false %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
# TODO: Set `makepath-cmake` to {{ version }} when we have real version
url: https://github.com/makepath-alex/rte-rrtmgp/archive/refs/heads/conda-recipe-dev.zip
sha256: da389230357cd905207a371c1239c375648f8ceec95cc4f677b5f4d76624c084

build:
number: 0
script_env:
- RUN_VALIDATION_PLOTS={{ run_validation_plots }}

requirements:
build:
# General
- cmake # CMake to configure the project
- ninja # Ninja to run the build
- python # Required for testing Python
- conda-forge::netcdf-fortran >=4.5,<5.0 # Required for testing Fortran NetCDF library
- netcdf4 # Required for testing
- xarray # Required for testing
- dask # Required for testing
- numpy # Required for testing
- matplotlib # [run_validation_plots]
- colorcet # [run_validation_plots]
- scipy # [run_validation_plots]
# Linux
- gcc_linux-64 # [linux]
- gxx_linux-64 # [linux]
- gfortran_linux-64 # [linux]
# MacOS
- clang_osx-64 # [osx]
- clangxx_osx-64 # [osx]
- gfortran_osx-64 # [osx]
# Win
- gcc_win-64 # [win]
- gxx_win-64 # [win]
- gfortran_win-64 # [win]
host:
# General
- cmake # CMake to configure the project
- python # Python required for running tests
- conda-forge::netcdf-fortran >=4.5,<5.0 # Required runtime for testing
# Linux
- gfortran_linux-64 # [linux]
# MacOS
- gfortran_osx-64 # [osx]
# Win
- gfortran_win-64 # [win]
run:
# General
- python

test:
commands:
# Check if the files exists
# Unix
- test -f $PREFIX/include/rrtmgp_kernels.h # [unix]
- test -f $PREFIX/include/rte_kernels.h # [unix]
- test -f $PREFIX/include/rte_types.h # [unix]
- test -f $PREFIX/lib/librte.a # [unix]
- test -f $PREFIX/lib/librrtmgp.a # [unix]
# Win (we build with mingw, so it generates .a files)
- if exist "%PREFIX%\include\rrtmgp_kernels.h" (exit /b 0) else (exit /b 1) # [win]
- if exist "%PREFIX%\include\rte_kernels.h" (exit /b 0) else (exit /b 1) # [win]
- if exist "%PREFIX%\include\rte_types.h" (exit /b 0) else (exit /b 1) # [win]
- if exist "%PREFIX%\lib\librte.a" (exit /b 0) else (exit /b 1) # [win]
- if exist "%PREFIX%\lib\librrtmgp.a" (exit /b 0) else (exit /b 1) # [win]

about:
home: https://github.com/earth-system-radiation/rte-rrtmgp
summary: Fortran codes for computing radiative fluxes in planetary atmospheres.
license: BSD-3-Clause
license_family: BSD
license_file: LICENSE.txt
doc_url: https://earth-system-radiation.github.io/rte-rrtmgp/how-tos/

extra:
recipe-maintainers:
- RobertPincus
- makepath-alex
Loading