Skip to content

Commit 3dbfb5d

Browse files
authored
Merge pull request #392 from sourceryinstitute/add-hpclinux-installer
Adding developer-scripts/hpclinux-install.sh
2 parents 12c5d5f + d79d70c commit 3dbfb5d

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

developer-scripts/hpclinux-install.sh

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/usr/bin/env bash
2+
3+
# BSD 3-Clause License
4+
#
5+
# -- hpclinux-install.sh
6+
#
7+
# Install OpenCoarrays inside the HPCLinux distribution from hpclinux.org.
8+
#
9+
# Usage: cd opencoarrays && ./prerequisites/hpclinux-install.sh"
10+
#
11+
# Motivation:
12+
#
13+
# On Fedora-based distributions, the OpenCoarrays installer fails during the stack-based
14+
# system interrogation (presumably due to problems with the prerequisites/stack.sh script).
15+
# At least in the case of HPCLinux, system interrogation is unnecessary because HPCLinux is
16+
# uber-stable and it's safe bet that all prerequisites need to be installed so this script
17+
# omits the interrogation and invokes prerequisites/build.sh to build all prerequisites.
18+
#
19+
# Copyright (c) 2016, Sourcery Institute
20+
# All rights reserved.
21+
#
22+
# Redistribution and use in source and binary forms, with or without
23+
# modification, are permitted provided that the following conditions are met:
24+
#
25+
# * Redistributions of source code must retain the above copyright notice, this
26+
# list of conditions and the following disclaimer.
27+
#
28+
# * Redistributions in binary form must reproduce the above copyright notice,
29+
# this list of conditions and the following disclaimer in the documentation
30+
# and/or other materials provided with the distribution.
31+
#
32+
# * Neither the name of the copyright holder nor the names of its
33+
# contributors may be used to endorse or promote products derived from
34+
# this software without specific prior written permission.
35+
#
36+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
40+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
42+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
43+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46+
47+
if [[ ! -d prerequisites ]]; then
48+
echo "Please execute this script with your present working directory"
49+
echo "set to the top level of the OpenCoarrays source tree."
50+
exit 1
51+
fi
52+
53+
pushd prerequisites
54+
55+
# Build CMake using the system GCC (4.8.1) and prepend its bin subdirectory to the PATH
56+
export cmake_install_path="${PWD}"/installations/cmake/cmake
57+
./build.sh --package cmake --install-prefix "${cmake_install_path}"
58+
if [[ -z "${PATH}" ]]; then
59+
export PATH="${cmake_install_path}"/bin
60+
else
61+
export PATH="${cmake_install_path}"/bin:$PATH
62+
fi
63+
64+
# Build GCC 6.3.0 and prepend its bin subdirectory to the PATH
65+
export gcc_version=6.3.0
66+
export gcc_install_path="${PWD}"/installations/gnu/$gcc_version
67+
./build.sh --package gcc --install-version $gcc_version --install-prefix "${gcc_install_path}"
68+
export PATH="${gcc_install_path}"/bin:$PATH
69+
export LD_LIBRARY_PATH="${gcc_install_path}"/lib64:"${gcc_install_path}"/lib:$LD_LIBRARY_PATH
70+
71+
# Build MPICH 3.2 and prepend its bin subdirectory to the PATH
72+
export mpich_install_path="${PWD}"/installations/mpich
73+
./build.sh --package mpich --install-prefix "${mpich_install_path}" --num-threads 4
74+
export PATH="${mpich_install_path}"/bin:$PATH
75+
76+
popd # return to top level of OpenCoarrays source tree
77+
78+
# Build OpenCoarrays
79+
if [[ -d build ]]; then
80+
echo -e 'Old build subdirectory found. Ok to delete the "build" subdirectory? (Y/n) '
81+
read -r delete_build
82+
83+
if [[ "$delete_build" == "n" || "$delete_build" == "no" ]]; then
84+
printf "n\n"
85+
echo -e "Please rename or delete the build subdirectory and restart this script. Aborting. [exit 10]\n"
86+
exit 10
87+
else # permission granted to delete build subdirectory
88+
printf "Y\n"
89+
fi
90+
rm -rf build
91+
fi
92+
mkdir build
93+
pushd build
94+
95+
export opencoarrays_install_path="${PWD}"/prerequisites/installations/opencoarrays
96+
FC=gfortran CC=gcc cmake .. -DCMAKE_INSTALL_PREFIX="{opencoarrays_install_path}"
97+
make
98+
make install
99+
export PATH="${opencoarrays_install_path}"/bin:$PATH
100+
101+
popd # return to top level of OpenCoarrays source tree

0 commit comments

Comments
 (0)