Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build plugin in docker #65

Merged
merged 77 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
040c19a
update cmake for mac build
bam241 Dec 21, 2020
edc9df4
clean version of MACOS script
bam241 Dec 22, 2020
4190b46
commenting out gfortran
bam241 Dec 22, 2020
52eb2f8
adding static libs to packages for linux
bam241 Dec 22, 2020
f1e19b8
non interactive mode
bam241 Dec 22, 2020
db81d47
putting linux back on SHARED lib
bam241 Dec 22, 2020
25d72d6
working linux build
bam241 Dec 22, 2020
ccc3496
localised install
bam241 Dec 22, 2020
25fafaa
no interactive for macport
bam241 Dec 22, 2020
51c89fc
putting the correct jou file
bam241 Dec 22, 2020
6b60ceb
no prompt
bam241 Dec 22, 2020
1a8fd85
adding the folder ...
bam241 Dec 22, 2020
c150a0f
missing s...
bam241 Dec 22, 2020
ecf20b7
detach volume...
bam241 Dec 22, 2020
dfde610
stoping to see what is appening
bam241 Dec 22, 2020
2d38516
commenting port
bam241 Dec 22, 2020
1536422
-r for copy... removing exit
bam241 Dec 22, 2020
1fe4574
fixing path
bam241 Dec 23, 2020
c8ee9f9
reset path
bam241 Dec 23, 2020
0449999
fixing path
bam241 Dec 23, 2020
607faf7
fixing path
bam241 Dec 23, 2020
e0b018b
better path?
bam241 Dec 23, 2020
afa2021
using abs path
bam241 Dec 24, 2020
e317672
fixing tar command line
bam241 Dec 24, 2020
18aaf02
more change
bam241 Dec 24, 2020
92294ef
patching cubitcmake
bam241 Dec 25, 2020
78f69cb
fixing cmake file
bam241 Dec 26, 2020
c535f29
new version of mcnp2cad
bam241 Jan 4, 2021
90f6c76
update mcnp2cad version
bam241 Jan 4, 2021
e4e41bb
updating mcnp2cad
bam241 Jan 4, 2021
37d798e
update mcn2cad version
bam241 Jan 4, 2021
34acb58
update commit number
bam241 Jan 4, 2021
9f8a7cb
new mcnp2cad git commit
bam241 Jan 4, 2021
4e75bc9
update commit number
bam241 Jan 4, 2021
4b718b5
update commit number
bam241 Jan 4, 2021
8809c89
udparte commit
bam241 Jan 4, 2021
040918f
update commit
bam241 Jan 4, 2021
ccd3a9c
update commit number
bam241 Jan 4, 2021
3880c48
update commit
bam241 Jan 4, 2021
b0b451d
new commits
bam241 Jan 4, 2021
3caa7ad
new commits
bam241 Jan 4, 2021
d972a8f
update commit
bam241 Jan 4, 2021
32488ca
update commit
bam241 Jan 4, 2021
ab2cd9b
cubit_geom cubit_util required ?
bam241 Jan 4, 2021
5573a6c
cubit_util needed ?
bam241 Jan 4, 2021
07f8c48
cancell changes
bam241 Jan 4, 2021
7025f37
update commit number
bam241 Jan 5, 2021
2d0c4e2
update script to basic location
bam241 Jan 5, 2021
80c3206
reformating build
bam241 Jan 6, 2021
54d1b6b
back to same results
bam241 Jan 6, 2021
cc15fa9
working
bam241 Jan 7, 2021
90e1193
readd cleaning
bam241 Jan 7, 2021
a97af63
cleaning
bam241 Feb 11, 2021
fa6a506
cleaning artifacts
bam241 Feb 11, 2021
ac1ff2b
cleaning artifacts
bam241 Feb 11, 2021
86e84c5
cleaning artifacts
bam241 Feb 11, 2021
0a1c36b
this should be it...
bam241 Feb 11, 2021
f7db14b
Update script/linux_share_build.sh
bam241 Feb 11, 2021
ef5d3ea
update according to @gonuke comments
bam241 Feb 11, 2021
296a66b
ckeaning
bam241 Feb 11, 2021
abce1a2
reset mcnp_cad commit
bam241 Feb 11, 2021
6e3a63f
@gonuke waS right libtool is not required
bam241 Feb 12, 2021
a8b7d00
Apply suggestions from code review
bam241 Feb 15, 2021
f01e71d
few changes addressing @pat suggestion
bam241 Feb 15, 2021
32969ad
Merge branch 'auto_build' of github.com:bam241/Trelis-plugin into aut…
bam241 Feb 15, 2021
ea8bb9e
adding readme
bam241 Feb 16, 2021
e8ece15
adding readme
bam241 Feb 17, 2021
51a10b3
renaming files
bam241 Feb 17, 2021
6e851e1
upate docs
bam241 Feb 17, 2021
c45e9bd
ordering args
bam241 Feb 17, 2021
e490828
fixing syntax
bam241 Feb 17, 2021
7246373
better syntax
bam241 Feb 17, 2021
9e0cf2a
with actual number ?
bam241 Feb 17, 2021
2d707d6
with actual number ?
bam241 Feb 17, 2021
d3b64a9
fix typo
bam241 Feb 17, 2021
f92ab48
moving the unset LD to other script
bam241 Feb 17, 2021
5f83026
Apply suggestions from code review
bam241 Feb 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bld
4 changes: 4 additions & 0 deletions script/build_plug_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

SCRIPTPATH=`dirname $(dirname $(realpath $0))`
docker run -v "$SCRIPTPATH:/Trelis-plugin" -v "$2:/Trelis-sdk" -it $1 bash -c "/Trelis-plugin/script/build_plugin.sh $3; bash"
26 changes: 26 additions & 0 deletions script/build_plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
bam241 marked this conversation as resolved.
Show resolved Hide resolved
CURRENT=$(pwd)
SCRIPTPATH=`dirname $(dirname $(realpath $0))`

PLUGIN_DIR="plugin-build"
PLUGIN_ABS_PATH=""

source ${SCRIPTPATH}/script/linux_share_build.sh

install_prerequisites

setup_folder

build_moab
build_dagmc

setup_Trelis_sdk $1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you still have documentation to work on, but can we add a comment here for what we expect the argument, $1, to be?

build_plugin $1
build_plugin_pkg $1



mv -v svalinn-plugin_linux_$1.tgz /Trelis-sdk
cd ..
rm -rf pack bld DAGMC lib moab
rm Trelis-plugin
119 changes: 119 additions & 0 deletions script/linux_share_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/bin/bash


bam241 marked this conversation as resolved.
Show resolved Hide resolved

function install_prerequisites() {
TZ=America/Chicago
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
apt-get update -y
apt-get install -y g++ libeigen3-dev libhdf5-dev patchelf git cmake
}

function setup_folder() {
cd ${CURRENT}
mkdir ${PLUGIN_DIR}
echo "Building the Trelis plugin in ${CURRENT}\\${PLUGIN_DIR}"

unset LD_LIBRARY_PATH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the LD_LIBRARY_PATH being set anywhere else, so I think this can be removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you run this on your computer one want to be sure that the LD_LIBRARY_PATH is not set to ovoid conflict...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pshriwise I believe this is the only outdenting comment.

BU this was done on purpose for safety....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I was understanding these as intended for use in docker only, meaning we'd have a fresh environment. Nice to be able to use them in the native kernel though -- have we tested that?

All that aside, would this command be more appropriate in the build_plugin.sh file? It would be more clear that the LD_LIBRARY_PATH is unset by these scripts I think.


cd ${PLUGIN_DIR}
PLUGIN_ABS_PATH=$(pwd)
ln -s $SCRIPTPATH/ ./
}

function build_moab() {
cd ${PLUGIN_ABS_PATH}
mkdir -pv moab/bld
cd moab
git clone https://bitbucket.org/fathomteam/moab -b Version5.1.0
cd bld
cmake ../moab -DENABLE_HDF5=ON \
-DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/hdf5/serial \
-DBUILD_SHARED_LIBS=ON \
-DENABLE_BLASLAPACK=OFF \
-DENABLE_FORTRAN=OFF \
-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 \
-DCMAKE_INSTALL_PREFIX=${PLUGIN_ABS_PATH}/moab

make -j`grep -c processor /proc/cpuinfo`
make install
cd ../..
rm -rf moab/moab moab/bld
}


function build_dagmc(){
cd ${PLUGIN_ABS_PATH}
mkdir -pv DAGMC/bld
cd DAGMC
git clone https://github.com/bam241/DAGMC -b build_exe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repo and branch can be updated with the merge of your PR in DAGMC

svalinn/DAGMC#717

cd bld
cmake ../DAGMC -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 \
-DMOAB_DIR=${PLUGIN_ABS_PATH}/moab \
-DBUILD_UWUW=ON \
-DBUILD_TALLY=OFF \
-DBUILD_BUILD_OBB=OFF \
-DBUILD_MAKE_WATERTIGHT=ON \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=OFF \
-DBUILD_EXE=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PLUGIN_ABS_PATH}/DAGMC
make -j`grep -c processor /proc/cpuinfo`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this line in multiple places, let's make the number of make jobs a variable.

make install
cd ../..
rm -rf DAGMC/DAGMC DAGCM/bld
bam241 marked this conversation as resolved.
Show resolved Hide resolved
}

function setup_Trelis_sdk() {
cd /Trelis-sdk
dpkg -i Trelis-$1-Lin64.deb

cd /opt
tar -xzvf /Trelis-sdk/Trelis-SDK-$1-Lin64.tar.gz
}

function build_plugin(){
cd ${PLUGIN_ABS_PATH}
cd Trelis-plugin
git submodule update --init
cd ../
mkdir -pv bld
cd bld
cmake ../Trelis-plugin -DCUBIT_ROOT=/opt/Trelis-${1::4} \
-DDAGMC_DIR=${PLUGIN_ABS_PATH}/DAGMC \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PLUGIN_ABS_PATH}
make -j`grep -c processor /proc/cpuinfo`
make install
}

function build_plugin_pkg(){
cd ${PLUGIN_ABS_PATH}
mkdir -p pack/bin/plugins/svalinn
cd pack/bin/plugins/svalinn

# Copy all needed libraries into current directory
cp -pPv ${PLUGIN_ABS_PATH}/lib/* .
cp -pPv ${PLUGIN_ABS_PATH}/moab/lib/libMOAB.so* .
cp -pPv ${PLUGIN_ABS_PATH}/DAGMC/lib/libdagmc.so* .
cp -pPv ${PLUGIN_ABS_PATH}/DAGMC/lib/libmakeWatertight.so* .
cp -pPv ${PLUGIN_ABS_PATH}/DAGMC/lib/libpyne_dagmc.so* .
cp -pPv ${PLUGIN_ABS_PATH}/DAGMC/lib/libuwuw.so* .
cp -pPv /usr/lib/x86_64-linux-gnu/libhdf5_serial.so* .
chmod 644 *

# Set the RPATH to be the current directory for the DAGMC libraries
patchelf --set-rpath /opt/Trelis-${1::4}/bin/plugins/svalinn libMOAB.so
patchelf --set-rpath /opt/Trelis-${1::4}/bin/plugins/svalinn libdagmc.so
patchelf --set-rpath /opt/Trelis-${1::4}/bin/plugins/svalinn libmakeWatertight.so
patchelf --set-rpath /opt/Trelis-${1::4}/bin/plugins/svalinn libpyne_dagmc.so
patchelf --set-rpath /opt/Trelis-${1::4}/bin/plugins/svalinn libuwuw.so

# Create the Svalinn plugin tarball
cd ..
ln -sv svalinn/libsvalinn_plugin.so .
cd ../..
tar --sort=name -czvf svalinn-plugin_linux_$1.tgz bin
}