Skip to content

Commit

Permalink
merging changes from main
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewGraus committed Feb 26, 2025
2 parents c061871 + 9040a21 commit e7796d7
Show file tree
Hide file tree
Showing 115 changed files with 6,867 additions and 6,562 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/ecosim-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: EcoSIM CI

on: [workflow_dispatch, push, pull_request]

#env:
# Customizing build type
# BUILD_TYPE: DEBUG

jobs:
build-ubuntu:
runs-on: ubuntu-latest

steps:

- name: package-install
run: |
sudo apt-get -qq update
sudo apt -qq -y install gfortran cmake
sudo apt -qq -y install libcurl4 libcurl4-gnutls-dev curl
sudo apt -qq -y install autoconf automake
# if/when system hdf5 is needed
# sudo apt -qq -y libhdf5-openmpi-dev

- uses: actions/checkout@v4
with:
submodules: recursive

- name: ecosim-build
shell: bash
run: |
echo "Building EcoSIM"
bash build_EcoSIM.sh CC=`which gcc` CXX=`which g++` FC=`which gfortran`
#
# continue-on-error: true
#
# - name: did-build-ubuntu-fail
# run: |
# cat build/Linux-x86_64-double-Debug/3rd-partylibs/netcdf_c_config*.log

build-rocky:
runs-on: ubuntu-latest

container:
image: rockylinux/rockylinux:8.10

steps:
- uses: actions/checkout@v4
- name: package-install-rocky
run: |
cat /etc/os-release
dnf -qq -y update
dnf -qq -y install gcc-gfortran gcc-c++
dnf -qq -y install cmake
dnf -qq -y install which
dnf -qq -y install git
dnf -qq -y install curl curl-devel
dnf -qq -y install autoconf automake libtool libxml2-devel
# if/when system hdf5 is needed
# dnf install -y dnf-plugins-core
# dnf install -y epel-release
# dnf config-manager -y --set-enabled powertools
# dnf install -y hdf5 hdf5-devel hdf5-static

- uses: actions/checkout@v4
with:
submodules: recursive

- name: ecosim-build-rocky
shell: bash
run: |
echo "Building EcoSIM"
bash build_EcoSIM.sh CC=`which gcc` CXX=`which g++` FC=`which gfortran`
# continue-on-error: true
# - name: did-build-rocky-fail
# run: |
# cat build/Linux-x86_64-double-Debug/3rd-partylibs/netcdf_c_config*.log
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,9 @@ if (ATS_ECOSIM)
endif()

set(ECOSIM_TPLS "${NETCDF_FLIBS} ${NETCDF_CLIBS} ${Z_LIBRARY} ${HDF5_LIBRARY} -lhdf5_hl -ldl -lz -lcurl -lhdf5 -lnetcdf -lnetcdff")

else()
add_subdirectory(3rd-partylibs)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffpe-trap=invalid,zero,overflow,underflow")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NETCDF_CFLAGS} -ffpe-trap=invalid,zero,overflow,underflow")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${NETCDF_FFLAGS} -ffpe-trap=invalid,zero,overflow,underflow")

#string(REPLACE "-ffpe-trap=invalid" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
endif()
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ git clone --recursive git@github.com:jinyun1tang/EcoSIM.git

## Building

use the script to build the code:
Use the script in the root directory to build the code:

sh build_EcoSIM.sh

you can also run as a bash script:
or run it as a bash script:

./build_EcoSIM.sh

This should build and link all the required tpls
This should do everything including building and linking all the required tpls, and configuring, building and linking EcoSIM itself.

The executable will be found in ./build/bin/ecosim.f90.x

This has been tested with gcc on multiple systems, but not intel compilers
This has been tested with gcc on multiple systems, but not intel compilers. See the .github/workflow/ecosim-ci.yml file for examples. You will need cmake to use the build_EcoSIM.sh script.

## additional options
## Additional options

Opening the build_EcoSIM.sh script there are some opttional parameters you can set:
The build_EcoSIM.sh script lets you set some opttional parameters:

debug=0
mpi=0
Expand All @@ -46,7 +46,7 @@ You can also set options via the command line, for example:

./build_EcoSIM.sh CC=/path/to/cc CXX=/path/to/cxx FC=/path/to/fortran --debug --regression_test

run
Run

./build_EcoSIM.sh --help

Expand Down
8 changes: 4 additions & 4 deletions build_EcoSIM.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function status_message()

############# EDIT THESE! ##################

debug=1
debug=0
mpi=0
shared=0
verbose=1
Expand All @@ -35,9 +35,9 @@ systype=""
print_help() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " --CC=<compiler> Set C compiler"
echo " --CXX=<compiler> Set C++ compiler"
echo " --FC=<compiler> Set Fortran compiler"
echo " CC=<compiler> Set C compiler"
echo " CXX=<compiler> Set C++ compiler"
echo " FC=<compiler> Set Fortran compiler"
echo " --regression_test Enable regression test"
echo " --debug Enable debug mode"
echo " --mpi Enable MPI"
Expand Down
4 changes: 3 additions & 1 deletion cmake/Modules/set_up_compilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ macro(set_up_compilers)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-discarded-qualifiers")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-sign-conversion -Wno-maybe-uninitialized")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NETCDF_CFLAGS} -ffpe-trap=invalid,zero,overflow,underflow")

if (BUILD_SHARED_LIBS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIC")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffpe-trap=invalid,zero,overflow,underflow")

if (LINUX EQUAL 1)
# Counter some of GCC's more recent stinginess on Linux.
Expand Down Expand Up @@ -57,7 +59,7 @@ macro(set_up_compilers)

endif()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-double-8")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wno-unused-variable -ffpe-trap=invalid")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wno-unused-variable -ffpe-trap=invalid,zero,overflow,underflow")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wno-unused-parameter -Wno-unused-function")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wuninitialized -Wno-unused-dummy-argument")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none")
Expand Down
Loading

0 comments on commit e7796d7

Please sign in to comment.