Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PIConGPU OSX Quick Start
# Name and Path of this Script ############################### (DO NOT change!)
export PIC_PROFILE=$(cd $(dirname $BASH_SOURCE) && pwd)"/"$(basename $BASH_SOURCE)
# User Information ######################################### (edit those lines)
# - automatically add your name and contact to output file meta data
# - send me mails on batch system job (b)egin, (e)nd, (a)bortion or (n)o mail
export MY_MAILNOTIFY="n"
export MY_MAIL="someone@example.com"
export MY_NAME="$(whoami) <$MY_MAIL>"
# Text Editor for Tools ###################################### (edit this line)
# - examples: "nano", "vim", "emacs -nw", "vi" or without terminal: "gedit"
#export EDITOR="nano"
# Software Dependencies #######################################################
#
# need to be compiled by the user
export CMAKE_ROOT=$HOME/lib/cmake-3.10.2
export BOOST_ROOT=$HOME/lib/boost-1.65.1
export PNGwriter_DIR=$HOME/lib/pngwriter-0.7.0
export MPI_ROOT=$HOME/lib/openmpi-2.1.2
export HDF5_ROOT=$HOME/lib/hdf5-1.8.20
export Splash_DIR=$HOME/lib/splash-1.7.0
export LD_LIBRARY_PATH=$BOOST_ROOT/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PNGwriter_DIR/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$MPI_ROOT/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HDF5_ROOT/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$Splash_DIR/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/Cellar/gnu-getopt/1.1.6/bin/:$PATH
export PATH=$CMAKE_ROOT/CMake.app/Contents/bin:$PATH
export PATH=$MPI_ROOT/bin:$PATH
export PATH=$HDF5_ROOT/bin:$PATH
export PATH=$Splash_DIR/bin:$PATH
export CMAKE_PREFIX_PATH=$BOOST_ROOT:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=$MPI_ROOT:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=$HDF5_ROOT:$CMAKE_PREFIX_PATH
# Environment #################################################################
#
export PICSRC=$HOME/src/picongpu
export PIC_EXAMPLES=$PICSRC/share/picongpu/examples
export PIC_BACKEND="omp2b:native"
# export PIC_BACKEND="cuda:30"
export PATH=$PATH:$PICSRC
export PATH=$PATH:$PICSRC/bin
export PATH=$PATH:$PICSRC/src/splash2txt/build
export PATH=$PATH:$PICSRC/src/tools/bin
export PYTHONPATH=$PICSRC/lib/python:$PYTHONPATH
# "tbg" default options #######################################################
# - PBS/Torque (qsub)
# - "k80" queue
export TBG_SUBMIT="bash"
export TBG_TPLFILE="etc/picongpu/bash/mpirun.tpl"
#!/usr/bin/env bash
#
# Author: Axel Huebl
#
# last updated: 2018-03-05
#
# execute:
# curl https://gist.githubusercontent.com/ax3l/9e77c1b688136ea37b05ff00ea0e420f/raw/PIConGPU_040-dev_osx.sh | bash
PIC_BRANCH="dev"
# get PIConGPU profile
if [ ! -f $HOME/picongpu.profile ]; then
curl -L -s -o $HOME/picongpu.profile \
https://gist.githubusercontent.com/ax3l/9e77c1b688136ea37b05ff00ea0e420f/raw/osx_picongpu.profile
fi
# load environment
source $HOME/picongpu.profile
export CXXFLAGS="-std=c++11"
set -euf -o pipefail
# build missing software
mkdir -p $HOME/src
mkdir -p $HOME/lib
# getopt (GNU version)
# see https://github.com/ComputationalRadiationPhysics/picongpu/issues/2545
brew install gnu-getopt
# CMake
if [ ! -d $CMAKE_ROOT ]; then
echo "Installing CMake..."
cd $HOME/src
curl -L -s -o cmake_3.10.2.tar.gz \
https://cmake.org/files/v3.10/cmake-3.10.2-Darwin-x86_64.tar.gz
tar -xf cmake_3.10.2.tar.gz
# pre-compiled binaries
mv cmake-3.10.2-Darwin-x86_64 $CMAKE_ROOT
fi
# Boost
if [ ! -d $BOOST_ROOT ]; then
echo "Installing Boost..."
cd $HOME/src
curl -L -s -o boost_1_65_1.tar.gz \
https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
tar -xf boost_1_65_1.tar.gz
cd boost_1_65_1
./bootstrap.sh --with-libraries=atomic,chrono,context,date_time,fiber,filesystem,math,program_options,regex,serialization,system,thread \
--prefix=$BOOST_ROOT
./b2 cxxflags="-std=c++11" -j4
./b2 install
fi
# PNGwriter
if [ ! -d $PNGwriter_DIR ]; then
echo "Installing PNGwriter..."
cd $HOME/src
git clone -b 0.7.0 https://github.com/pngwriter/pngwriter.git \
$HOME/src/pngwriter
mkdir pngwriter-build
cd pngwriter-build
cmake -DCMAKE_INSTALL_PREFIX=$PNGwriter_DIR \
$HOME/src/pngwriter
make install
fi
# OpenMPI
if [ ! -d $MPI_ROOT ]; then
echo "Installing OpenMPI..."
cd $HOME/src
curl -L -s -o openmpi_2_1_2.tar.gz \
https://www.open-mpi.org/software/ompi/v2.1/downloads/openmpi-2.1.2.tar.gz
tar -xf openmpi_2_1_2.tar.gz
cd openmpi-2.1.2
./configure --disable-mpi-fortran \
--prefix=$MPI_ROOT
make
make install
fi
# HDF5
if [ ! -d $HDF5_ROOT ]; then
echo "Installing parallel HDF5..."
cd $HOME/src
curl -L -s -o hdf5_1.8.20.tar.gz \
https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.20/src/hdf5-1.8.20.tar.gz
tar -xf hdf5_1.8.20.tar.gz
cd hdf5-1.8.20
CC=$MPI_ROOT/bin/mpicc CXX=$MPI_ROOT/bin/mpic++ ./configure --enable-parallel --enable-shared --disable-fortran \
--prefix=$HDF5_ROOT
CC=$MPI_ROOT/bin/mpicc CXX=$MPI_ROOT/bin/mpic++ make
make install
fi
# Splash
if [ ! -d $Splash_DIR ]; then
echo "Installing libSplash..."
git clone -b v1.7.0 https://github.com/ComputationalRadiationPhysics/libSplash.git \
$HOME/src/splash
mkdir $HOME/src/splash-build
cd $HOME/src/splash-build
cmake -DCMAKE_INSTALL_PREFIX=$Splash_DIR $HOME/src/splash
make install
fi
cd $HOME
# get PIConGPU
if [ ! -d $HOME/src/picongpu ]; then
git clone -b $PIC_BRANCH https://github.com/ComputationalRadiationPhysics/picongpu.git \
$HOME/src/picongpu
fi
# message to user
echo ''
echo 'edit user & email within picongpu.profile, e.g. via:'
echo ' vim $HOME/picongpu.profile'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment