aboutsummaryrefslogtreecommitdiff
blob: 933130a49720504d6f19fd40eec0f6b8454040cf (plain)
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

DESCRIPTION="Lightweight, general, scalable C++ library for finite element methods"
HOMEPAGE="
	https://mfem.org/
	https://github.com/mfem/mfem/
"
SRC_URI="https://github.com/mfem/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"

KEYWORDS="~amd64"
LICENSE="BSD"
SLOT="0"
IUSE_AMDGPU="
	amdgpu_gfx701 amdgpu_gfx702 amdgpu_gfx704
	amdgpu_gfx802 amdgpu_gfx803 amdgpu_gfx805 amdgpu_gfx810
	amdgpu_gfx900 amdgpu_gfx904 amdgpu_gfx906 amdgpu_gfx908 amdgpu_gfx909 amdgpu_gfx90a amdgpu_gfx940
	amdgpu_gfx1010 amdgpu_gfx1011 amdgpu_gfx1012 amdgpu_gfx1030 amdgpu_gfx1031 amdgpu_gfx1032 amdgpu_gfx1034
	amdgpu_gfx1100 amdgpu_gfx1101 amdgpu_gfx1102
"
cpuflags="
	cpu_flags_x86_mmx cpu_flags_x86_mmxext cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3
	cpu_flags_x86_ssse3 cpu_flags_x86_sse4a cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_avx
	cpu_flags_x86_avx2 cpu_flags_x86_avx512dq cpu_flags_x86_avx512f cpu_flags_x86_avx512vl
	cpu_flags_x86_3dnow cpu_flags_x86_3dnowext cpu_flags_ppc_vsx cpu_flags_ppc_vsx2 cpu_flags_ppc_vsx3
	cpu_flags_ppc_altivec cpu_flags_arm_neon cpu_flags_arm_iwmmxt cpu_flags_arm_iwmmxt2 cpu_flags_arm_neon
"
IUSE="
	${IUSE_AMDGPU}
	${cpuflags}
	benchmark codipack debug examples exceptions ginkgo hip lapack +metis mpfr mpi mumps netcdf openmp petsc slepc sparse ssl strumpack sundials superlu test threadsafe unwind zlib
"
# TODO: cuda mesquite gslib

RDEPEND="
	benchmark? ( dev-cpp/benchmark )
	codipack? ( sci-libs/CoDiPack )
	ginkgo? ( sci-libs/ginkgo )
	hip? (
		sci-libs/hipSPARSE
		dev-util/hip
	)
	lapack? (
		virtual/blas
		virtual/lapack
	)
	metis? ( sci-libs/metis )
	mpfr? ( dev-libs/mpfr )
	mpi? (
		sci-libs/hypre[mpi]
		virtual/mpi[cxx]
	)
	mumps? ( sci-libs/mumps[mpi] )
	netcdf? ( sci-libs/netcdf )
	petsc? ( sci-mathematics/petsc[mpi] )
	slepc? ( sci-mathematics/slepc[mpi] )
	sparse? (
		sci-libs/amd
		sci-libs/btf
		sci-libs/camd
		sci-libs/ccolamd
		sci-libs/cholmod
		sci-libs/colamd
		sci-libs/klu
		sci-libs/umfpack
	)
	ssl? ( net-libs/gnutls )
	strumpack? ( sci-libs/STRUMPACK )
	sundials? (
		sci-libs/sundials
		mpi? ( sci-libs/sundials[hypre,mpi] )
	)
	superlu? ( sci-libs/superlu_dist )
	unwind? ( || ( sys-libs/libunwind sys-libs/llvm-libunwind ) )
	zlib? ( sys-libs/zlib )
"
DEPEND="${RDEPEND}"
BDEPEND="app-doc/doxygen[dot]"

PATCHES=( "${FILESDIR}/${P}-bump-cmake-version.patch" )
RESTRICT="!test? ( test )"
DOCS=( README CHANGELOG CITATION.cff )
REQUIRED_USE="
	hip? ( || ( ${IUSE_AMDGPU/+/} ) )
	mpi? ( metis )
	mumps? ( mpi )
	petsc? ( mpi )
	slepc? ( petsc )
	strumpack? ( mpi )
	superlu? ( mpi )
"
#pumi? ( mpi )
#?? ( cuda hip )

src_configure() {
	if use hip ; then
		HIP_ARCH=""
		for u in ${IUSE_AMDGPU} ; do
			if use ${u} ; then
				HIP_ARCH="${HIP_ARCH},${u/amdgpu_/}"
			fi
		done
		# remove first character (,)
		HIP_ARCH="${HIP_ARCH:1}"
		export HIP_ARCH
	fi
	local mycmakeargs=(
		-DBUILD_SHARED_LIBS=ON
		-DMFEM_ENABLE_MINIAPPS=ON
		-DMFEM_USE_ADIOS2=NO
		-DMFEM_USE_AMGX=NO
		-DMFEM_USE_CALIPER=NO
		-DMFEM_USE_CEED=NO
		-DMFEM_USE_CONDUIT=NO
		-DMFEM_USE_CUDA=NO
		-DMFEM_USE_FMS=NO
		-DMFEM_USE_GSLIB=NO
		-DMFEM_USE_HIOP=NO
		-DMFEM_USE_MKL_CPARDISO=NO
		-DMFEM_USE_MOONOLITH=NO
		-DMFEM_USE_OCCA=NO
		-DMFEM_USE_PARELAG=NO
		-DMFEM_USE_PUMI=NO
		-DMFEM_USE_RAJA=NO
		-DMFEM_USE_SIDRE=NO
		-DMFEM_USE_UMPIRE=NO

		-DMFEM_DEBUG=$(usex debug)
		-DMFEM_ENABLE_EXAMPLES=$(usex examples)
		-DMFEM_ENABLE_TESTING=$(usex test)
		-DMFEM_THREAD_SAFE=$(usex threadsafe)
		-DMFEM_USE_BENCHMARK=$(usex benchmark)
		-DMFEM_USE_CODIPACK=$(usex codipack)
		-DMFEM_USE_EXCEPTIONS=$(usex exceptions)
		-DMFEM_USE_GINKGO=$(usex ginkgo)
		-DMFEM_USE_GNUTLS=$(usex ssl)
		-DMFEM_USE_HIP=$(usex hip)
		-DMFEM_USE_LAPACK=$(usex lapack)
		-DMFEM_USE_LIBUNWIND=$(usex unwind)
		-DMFEM_USE_METIS=$(usex metis)
		-DMFEM_USE_MPFR=$(usex mpfr)
		-DMFEM_USE_MPI=$(usex mpi)
		-DMFEM_USE_MUMPS=$(usex mumps)
		-DMFEM_USE_NETCDF=$(usex netcdf)
		-DMFEM_USE_OPENMP=$(usex openmp)
		-DMFEM_USE_PETSC=$(usex petsc)
		-DMFEM_USE_SLEPC=$(usex slepc)
		-DMFEM_USE_STRUMPACK=$(usex strumpack)
		-DMFEM_USE_SUITESPARSE=$(usex sparse)
		-DMFEM_USE_SUPERLU=$(usex superlu)
		-DMFEM_USE_ZLIB=$(usex zlib)
	)
	if use codipack; then
		mycmakeargs+=( "-DCODIPACK_INCLUDE_DIR=${EPREFIX}/usr/include/codi" )
	fi
	if use mpi; then
		mycmakeargs+=( "-DHYPRE_INCLUDE_DIR=${EPREFIX}/usr/include/hypre" )
	fi
	if use petsc; then
		mycmakeargs+=( "-DPETSC_DIR=${EPREFIX}/usr/$(get_libdir)/petsc" )
		mycmakeargs+=( "-DPETSC_ARCH=" )
	fi
	local simd=OFF
	for f in ${cpuflags} ; do
		if use ${f} ; then
			simd=ON
			break
		fi
	done
	mycmakeargs+=( "-DMFEM_USE_SIMD=${simd}" )
	cmake_src_configure
}

src_install() {
	cmake_src_install
	einstalldocs
	# https://github.com/mfem/mfem/issues/3019
	mv "${ED}/usr/lib" _lib || die
	mv _lib "${ED}/usr/$(get_libdir)" || die
}