From c59d8931af30836aa084a964ff7727add0dfe137 Mon Sep 17 00:00:00 2001
From: KyleKlenk <kyle.c.klenk@gmail.com>
Date: Wed, 23 Aug 2023 16:36:53 -0600
Subject: [PATCH] Created container for Summa_Actors and Fixed issues with
 compiling with g++11.

---
 build/includes/global/timing_info.hpp       |  1 +
 build/includes/job_actor/GRU.hpp            |  4 +-
 build/source/actors/job_actor/GRU.cpp       |  5 +++
 build/source/actors/job_actor/job_actor.cpp |  2 +-
 utils/containers/apptainer.def              | 49 +++++++++++++++++++++
 5 files changed, 57 insertions(+), 4 deletions(-)
 create mode 100644 utils/containers/apptainer.def

diff --git a/build/includes/global/timing_info.hpp b/build/includes/global/timing_info.hpp
index e246a6c..9244428 100644
--- a/build/includes/global/timing_info.hpp
+++ b/build/includes/global/timing_info.hpp
@@ -2,6 +2,7 @@
 #include <chrono>
 #include <optional>
 #include <vector>
+#include <string>
 
 using chrono_time = std::chrono::time_point<std::chrono::system_clock>;
 /**
diff --git a/build/includes/job_actor/GRU.hpp b/build/includes/job_actor/GRU.hpp
index 4d57edf..3c33f51 100644
--- a/build/includes/job_actor/GRU.hpp
+++ b/build/includes/job_actor/GRU.hpp
@@ -13,9 +13,7 @@ enum class gru_state {
     succeeded
 };
 
-auto success = [](const gru_state& state) -> int {
-    return(state == gru_state::succeeded) ? 1 : 0;
-};
+int is_success(const gru_state& state);
 
 /**
  * Class that holds information about the running GRUs. This class is held by the job actor
diff --git a/build/source/actors/job_actor/GRU.cpp b/build/source/actors/job_actor/GRU.cpp
index 9b43067..3f81ab2 100644
--- a/build/source/actors/job_actor/GRU.cpp
+++ b/build/source/actors/job_actor/GRU.cpp
@@ -4,6 +4,11 @@
 #include <fstream>
 
 
+int is_success(const gru_state& state) {
+
+  return(state == gru_state::succeeded) ? 1 : 0;
+}
+
 
 GRU::GRU(int global_gru_index, int local_gru_index, caf::actor gru_actor, 
          int dt_init_factor, double rel_tol, double abs_tol, int max_attempt) {
diff --git a/build/source/actors/job_actor/job_actor.cpp b/build/source/actors/job_actor/job_actor.cpp
index 96d4f77..4fa5583 100644
--- a/build/source/actors/job_actor/job_actor.cpp
+++ b/build/source/actors/job_actor/job_actor.cpp
@@ -267,7 +267,7 @@ std::vector<serializable_netcdf_gru_actor_info> getGruNetcdfInfo(int max_run_att
         gru_info.write_output_duration = gru->getWriteOutputDuration();
         
         gru_info.num_attempts = max_run_attempts - gru->getAttemptsLeft() + 1;
-        gru_info.successful = success(gru->getStatus());
+        gru_info.successful = is_success(gru->getStatus());
         gru_info.rel_tol = gru->getRelTol();
         gru_info.abs_tol = gru->getAbsTol();
 
diff --git a/utils/containers/apptainer.def b/utils/containers/apptainer.def
new file mode 100644
index 0000000..aa1f124
--- /dev/null
+++ b/utils/containers/apptainer.def
@@ -0,0 +1,49 @@
+Bootstrap: docker
+From: ubuntu:22.04
+
+%post
+    apt-get update -y
+    apt-get install locales -y
+    locale-gen en_CA.UTF-8
+    apt-get upgrade -y
+
+    # Install dependencies
+    DEBIAN_FRONTEND="noninteractive" apt-get install -y software-properties-common \
+        libnetcdf-dev \
+        libnetcdff-dev \
+        liblapack-dev \
+        libopenblas-dev \
+        cmake \
+        g++ \
+        git \
+        libssl-dev \
+        make \
+        gfortran \
+        wget \
+        python3-pip \
+        valgrind \
+        gdb &&\
+        apt-get autoclean
+
+    # Install Sundials v6.6
+    cd /opt
+    wget https://github.com/LLNL/sundials/releases/download/v6.6.0/sundials-6.6.0.tar.gz
+    tar -xzf sundials-6.6.0.tar.gz
+    mkdir /usr/local/sundials/
+    mkdir /usr/local/sundials/v6.6
+    cd sundials-6.6.0
+    mkdir build
+    cd build
+    cmake .. -DBUILD_FORTRAN_MODULE_INTERFACE=ON -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_INSTALL_PREFIX=/usr/local/sundials/v6.6 -DEXAMPLES_INSTALL_PATH=/usr/local/sundials/v6.6/examples
+    make
+    make install
+
+    # Install C++ Actor Framework
+    cd /opt
+    wget https://github.com/actor-framework/actor-framework/archive/refs/tags/0.18.6.tar.gz
+    tar -xzf 0.18.6.tar.gz
+    cd actor-framework-0.18.6
+    ./configure
+    cd build
+    make
+    make install
\ No newline at end of file
-- 
GitLab