

{"id":160,"date":"2017-10-20T11:40:37","date_gmt":"2017-10-20T09:40:37","guid":{"rendered":"https:\/\/project.inria.fr\/damaris\/?page_id=160"},"modified":"2022-01-10T13:49:53","modified_gmt":"2022-01-10T12:49:53","slug":"on-a-linux-machine","status":"publish","type":"page","link":"https:\/\/project.inria.fr\/damaris\/on-a-linux-machine\/","title":{"rendered":"Environment Preparation on a Linux Machine"},"content":{"rendered":"<p>For installing all needed libraries by Damaris, there are multiple different approaches: automated\/semi-automated using a Linux distributions package manager for installing dependencies or compiling from source using <a href=\"https:\/\/spack.io\/\">Spack<\/a>) or a completely manual download using git or a source zip package. Here you can find some examples of each method.<\/p>\n<h4>1. Compile Damaris from gitlab source<\/h4>\n<p>This example uses Debian 10\/11 (Ubuntu 18\/20) installed dependencies.<br \/>\nIf you have sudo privilege&#8217;s, using apt-get is a quick way to get dependencies on modern Debian and Ubuntu OSes. These libraries can be used in a Docker or Singularity build.<br \/>\nHere we install HDF5 with parallel support using OpenMPI.<\/p>\n<pre lang=\"bash\" line=\"1\">\r\nsudo apt-get update -y\r\nsudo apt-get install -y build-essential \\\r\n   gfortran \\\r\n   libboost-all-dev \\\r\n   libhdf5-openmpi-dev \\\r\n   xsdcxx \\\r\n   libxerces-c-dev \\\r\n   libcppunit-dev\r\n\r\n# The xsd executable has a different name from the Debian package\r\n# So, link to what Damaris expects\r\nsudo ln -s \/usr\/bin\/xsdcxx \/usr\/bin\/xsd\r\n\r\n# Set some variables\r\nDAMARIS_VERSION=1.5\r\nINSTALL_PREFIX=~\/local\r\n\r\n# Obtain the Damaris source from GitLab and checkout the desired version\r\ngit clone https:\/\/gitlab.inria.fr\/Damaris\/damaris.git\r\ncd damaris\r\ngit fetch --all\r\ngit checkout tags\/v$DAMARIS_VERSION\r\ncd ..\r\nmkdir -p .\/build\/damaris\r\ncd build\/damaris\r\n\r\n# Configure Damaris with desired capabilities (HDF5, testing, examples)\r\ncmake ..\/..\/damaris -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX \\\r\n      -DCMAKE_BUILD_TYPE=Release \\\r\n      -DCMAKE_CXX_COMPILER=mpicxx \\\r\n      -DCMAKE_C_COMPILER=mpicc \\\r\n      -DENABLE_TESTS=ON \\\r\n      -DENABLE_EXAMPLES=ON \\\r\n      -DBUILD_SHARED_LIBS=ON \\\r\n      -DENABLE_HDF5=ON  -DHDF5_ROOT=\/usr\/lib\/x86_64-linux-gnu\/hdf5\/openmpi \\\r\n      -DGENERATE_MODEL=ON\r\n\r\n# Compile the library and then install using sudo if needed\r\nmake -j4\r\n[sudo] make install\r\n<\/pre>\n<p>If compiling Damaris with Paraview support then also include the following line on the Damaris cmake command line<\/p>\n<pre lang=\"bash\" line=\"1\">\r\n\r\n-DENABLE_CATALYST=ON -DParaView_DIR=$INSTALL_PREFIX\/lib\/cmake\/paraview-5.8 \\\r\n\r\n# N.B. INSTALL_PREFIX is where Paraview was installed.\r\n<\/pre>\n<p>And if compiling Damaris with VisIt support, include the following on the Damaris cmake command line<\/p>\n<pre lang=\"bash\" line=\"1\">\r\n\r\n-DENABLE_VISIT=ON -DVisIt_ROOT=$INSTALL_PREFIX \\\r\n\r\n# N.B. INSTALL_PREFIX is where VisIt was installed.\r\n<\/pre>\n<h4>2. Automatic installation with Spack<\/h4>\n<p><a href=\"https:\/\/spack.io\/\">Spack<\/a> is a powerful package manager that is often\u00a0used on clusters and supercomputers. Spack can be installed and start simply by the following\u00a0instructions:<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\ngit clone https:\/\/github.com\/spack\/spack.git\r\n. .\/spack\/share\/spack\/setup-env.sh<\/pre>\n<p>Damaris now has a Spack packages file that is part of the Spack git repository.<br \/>\nSo, now it is easy enough to install Damaris. To see the options enabled through Spack<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\n    spack info damaris<\/pre>\n<p>To install the base Damaris with HDF5 support (no visualization support)<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\n    spack install damaris+hdf5+fortran+examples<\/pre>\n<p>Please note, installing Paraview and VisIt via Spack can be very long and difficult process. It is recommended to download and install them from source using their official documentation and it is preferable to install dependencies such as <em>llvm<\/em> and <em>osmesa<\/em> via your operating systems package manager.<br \/>\n<a href=\"https:\/\/github.com\/Kitware\/ParaView\/blob\/master\/Documentation\/dev\/build.md\">ParaView Docs<\/a><br \/>\n<a href=\"https:\/\/www.visitusers.org\/index.php?title=Build_visit_overview\">VisIt Docs<\/a><\/p>\n<h5> Using Spack hash values<\/h5>\n<p>Spack can start to get crowded with multiple installations of the same package. To specify an exact package required it can pay to use the <em>hash<\/em> of the installed library. Use something like the following to find the hash and use the hash to find dependencies and their hash values too.<\/p>\n<pre lang=\"bash\" line=\"1\">\r\n# Install a specific version of HDF5\r\nHDF5_VERSION=1.10.7\r\nspack install hdf5@$HDF5_VERSION+mpi+hl\r\n\r\n# Obtain the hash of the installation\r\nHDF5_HASH=$(spack find -vl hdf5 | grep $HDF5_VERSION | sed 's| hdf5.*$||g')\r\n# Find the hash of the OpenMPI depedencies of the specific HDF5 version\r\nOMPI_HASH=$(spack dependencies --installed \/$HDF5_HASH | grep openmpi | sed \"s| openmpi.*$||g\")  \r\n\r\n# Now we can find the path to the Spack installation directory.\r\n# N.B. We should also check that the directory exists to avoid silent failures\r\nMPIPATH=$(spack find -p openmpi\/$OMPI_HASH | grep openmpi | sed \"s|^.* ||g\")\r\nHDF5PATH=$(spack find -p hdf5\/$HDF5_HASH| grep hdf5 | sed \"s|^.* ||g\")\r\n\r\nspack load hdf5\/$HDF5_HASH\r\nspack load openmpi\/$OMPI_HASH\r\n\r\n# The paths can be used to specify the exact versions in the cmake configuration:\r\ncmake ..\/..\/damaris -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX \\\r\n      -DCMAKE_BUILD_TYPE=Release \\\r\n      -DCMAKE_CXX_COMPILER=$MPIPATH\/bin\/mpicxx \\\r\n      -DCMAKE_C_COMPILER=$MPIPATH\/bin\/mpicc \\\r\n      -DENABLE_HDF5=ON -DHDF5_ROOT=$HDF5PATH \\\r\n      ...\r\n\r\n<\/pre>\n<h4>3. Manual Installation of Damaris Dependencies<\/h4>\n<p>To install the libraries manually, first download (check the <em>\/build\/env_prep.sh<\/em> script file for examples) and unzip the libraries and go to the related directory. For each library, run the following commands. Please note that the variable <em>&#8220;install_path&#8221;\u00a0<\/em>shows the installation folder of Damaris.<\/p>\n<h5>Install CMake<\/h5>\n<p>Run these commands to build and install cmake.<\/p>\n<pre lang=\"bash\" line=\"1\">$ .\/bootstrap --prefix=$install_prefix\r\n$ make\r\n$ make install<\/pre>\n<h5>Install MPI<\/h5>\n<p>To Install MPICH, do the following steps:<\/p>\n<pre lang=\"bash\" line=\"1\">$ .\/configure --prefix=$install_prefix --enable-shared \r\n    --enable-romio --enable-fc 2>&1  | tee c.txt\r\n$ make 2>&1  | tee m.txt\r\n$ make install 2>&1 | tee mi.txt<\/pre>\n<p>The required commands for installing OpenMPI can be found in the <em>.\/env_prep.sh<\/em> file.<\/p>\n<h5>Install Xerces<\/h5>\n<p>Run the following commands to install Xerces:<\/p>\n<pre lang=\"bash\" line=\"1\">$ .\/configure --prefix=$install_prefix --disable-threads --disable-network\r\n$ make\r\n$ make install<\/pre>\n<h5>Install XSD<\/h5>\n<p>XSD is a XML data binding library by CodeSynthesis. To install this library, take the following steps:<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\n$ make LDFLAGS=\"-L$install_prefix\/lib\/\" CFLAGS=\"-I $install_prefix\/include\" \r\n    CXXFLAGS=\"-I $install_prefix\/include\/\"\r\n$ make install_prefix=$install_prefix install LDFLAGS=\"-L~\/local\/lib\/\" \r\n    CFLAGS=\"-I ~\/local\/include\" CXXFLAGS=\"-I ~\/local\/include\/\"<\/pre>\n<h5>Install Boost<\/h5>\n<p>Configure and compile boost using these commands:<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\n$ .\/bootstrap.sh --prefix=$install_prefix \r\n    --with-libraries=thread,log,date_time,program_options,filesystem,system\r\n$ .\/b2\r\n$ .\/b2 install<\/pre>\n<h5>Install CPPUnit (Optional)<\/h5>\n<p>To build and install CppUnit, go for these three commands:<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\n$ .\/configure --prefix=$install_prefix\r\n$ make\r\n$ make install<\/pre>\n<h5>Install HDF5 (Optional)<\/h5>\n<p>To install HDF5, run these three commands:<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\n$ .\/configure --enable-parallel --prefix=$install_path\r\n$ make\r\n$ make install<\/pre>\n<h5>Installing VisIt (optional)<\/h5>\n<p>Installing VisIt is a little bit more complex compared to the other mentioned libraries. To install VisIt <a href=\"https:\/\/project.inria.fr\/damaris\/install-visiit\/\">check this page<\/a>.<\/p>\n<h5>Installing ParaView Catalyst (optional)<\/h5>\n<p>&#8211; Make sure that the mpicc and mpicxx are in your PATH variable.<br \/>\n&#8211; Make sure that the path of your MPI libraries are inside the LD_LIBRARY_PATH variable.<br \/>\n&#8211; Download your proper Catalyst archive from <a href=\"https:\/\/www.paraview.org\/download\/\">this page<\/a>. (download the one with Python enabled and extras)<br \/>\n&#8211; Untar it in your preferred folder.<br \/>\n&#8211; Go to the created folder.<br \/>\n&#8211; Create a build folder inside.<br \/>\n&#8211; Go to that folder.<br \/>\n&#8211; Call:<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\n ..\/cmake.sh .. -DCMAKE_INSTALL_PREFIX=$install_path<\/pre>\n<p>&#8211; run:<\/p>\n<pre lang=\"bash\" line=\"1\"> \r\nmake -j 8\r\nmake install<\/pre>\n<p><span class=\"s1\"><span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/p>\n<h4>4. Automatic installation of Damaris and Dependencies from source with a script<\/h4>\n<p>To install all the dependent libraries, semi-automatically, from source, go to the <em>\/build<\/em> folder in Damaris GitLab and open the <em>env_prep.sh<\/em> script file. To configure the build, set the install_path variable to where you want all libraries installed and then run:.<\/p>\n<pre lang=\"bash\" line=\"1\">\r\nUsage: env_prep.sh (all|compile|custom) \\n [args:(cmake, mpi[mpich,openmpi,none], xercess, xsd, boost, cppunit, hdf5, visit, catalyst, compile)]<\/pre>\n<p>If everything is successful, Damaris and all required dependent libraries will be downloaded, built and installed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For installing all needed libraries by Damaris, there are multiple different approaches: automated\/semi-automated using a Linux distributions package manager for installing dependencies or compiling from source using Spack) or a completely manual download using git or a source zip package. Here you can find some examples of each method. 1&#8230;.<\/p>\n<p> <a class=\"continue-reading-link\" href=\"https:\/\/project.inria.fr\/damaris\/on-a-linux-machine\/\"><span>Continue reading<\/span><i class=\"crycon-right-dir\"><\/i><\/a> <\/p>\n","protected":false},"author":1249,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-160","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/project.inria.fr\/damaris\/wp-json\/wp\/v2\/pages\/160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/project.inria.fr\/damaris\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/project.inria.fr\/damaris\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/project.inria.fr\/damaris\/wp-json\/wp\/v2\/users\/1249"}],"replies":[{"embeddable":true,"href":"https:\/\/project.inria.fr\/damaris\/wp-json\/wp\/v2\/comments?post=160"}],"version-history":[{"count":35,"href":"https:\/\/project.inria.fr\/damaris\/wp-json\/wp\/v2\/pages\/160\/revisions"}],"predecessor-version":[{"id":919,"href":"https:\/\/project.inria.fr\/damaris\/wp-json\/wp\/v2\/pages\/160\/revisions\/919"}],"wp:attachment":[{"href":"https:\/\/project.inria.fr\/damaris\/wp-json\/wp\/v2\/media?parent=160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}