Building Solstice

From ASCEND
Jump to: navigation, search
This article is incomplete or needs expanding. Please help out by adding your comments.
This page documents an experimental feature. Please tell us if you experience any problems.

Solstice is an open-source high-performance Monte Carlo ray-tracing package for use in solar energy simulations developed by Meso-Star for CNRS-PROMES. This page aims to summarise how to build Solstice on Ubuntu 18.04 using as many distro-provided packages as possible. Note that the Méso-Star team provides another build process for Solstice, star-engine which you may find more convenient.

Packages not included in Ubuntu:

Packages in Ubuntu 18.04:

  • libyaml 0.1.7
  • CMake
  • AsciiDoc 8.6.10 (apparently it is being replaced by http://AsciiDoctor.org)
  • OpenMP support (various options, libgomp, libomp5, libiomp5...)

Pre-requisites

sudo apt install build-essential cmake asciidoc libyaml-dev git
mkdir -p ~/src

RCMake

We tried with version 0.4 https://gitlab.com/vaplv/rcmake/commit/b9e3f2b0730763c960bcdff3d84b99ac3e48defc

cd ~/src
git clone https://gitlab.com/vaplv/rcmake.git
cd rcmake
git checkout tags/0.4
cd cmake
cmake . && make -j4
sudo make install

This will install the various RCMake files to /usr/local/lib/cmake/ and some documentation in /usr/local/share/doc.

RSys

We tried with version 0.7 https://gitlab.com/vaplv/rsys/tags/0.7

cd ~/src
git clone https://gitlab.com/vaplv/rsys.git
cd rsys
git checkout tags/0.7
cd cmake
cmake . && make -j4
# make test
sudo make install

ISPC

It seems to be possible to use binaries of ISPC, no need to build from source.

cd ~/src
wget http://sourceforge.net/projects/ispcmirror/files/v1.9.2/ispc-v1.9.2-linux.tar.gz
tar zxvf ispc-v1.9.2-linux.tar.gz
cd ispc-v1.9.2-linux
./ispc  --version

Embree

Building from source requires ISPC as above (although it's possible to build without ISPC, it is assumed that the resulting library will run much slower).

cd ~/src
sudo apt-get install libtbb-dev libglfw3-dev freeglut3-dev libmagick++-dev cmake libopenimageio-dev pkg-config libjpeg-dev libpng-dev
git clone https://github.com/embree/embree.git
cd embree
git checkout v2.17.6
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DEMBREE_ISPC_EXECUTABLE=$HOME/src/ispc-v1.9.2-linux/ispc -DCMAKE_INSTALL_PREFIX=/usr/local .
make -j4
sudo make install

Note: on my normal system the above steps gave errors as noted at embree bug 226. However, on a completely clean Ubuntu 18.04 system, I don't see those errors, so there must be something in my environment that messed up the Embree build.

Star-3D

Important! You need to make sure you earlier installed Embree 2.x, not the latest 3.x version.

cd ~/src
git clone https://gitlab.com/meso-star/star-3d.git
cd star-3d/cmake
cmake . && make -j4
sudo make install

Random123

It looks like the right place to get Random123 is here.

wget https://www.deshawresearch.com/downloads/download_random123.cgi/Random123-1.09.tar.gz
tar zxvf Random123-1.09.tar.gz
cd Random123-1.09
# if you want to run some tests:
#  cd examples
#  make

Note: you don't need the Boost version of Random123 that is linked from the Star-SP page.

Star-SP

cd ~/src
git clone https://gitlab.com/meso-star/star-sp.git
cd star-sp
git checkout 8bd80d61
cd cmake
cmake -DCMAKE_PREFIX_PATH=$HOME/src/Random123-1.09 .
make -j4
# You can run some tests:
#  make test
#>>> 100% tests passed, 0 tests failed out of 17
sudo make install

Star-3DUT

cd ~/src
git clone https://gitlab.com/meso-star/star-3dut.git
cd star-3dut
git checkout tags/0.3.1
cd cmake
cmake . && make -j4
sudo make install

Polygon

cd ~/src
git clone https://gitlab.com/vaplv/polygon.git
cd polygon/
ls
git checkout tags/0.1.2
cd cmake
cmake -DCMAKE_BUILD_TYPE=RELEASE . && make -j4
sudo make install

Star-CPR

This library depends on Angus Johnson's polygon clipping library, which is available as libpolyclipping-dev in Ubuntu but doesn't come with the debug libraries that Star-CPR would like to have. Hence a patch to ClipperConfig.cmake in Star-CPR is required to make it build. FWIW it should be possible to download -dbgsym packages for all Ubuntu libraries including libpolyclipping, but I couldn't work that out just now.

Save the following as ~/src/clipperconfig.patch

diff --git a/cmake/ClipperConfig.cmake b/cmake/ClipperConfig.cmake
index 4588561..f778dd2 100644
--- a/cmake/ClipperConfig.cmake
+++ b/cmake/ClipperConfig.cmake
@@ -40,13 +40,13 @@ find_path(Clipper_INCLUDE_DIR polyclipping/clipper.hpp)
 set(Clipper_INCLUDE_DIR ${Clipper_INCLUDE_DIR}/polyclipping/)
 
 unset(Clipper_LIBRARY CACHE)
-unset(Clipper_LIBRARY_DEBUG CACHE)
+#unset(Clipper_LIBRARY_DEBUG CACHE)
 unset(Clipper_LIBRARY_RELWITHDEBINFO CACHE)
 unset(Clipper_LIBRARY_MINSIZEREL CACHE)
 find_library(Clipper_LIBRARY polyclipping
   DOC "Path to the clipper library used during release builds.")
-find_library(Clipper_LIBRARY_DEBUG polyclipping-dbg
-  DOC "Path to the clipper library used during debug builds.")
+#find_library(Clipper_LIBRARY_DEBUG polyclipping-dbg
+#  DOC "Path to the clipper library used during debug builds.")
 
 # Create the imported library target
 if(CMAKE_HOST_WIN32)
@@ -56,8 +56,8 @@ else(CMAKE_HOST_WIN32)
 endif(CMAKE_HOST_WIN32)
 add_library(Clipper SHARED IMPORTED)
 set_target_properties(Clipper PROPERTIES
-  ${_property} ${Clipper_LIBRARY_DEBUG}
-  ${_property}_DEBUG ${Clipper_LIBRARY_DEBUG}
+  ${_property} ${Clipper_LIBRARY}
+#  ${_property}_DEBUG ${Clipper_LIBRARY_DEBUG}
   ${_property}_RELEASE ${Clipper_LIBRARY})
 
 # Check the package
@@ -65,5 +65,6 @@ include(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Clipper DEFAULT_MSG
   Clipper_INCLUDE_DIR
   Clipper_LIBRARY
-  Clipper_LIBRARY_DEBUG)
+#  Clipper_LIBRARY_DEBUG
+  )

Then build Star-CPR as follows:

cd ~/src
sudo apt install libpolyclipping-dev
git clone https://gitlab.com/meso-star/star-cpr.git
cd star-cpr
git checkout tags/0.1.1
patch -p1 < ~/src/clipperconfig.patch
cd cmake
cmake -DCMAKE_BUILD_TYPE=RELEASE . && make -j4
sudo make install

Star-SF

cd ~/src
git clone https://gitlab.com/meso-star/star-sf.git
cd star-sf
git checkout tags/0.6
cd cmake
cmake . && make -j4
sudo make install

solstice-solver

cd ~/src
git clone https://gitlab.com/meso-star/solstice-solver.git
cd solstice-solver
git checkout tags/0.7.2
cd cmake
cmake . -DCMAKE_BUILD_TYPE=RELEASE && make -j4
make test
sudo make install

solstice-anim

cd ~/src
git clone https://gitlab.com/meso-star/solstice-anim.git
cd solstice-anim
git checkout tags/0.2.2
cd cmake
cmake . && make -j4
# make test
sudo make install

A bug was fixed in version 0.2.1 which made it impossible to build and run the tests. That is now working as of version 0.2.2.

Star-STL

cd ~/src
git clone https://gitlab.com/meso-star/star-stl.git
cd star-stl
git checkout tags/0.3.2
cd cmake
cmake -DCMAKE_BUILD_TYPE=RELEASE && make -j4
# make test
sudo make install

solstice

cd ~/src
git clone https://gitlab.com/meso-star/solstice.git
cd solstice
git checkout tags/0.8.1
cd cmake
cmake . -DCMAKE_BUILD_TYPE=RELEASE && make -j4
# make test
sudo make install

Solstice is built and installed! Next, some instructions to run a simple test case are needed

Postprocessing tools

Before you can do an easy visualisation of a Solstice simulation, you need to compile some small post-processing tools. Proceed as follows:

cd ~/src
sudo apt install paraview
wget https://www.meso-star.com/projects/solstice/downloads/Solstice-PP-Sources-0.3.1.tar.gz
tar zxvf Solstice-PP-Sources-0.3.1.tar.gz
cd Solstice-PP-Sources-0.3.1
make -j4
export PATH=$PATH:$PWD

Running a basic example

For this example, contributed by Ye Wang, please download File:Solstice-demo.tar.bz2 to your ~/Downloads folder. Then,

cd ~
tar jxvf ~/Downloads/Solstice-demo.tar.bz2
cd solstice-demo

# run the simulation
solstice -D180,78 -v -n 1000000 -R demo-rcv.yaml -fo simul demo.yaml

# generate files for visualisation
solstice -D180,78 -g format=obj:split=geometry -fo geom demo.yaml
solstice -D180,78 -q -n 100 -R demo-rcv.yaml -p default demo.yaml > solpaths 

# convert files to paraview format
solppraw simul
solmaps simul
solpp geom simul
solpaths solpaths

# open in paraview
paraview 
# you need to open the varios .vtk files in the ~/solstice-demo file, which should be
#   180-78-miscellaneous.obj  180-78-primaries.vtk  180-78-target_e.vtk
#   180-78-paths.vtk          180-78-receivers.vtk  180-78-virtual_target_e.vtk
# after loading each file, you should enable the view of that file, using the little 'eye' icon next to the loaded filename.

ParaviewImage0.png

ParaviewImage1.png

ParaviewImage2.png