From cfe94524b43fa4989ca8ea07c65cfad15fc7c5aa Mon Sep 17 00:00:00 2001
From: Thomas <purcell@fhi-berlin.mpg.de>
Date: Mon, 6 Sep 2021 14:58:53 +0200
Subject: [PATCH] See if python documentation now builds

Add dependencies to the pages job
Some minor bug fixes
---
 .gitlab-ci.yml                                | 27 +++++++++++++++++--
 src/mpi_interface/MPI_Interface.cpp           |  7 -----
 src/mpi_interface/MPI_Interface.hpp           | 20 +++++---------
 .../test_feature_space/test_feature_space.py  |  2 ++
 4 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a728988e..4098c993 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -348,15 +348,38 @@ build-gnu-gcov:
     reports:
       cobertura: build_gcov/coverage.xml
 
+build-gnu-lcov:
+  stage: build
+  script:
+    - python -m venv cpp_sisso_gnu_lcov_env
+    - source cpp_sisso_gnu_lcov_env/bin/activate
+    - export LD_LIBRARY_PATH=$HOME/intel/oneapi/intelpython/latest/lib/:$HOME/intel/oneapi/intelpython/latest/lib/python3.7:$LD_LIBRARY_PATH
+    - export PYTHONPATH=$HOME/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/:`pwd`/cpp_sisso_gnu_lcov_env/lib/python3.7/site-packages/
+    - mkdir build_lcov/
+    - cd build_lcov/
+    - cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILE=gcc -DCMAKE_BUILD_TYPE="Coverage" -DBUILD_TESTS=ON -DBUILD_PARAMS=ON -DBUILD_PYTHON=ON  -DCMAKE_INSTALL_PREFIX=../gnu_lcov/ ../
+    - make install
+    - make coverage_html
+    - cd ../
+  artifacts:
+    when: always
+    paths:
+      - build_lcov/coverage_html
+      - cpp_sisso_gnu_lcov_env/
+
 pages:
   stage: doc_builds
+  dependencies:
+    - build-gnu-lcov
   script:
-    - source cpp_sisso_gnu_param_py_env/bin/activate
+    - source cpp_sisso_gnu_lcov_env/bin/activate
     - export LD_LIBRARY_PATH=$HOME/intel/oneapi/intelpython/latest/lib/:$HOME/intel/oneapi/intelpython/latest/lib/python3.7:$LD_LIBRARY_PATH
-    - export PYTHONPATH=$HOME/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/:cpp_sisso_gnu_param_py_env/lib/python3.7/site-packages/
+    - export PYTHONPATH=$HOME/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/:cpp_sisso_gnu_lcov_env/lib/python3.7/site-packages/
     - cd docs/
     - make html
     - mv _build/html/ ../public
+    - cd ../
+    - mv build_lcov/coverage_html/ public/coverage/
   artifacts:
     paths:
     - public
diff --git a/src/mpi_interface/MPI_Interface.cpp b/src/mpi_interface/MPI_Interface.cpp
index 3c7ddae0..8973fb73 100644
--- a/src/mpi_interface/MPI_Interface.cpp
+++ b/src/mpi_interface/MPI_Interface.cpp
@@ -40,13 +40,6 @@ std::array<int, 2> MPI_Interface::get_start_end_from_list(const int sz, const in
 
 std::shared_ptr<MPI_Interface> mpi_setup::comm;
 
-void mpi_setup::init_mpi_env(int& argc, char **&argv)
-{
-    if(env == 0)
-        env = new boost::mpi::environment(argc, argv);
-    comm = std::make_shared<MPI_Interface>();
-}
-
 void mpi_setup::init_mpi_env()
 {
     if(env == 0)
diff --git a/src/mpi_interface/MPI_Interface.hpp b/src/mpi_interface/MPI_Interface.hpp
index c1eb3650..6f939517 100644
--- a/src/mpi_interface/MPI_Interface.hpp
+++ b/src/mpi_interface/MPI_Interface.hpp
@@ -45,16 +45,16 @@ public:
     /**
      * @brief      Unique int tag generator
      *
-     * @param[in]  procSend   sending process
-     * @param[in]  procRecv   receiving process
-     * @param[in]  maxOffest  number of different communication processes possible between two processes within the same operation
-     * @param[in]  offest     the assigned offset corresponding to a single communication within the same operation
+     * @param[in]  proc_send   sending process
+     * @param[in]  proc_recv   receiving process
+     * @param[in]  max_offset  number of different communication processes possible between two processes within the same operation
+     * @param[in]  offset     the assigned offset corresponding to a single communication within the same operation
      *
      * @return     A unique tag to send information between two processes
      */
-    int cantor_tag_gen(const unsigned int procSend, const unsigned int procRecv, const unsigned int maxOffest, const unsigned int offest)
+    int cantor_tag_gen(const unsigned int proc_send, const unsigned int proc_recv, const unsigned int max_offset, const unsigned int offset)
     {
-        return (int((procSend + procRecv) * (procSend + procSend +1) / 2) + procRecv) * maxOffest + offest;
+        return (int((proc_send + proc_recv) * (proc_send + proc_send +1) / 2) + proc_recv) * max_offset + offset;
     }
 
     /**
@@ -74,14 +74,6 @@ namespace mpi_setup
     static mpi::environment* env = 0; //!< The MPI environment
     extern std::shared_ptr<MPI_Interface> comm; //!< The MPI communicator
 
-    /**
-     * @brief Initialize MPI enviroment
-     *
-     * @param argc from command line
-     * @param argv from command line
-     */
-    void init_mpi_env(int& argc, char **&argv);
-
     /**
      * @brief Initialize MPI enviroment
      *
diff --git a/tests/pytest/test_feature_creation/test_feature_space/test_feature_space.py b/tests/pytest/test_feature_creation/test_feature_space/test_feature_space.py
index 9a7dfe9a..878373f5 100644
--- a/tests/pytest/test_feature_creation/test_feature_space/test_feature_space.py
+++ b/tests/pytest/test_feature_creation/test_feature_space/test_feature_space.py
@@ -79,6 +79,8 @@ def test_feature_space():
         pass
 
     feat_space = FeatureSpace(inputs)
+    assert feat_space.phi0[0].expr == inputs.phi_0[0].expr
+
     feat_space.sis(inputs.prop_train)
 
     shutil.rmtree("feature_space/")
-- 
GitLab