Skip to content

Commit 610fcbb

Browse files
authored
Merge pull request #18 from cropsinsilico/conda_recipe
Conda recipe
2 parents dfd4073 + 293bd8c commit 610fcbb

File tree

13 files changed

+895
-113
lines changed

13 files changed

+895
-113
lines changed

.github/workflows/conda_recipe.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Test of conda recipe build
2+
'on':
3+
push:
4+
branches-ignore:
5+
- gh-pages
6+
tags:
7+
- '*'
8+
schedule:
9+
- cron: 0 10 * * 1
10+
jobs:
11+
build_conda_recipe:
12+
runs-on: ${{ matrix.os }}
13+
defaults:
14+
run:
15+
shell: bash -el {0}
16+
strategy:
17+
matrix:
18+
sundials-version: [latest]
19+
os: [ubuntu-latest, macos-latest, windows-latest]
20+
fail-fast: false
21+
steps:
22+
- name: Check out repository code
23+
uses: actions/checkout@v4
24+
with:
25+
submodules: true
26+
27+
###################################
28+
# CONDA SETUP
29+
###################################
30+
- name: Set up MSVC Compiler on windows
31+
uses: ilammy/msvc-dev-cmd@v1
32+
if: matrix.os == 'windows-latest'
33+
- name: Set up miniconda test environment (W/O MPI)
34+
uses: conda-incubator/setup-miniconda@v3
35+
with:
36+
activate-environment: ""
37+
auto-activate-base: true
38+
auto-update-conda: true
39+
channels: conda-forge
40+
channel-priority: strict
41+
miniforge-variant: Miniforge3
42+
miniforge-version: latest
43+
conda-remove-defaults: true
44+
- name: Install conda-build
45+
run: |
46+
conda info
47+
conda list
48+
conda install conda-build py-lief=0.14 cmake numpy -y
49+
- name: Check conda installation
50+
run: |
51+
conda info
52+
conda list
53+
- name: Build conda recipe
54+
run: |
55+
conda-build --use-local --no-anaconda-upload --output-folder ./local_channel/ recipe/
56+
- name: Install from local conda recipe
57+
run: |
58+
conda install -c ./local_channel ePhotosynthesis
59+
conda list
60+
61+
###################################
62+
# Test
63+
###################################
64+
- name: Test ePhoto executable install by conda
65+
run: |
66+
ePhoto -d 4 --evn tests/data/InputEvn.txt --grn tests/data/InputGRNC.txt --enzyme tests/data/InputEnzyme.txt --atpcost tests/data/InputATPCost.txt --output output_conda.data
67+
- name: Check output from ePhoto executable install by conda
68+
run: |
69+
python scripts/devtasks.py compare-files output_conda.data --driver 4
70+
- name: Build example against the installed library using CMake/Make (Unix)
71+
if: matrix.os != 'windows-latest'
72+
run: |
73+
conda list
74+
cd tests/external
75+
mkdir build
76+
cd build
77+
cmake .. -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
78+
cmake --build .
79+
- name: Build example against the installed library using CMake/Ninja (Windows)
80+
if: matrix.os == 'windows-latest'
81+
run: |
82+
conda list
83+
cd tests/external
84+
mkdir build
85+
cd build
86+
cmake -GNinja -D CMAKE_BUILD_TYPE=Release -D CMAKE_VERBOSE_MAKEFILE:BOOL=ON ..
87+
cmake --build .
88+
- name: Test built example executable (Unix)
89+
if: matrix.os != 'windows-latest'
90+
run: |
91+
cd tests
92+
./external/build/example
93+
- name: Test built example executable (Windows)
94+
if: matrix.os == 'windows-latest'
95+
run: |
96+
cd tests
97+
ls
98+
ls ./external/build/
99+
# ./external/build/Release/example
100+
./external/build/example
101+
- name: Check built example executable output
102+
run: |
103+
python scripts/devtasks.py compare-files tests/example_output.data --driver 4

.github/workflows/test-suite.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ jobs:
123123
auto-update-conda: true
124124
channels: conda-forge
125125
channel-priority: strict
126+
miniforge-variant: Miniforge3
126127
miniforge-version: latest
127-
use-mamba: true
128-
mamba-version: "1.5.10"
129128
conda-remove-defaults: true
130129
- name: Set up miniconda test environment (W/ MPI)
131130
if: matrix.with-mpi == true
@@ -136,9 +135,8 @@ jobs:
136135
auto-update-conda: true
137136
channels: conda-forge
138137
channel-priority: strict
138+
miniforge-variant: Miniforge3
139139
miniforge-version: latest
140-
use-mamba: true
141-
mamba-version: "1.5.10"
142140
conda-remove-defaults: true
143141
- name: Set USERPROFILE
144142
if: matrix.os == 'windows-latest'
@@ -147,25 +145,25 @@ jobs:
147145
- name: Install specific version of Sundials via conda
148146
if: matrix.sundials-version != 'latest' && matrix.with-mpi == false
149147
run: |
150-
mamba install sundials==${{ matrix.sundials-version }} -y
151-
- name: Check mamba installation
148+
conda install sundials==${{ matrix.sundials-version }} -y
149+
- name: Check conda installation
152150
run: |
153-
mamba info
154-
mamba list
151+
conda info
152+
conda list
155153
- name: Install doxgen on unix systems
156154
if: matrix.os != 'windows-latest'
157155
run: |
158-
mamba install doxygen>=1.9.2 graphviz -y
156+
conda install doxygen>=1.9.2 graphviz -y
159157
- name: Install compilers using conda on Linux/Mac
160158
if: matrix.os != 'windows-latest' && matrix.with-valgrind != true
161159
run: |
162-
mamba install c-compiler cxx-compiler
160+
conda install c-compiler cxx-compiler
163161
- name: Install valgrind on unix systems (and required debug symbols)
164162
if: matrix.os != 'windows-latest' && matrix.with-valgrind == true
165163
run: |
166164
sudo apt-get update
167165
sudo apt-get install libc6-dbg
168-
mamba install valgrind
166+
conda install valgrind
169167
170168
###################################
171169
# INSTALL SUNDIALS W/ MPI
@@ -293,15 +291,15 @@ jobs:
293291
- name: Test C++
294292
if: matrix.with-coverage != true
295293
run: |
296-
mamba list
294+
conda list
297295
echo "PATH=$PATH"
298296
cd build
299297
which ctest
300298
ctest ${{ env.TEST_FLAGS }}
301299
- name: Test C++ (COVERAGE)
302300
if: matrix.with-coverage && matrix.os != 'windows-latest'
303301
run: |
304-
mamba list
302+
conda list
305303
echo "PATH=$PATH"
306304
cd build
307305
make coverage

CMakeLists.txt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set(PACKAGE_STRING "ePhotosynthesis 1.0.0")
3535

3636
set(PACKAGE_VERSION_MAJOR "1")
3737
set(PACKAGE_VERSION_MINOR "0")
38-
set(PACKAGE_VERSION_PATCH "0")
38+
set(PACKAGE_VERSION_PATCH "1")
3939
set(PACKAGE_VERSION_LABEL "")
4040

4141
if(PACKAGE_VERSION_LABEL)
@@ -246,7 +246,7 @@ install(
246246
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
247247
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
248248
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
249-
PUBLIC_HEADER DESTINATION EPHOTOSYNTHESIS_INSTALL_INCLUDEDIR
249+
PUBLIC_HEADER DESTINATION ${EPHOTOSYNTHESIS_INSTALL_INCLUDEDIR}
250250
COMPONENT CXX
251251
)
252252
install(
@@ -272,11 +272,21 @@ install(
272272
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ePhotosynthesis
273273
COMPONENT CXX
274274
)
275+
install(
276+
FILES cmake/FindSUNDIALS.cmake
277+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ePhotosynthesis
278+
COMPONENT CXX
279+
)
275280
install(
276281
FILES ${CMAKE_CURRENT_BINARY_DIR}/ePhotosynthesis_export.h
277282
DESTINATION ${EPHOTOSYNTHESIS_INSTALL_INCLUDEDIR}
278283
COMPONENT CXX
279284
)
285+
install(
286+
DIRECTORY include/
287+
DESTINATION ${EPHOTOSYNTHESIS_INSTALL_INCLUDEDIR}
288+
COMPONENT CXX
289+
)
280290
# install(
281291
# DIRECTORY param
282292
# DESTINATION ${EPHOTOSYNTHESIS_INSTALL_INCLUDEDIR}
@@ -463,7 +473,10 @@ if(BUILD_TESTS)
463473

464474
set(TEST_LIST "")
465475
foreach(TEST_PATH ${TEST_SOURCES})
466-
list(APPEND TEST_LIST ${TEST_PATH})
476+
if(NOT TEST_PATH MATCHES ".*external.*")
477+
message(STATUS "TEST_PATH = ${TEST_PATH}")
478+
list(APPEND TEST_LIST ${TEST_PATH})
479+
endif()
467480
endforeach()
468481
add_executable(testRunner ${TEST_LIST})
469482
target_link_libraries(testRunner EPhotosynthesis)

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ePhotosynthesis
22

3-
This is a C++ port of the ePhotosynthesis Matlab model code. The code is built with
3+
This is a C++ port of the ePhotosynthesis Matlab model code. ePhotosynthesis is a dynamic mechanistic model of photosynthesis. The code is built with
44
*CMake*.
55

66
The Matlab origin code is tagged [C++ conversion](https://github.com/cropsinsilico/ePhotosynthesis/releases/tag/1.0.0). The scripts
@@ -134,4 +134,8 @@ The ePhotosynthesis executable is named `ePhoto` and takes the following argumen
134134
--debugDelta Debug deltas
135135
--debugInternal Debug internals
136136
137-
```
137+
```
138+
139+
### Citation
140+
141+
Zhu XG, Wang Y, Ort DR, Long SP. e-Photosynthesis: a comprehensive dynamic mechanistic model of C3 photosynthesis: from light capture to sucrose synthesis. Plant Cell Environ. 2013 Sep;36(9):1711-27. doi: 10.1111/pce.12025. Epub 2012 Nov 19. PMID: 23072293.

bin/ePhotosynthesis.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,7 @@
2929
#include <vector>
3030

3131
#include "cxxopts.hpp"
32-
#include "globals.hpp"
33-
#include "modules/trDynaPS.hpp"
34-
#include "modules/CM.hpp"
35-
#include "modules/EPS.hpp"
36-
#include "modules/PR.hpp"
37-
#include "modules/BF.hpp"
38-
#include "modules/FI.hpp"
39-
#include "drivers/drivers.hpp"
40-
#include "Variables.hpp"
32+
#include "ePhotosynthesis.hpp"
4133

4234

4335
using namespace ePhotosynthesis;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include(CMakeFindDependencyMacro)
22
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
33
find_dependency(Boost REQUIRED COMPONENTS regex)
4-
find_dependency(Sundials REQUIRED)
4+
find_dependency(SUNDIALS REQUIRED COMPONENTS kinsol cvode)
55
include(${CMAKE_CURRENT_LIST_DIR}/ePhotosynthesisTargets.cmake)
66
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CACHE INTERNAL "CMAKE_MODULE_PATH")

include/ePhotosynthesis.hpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**********************************************************************************************************************************************
2+
* Copyright Xin-Guang Zhu, Yu Wang, Donald R. ORT and Stephen P. LONG
3+
*
4+
* CAS-MPG Partner Institute for Computational Biology, Shanghai Institutes for Biological Sciences, CAS, Shanghai,200031
5+
* China Institute of Genomic Biology and Department of Plant Biology, Shanghai Institutes for Biological Sciences, CAS, Shanghai,200031
6+
* University of Illinois at Urbana Champaign
7+
* Global Change and Photosynthesis Research Unit, USDA/ARS, 1406 Institute of Genomic Biology, Urbana, IL 61801, USA.
8+
*
9+
* Converted from Matlab to C++ by Douglas N. Friedel, National Center for Supercomputing Applications (2020)
10+
*
11+
* This file is part of e-photosynthesis.
12+
*
13+
* e-photosynthesis is free software; you can redistribute it and/or modify
14+
* it under the terms of the GNU General Public License as published by
15+
* the Free Software Foundation;
16+
*
17+
* e-photosynthesis is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License (GPL)
23+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24+
*
25+
**********************************************************************************************************************************************/
26+
27+
#include "globals.hpp"
28+
#include "modules/trDynaPS.hpp"
29+
#include "modules/CM.hpp"
30+
#include "modules/EPS.hpp"
31+
#include "modules/PR.hpp"
32+
#include "modules/BF.hpp"
33+
#include "modules/FI.hpp"
34+
#include "drivers/drivers.hpp"
35+
#include "Variables.hpp"

recipe/bld.bat

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@setlocal
2+
set CONFIGURATION=Release
3+
4+
mkdir conda_build
5+
cd conda_build
6+
7+
:: Call cmake
8+
cmake -GNinja ^
9+
-D CMAKE_BUILD_TYPE=%CONFIGURATION% ^
10+
-D CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
11+
-D CMAKE_VERBOSE_MAKEFILE=ON ..
12+
if errorlevel 1 exit 1
13+
14+
:: Using ninja
15+
ninja all
16+
ninja install
17+
18+
:: Run tests
19+
if errorlevel 1 exit 1
20+
ctest -C "%Configuration%" -V
21+
if errorlevel 1 exit 1
22+
23+
@endlocal

recipe/build.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
set -euo pipefail
3+
4+
# Using cmake
5+
mkdir conda_build
6+
cd conda_build
7+
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=$PREFIX ..
8+
9+
# Make all, run tests, then install
10+
make all VERBOSE=1
11+
ctest -V
12+
make install

0 commit comments

Comments
 (0)