-
Notifications
You must be signed in to change notification settings - Fork 15
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
ADD: claw-compiler #72
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5bd730a
ADD: build_claw.sh script
7e5f6aa
FIX: salve variable
37e3fc9
ADD: enable the use of build_apkg.sh script for claw
fe26726
FIX: compilation errors
ff1a4a4
ADD: possibility to use tsa as slave
elsagermann 5c8c668
Merge branch 'master' into build_claw
lxavier c18b1ba
FIX: problem between relative and absolute paths
64db980
Merge branch 'build_claw' of github.com:elsagermann/buildenv into bui…
dcc26a2
ADD: possibility to use relative and absolute paths
5f0b446
change cmake version on kesch
lxavier 0b49dce
Merge branch 'fix-cmake-kesch' of github.com:C2SM-RCM/buildenv into b…
lxavier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
#!/usr/bin/env bash | ||
|
||
# set default variables | ||
|
||
test -n "${REBUILD}" || REBUILD=YES | ||
test -n "${slave}" || exitError "Error : slave must be defined" | ||
|
||
# hack for tsa | ||
if [ "$slave" == "tsa" ] ; then | ||
export COSMO_TESTENV=ON | ||
slave=arolla | ||
fi | ||
|
||
exitError() | ||
{ | ||
echo "ERROR $1: $3" 1>&2 | ||
echo "ERROR LOCATION=$0" 1>&2 | ||
echo "ERROR LINE=$2" 1>&2 | ||
exit $1 | ||
} | ||
|
||
TEMP=$@ | ||
eval set -- "$TEMP --" | ||
fwd_args="" | ||
compiler_target="all" | ||
while true; do | ||
case "$1" in | ||
--dir|-d) package_basedir=$2; shift 2;; | ||
--idir|-i) install_dir=$2; shift 2;; | ||
--local) install_local="yes"; shift;; | ||
--compiler|-c) compiler_target=$2; shift 2;; | ||
-- ) shift; break ;; | ||
* ) fwd_args="$fwd_args $1"; shift ;; | ||
esac | ||
done | ||
|
||
if [[ -z ${package_basedir} ]]; then | ||
exitError 3221 ${LINENO} "package basedir has to be specified" | ||
fi | ||
if [[ -z ${install_dir} ]]; then | ||
exitError 3225 ${LINENO} "package install dir has to be specified" | ||
fi | ||
|
||
# Setup | ||
echo $@ | ||
base_path=$PWD | ||
setupDefaults | ||
|
||
if [[ ${install_local} == "yes" ]]; then | ||
install_path_prefix_="${base_path}/install" | ||
else | ||
install_path_prefix_="${install_dir}/claw" | ||
fi | ||
|
||
build_compiler_target() | ||
{ | ||
|
||
export compiler=$1 | ||
local install_path=$2 | ||
echo "Compiling and installing for $compiler (install path: $install_path)" | ||
|
||
install_args="-i ${install_path}/" | ||
|
||
if [ ! -d ${install_path} ] ; then | ||
mkdir -p ${install_path} | ||
fi | ||
|
||
setFortranEnvironment | ||
|
||
if [ $? -ne 0 ]; then | ||
exitError 3331 ${LINENO} "Invalid fortran environment" | ||
fi | ||
|
||
writeModuleList ${base_path}/modules.log loaded "FORTRAN MODULES" ${base_path}/modules_fortran.env | ||
|
||
echo "Building for ${compiler} compiler" | ||
|
||
# Build claw-compiler dependency apache-ant | ||
echo "==============================" | ||
echo "Build claw-compiler dependency: apache-ant" | ||
if [ ! -d ${package_basedir}/hpc-scripts ] ; then | ||
git clone [email protected]:clementval/hpc-scripts.git ${package_basedir}/hpc-scripts | ||
fi | ||
cd ${package_basedir}/hpc-scripts/cscs | ||
if [[ ! -f ../../ant/apache-ant-1.10.2/bin/ant || $REBUILD == YES ]] ; then | ||
if [ $REBUILD == YES ] ; then | ||
echo `pwd` | ||
echo "Rebuilding apache-ant" | ||
echo "rm -rf ../../ant" | ||
rm -rf ../../ant | ||
fi | ||
./install.ant -i ../../ant || error_exit "Error : apach-ant build failed" | ||
fi | ||
cd ../../ant/apache-ant-1.10.2 | ||
export ANT_HOME=`pwd` | ||
|
||
cd $base_path | ||
|
||
# Build claw-compiler | ||
echo "==============================" | ||
echo "Build claw-compiler" | ||
if [ ! -d ${package_basedir}/claw-compiler ] ; then | ||
git clone [email protected]:claw-project/claw-compiler.git ${package_basedir}/claw-compiler | ||
fi | ||
|
||
cd ${package_basedir}/claw-compiler | ||
|
||
export claw_compiler_install=$install_path_prefix_ | ||
|
||
if [[ ! -f $claw_compiler_install/bin/clawfc || $REBUILD == YES ]]; then | ||
if [ $REBUILD == YES ] ; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get the error because REBUILD is not define, so you should give it a default in the head of your script or always check for existence |
||
echo `pwd` | ||
echo "Rebuilding claw-compiler" | ||
echo "rm -rf build" | ||
rm -rf build | ||
fi | ||
|
||
export PATH=$ANT_HOME/bin:$PATH | ||
|
||
# Get OMNI Compiler as submodule | ||
git submodule init | ||
git submodule update | ||
|
||
if [ ! -d build ] ; then | ||
mkdir build | ||
fi | ||
cd build | ||
|
||
if [[ "${slave}" == "kesch" ]] || [[ "${slave}" == "arolla" ]] ; then | ||
cmake -DCMAKE_INSTALL_PREFIX="$claw_compiler_install" .. | ||
elif [[ "${slave}" == "daint" ]] || [[ "${slave}" == "tave" ]]; then | ||
cmake -DCMAKE_INSTALL_PREFIX="$claw_compiler_install" -DOMNI_MPI_CC="MPI_CC=cc" -DOMNI_MPI_FC="MPI_FC=ftn" .. | ||
fi | ||
|
||
# Compile and run unit tests | ||
# make all transformation test && make install | ||
make | ||
make install | ||
|
||
#remove build directories | ||
cd $base_path | ||
rm -rf ant/ claw-compiler/ hpc-scripts/ | ||
fi | ||
|
||
if [ $? -ne 0 ]; then | ||
exitError 3333 "Unable to compile claw with ${compiler}" | ||
fi | ||
|
||
# Copy module files | ||
cp modules_fortran.env ${install_path}/modules.env | ||
unsetFortranEnvironment | ||
|
||
} | ||
|
||
# Build | ||
if [ "${compiler_target}" != "all" ]; then | ||
if [ "${install_local}" != "yes" ] ; then | ||
install_path_prefix_="${install_path_prefix_}/${compiler_target}" | ||
fi | ||
build_compiler_target "${compiler_target}" "${install_path_prefix_}" | ||
else | ||
for c_ in ${compilers[@]}; do | ||
build_compiler_target "${c_}" "${install_path_prefix_}/$c_/" | ||
done | ||
fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably should copy this under meteowiss, I ll add a todo (no change needed for this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #73