-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathaction.yml
More file actions
148 lines (142 loc) · 4.74 KB
/
Copy pathaction.yml
File metadata and controls
148 lines (142 loc) · 4.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
# at the Lawrence Livermore National Laboratory. All Rights reserved. See files
# LICENSE and NOTICE for details. LLNL-CODE-806117.
#
# This file is part of the MFEM library. For more information and source code
# availability visit https://mfem.org.
#
# MFEM is free software; you can redistribute it and/or modify it under the
# terms of the BSD-3 license. We welcome feedback and contributions, see file
# CONTRIBUTING.md for details.
name: build-hypre
description: Action to download and build Hypre
inputs:
url:
description: 'URL where to look for Hypre'
required: false
default: 'https://github.com/hypre-space/hypre/archive'
archive:
description: 'Archive to download'
required: true
dir:
description: 'Hypre top directory name'
required: true
target:
description: 'A key to identify the desired hypre config (int32, int64)'
required: false
default: int32
build-system:
description: 'identify the build system to use (make,cmake)'
required: false
default: make
precision:
description: 'Precision of the floating point type (fp32,fp64)'
required: false
default: fp64
num-tasks:
description: 'Number of tasks to use for building: auto, or 1, 2, ...'
required: false
default: 'auto'
runs:
using: "composite"
steps:
- name: Get Hypre (Windows)
if: runner.os == 'Windows'
run: |
$URI_HYPRE = "${{ inputs.url }}/${{ inputs.archive }}"
Invoke-WebRequest -Uri $URI_HYPRE -OutFile ${{ inputs.archive }}
Remove-Item ${{ inputs.dir }} -Force -Recurse -ErrorAction Ignore;
tar -xzf ${{ inputs.archive }};
shell: pwsh
- name: Get Hypre (Linux/macOS)
if: runner.os != 'Windows'
run: |
wget --no-verbose ${{ inputs.url }}/${{ inputs.archive }};
rm -rf ${{ inputs.dir }};
tar -xzf ${{ inputs.archive }};
shell: bash
- name: Install Hypre (make)
if: inputs.build-system == 'make'
run: |
echo "Map target to options"
if [[ "${{ inputs.target }}" == "int32" ]]
then
export hypre_options="--disable-fortran";
elif [[ "${{ inputs.target }}" == "int64" ]]
then
export hypre_options="--disable-fortran --enable-bigint";
else
echo "Hypre target not recognized";
exit 1;
fi
if [[ "${{ inputs.precision }}" == "fp64" ]]
then
:;
elif [[ "${{ inputs.precision }}" == "fp32" ]]
then
export hypre_options="${hypre_options} --enable-single";
else
echo "Hypre precision not recognized";
exit 1;
fi
echo "Installing Hypre"
ntasks="${{ inputs.num-tasks }}"
if [[ "${ntasks}" -ge 1 ]]; then
echo "[STATUS] Number of tasks: ${ntasks}"
else
ntasks=$({ nproc || getconf _NPROCESSORS_ONLN; } 2> /dev/null)
echo "[STATUS] Number of tasks: auto: ${ntasks}"
fi
cd ${{ inputs.dir }};
install_prefix="$(pwd)/install";
cd src;
./configure --prefix=${install_prefix} ${hypre_options} CC=mpicc CXX=mpic++ || {
echo "Hypre configuration failed. Contents of 'config.log':"
cat config.log
exit 1
}
make -j ${ntasks};
make install;
cd ../..;
shell: bash
- name: Install Hypre (cmake)
if: inputs.build-system == 'cmake'
run: |
echo "Map target to options"
if [[ "${{ inputs.target }}" == "int32" ]]
then
export hypre_options="";
elif [[ "${{ inputs.target }}" == "int64" ]]
then
export hypre_options="-DHYPRE_ENABLE_BIGINT=ON";
else
echo "Hypre target not recognized";
exit 1;
fi
if [[ "${{ inputs.precision }}" == "fp64" ]]
then
:;
elif [[ "${{ inputs.precision }}" == "fp32" ]]
then
export hypre_options="${hypre_options} -DHYPRE_ENABLE_SINGLE=ON";
else
echo "Hypre precision not recognized";
exit 1;
fi
echo "Installing Hypre"
ntasks="${{ inputs.num-tasks }}"
if [[ "${ntasks}" -ge 1 ]]; then
echo "[STATUS] Number of tasks: ${ntasks}"
else
ntasks=$({ nproc || getconf _NPROCESSORS_ONLN; } 2> /dev/null)
echo "[STATUS] Number of tasks: auto: ${ntasks}"
fi
cd ${{ inputs.dir }};
cmake -Hsrc -Bbuild \
${hypre_options} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=install
cmake --build build --config Release --parallel ${ntasks}
cmake --install build --config Release
cd ../..;
shell: bash