aboutsummaryrefslogtreecommitdiff
blob: 6ac68d96078e109858bc3a9083fa55dae284b46b (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
# Copyright 2019-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

FORTRAN_NEED_OPENMP=1
FORTRAN_STANDARD=90
LLVM_MAX_SLOT=14

inherit llvm fortran-2 toolchain-funcs

DESCRIPTION="Scalable Performance Measurement Infrastructure for Parallel Codes"
HOMEPAGE="https://www.vi-hps.org/projects/score-p"
SRC_URI="https://perftools.pages.jsc.fz-juelich.de/cicd/${PN}/tags/${P}/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64"
IUSE="debug gcc-plugin llvm mpi online-access opencl openshmem pmi unwind"

CDEPEND="
	dev-libs/cubelib
	dev-libs/cubew
	dev-libs/papi
	sys-cluster/opari2
	<sys-cluster/otf2-3.0
	sys-libs/binutils-libs:=
	sys-libs/zlib

	llvm? (
		sys-devel/clang:"${LLVM_MAX_SLOT}"
		<sys-devel/llvm-"${LLVM_MAX_SLOT}":=
		|| (
			sys-devel/llvm:12
			sys-devel/llvm:13
			sys-devel/llvm:"${LLVM_MAX_SLOT}"
		)
	)
	mpi? ( virtual/mpi )
	openshmem? ( sys-cluster/SOS )
	pmi? ( || ( sys-cluster/slurm sys-cluster/pmix[pmi] ) )
	unwind? ( || ( sys-libs/libunwind sys-libs/llvm-libunwind ) )
"
RDEPEND="
	${CDEPEND}
	opencl? ( virtual/opencl )
"
DEPEND="
	${CDEPEND}
	opencl? ( dev-util/opencl-headers )
"

pkg_setup() {
	use llvm && llvm_pkg_setup
	fortran-2_pkg_setup
}

src_prepare() {
	tc-export CC CXX FC F77 CPP AR
	# eautoreconf will need custom autotools
	sed -e "s|CC=gcc|CC=${CC}|g" -i build-score/configure || die
	rm build-config/common/platforms/platform-* || die

	cat > build-config/common/platforms/platform-backend-user-provided <<-EOF || die
	CC=${CC}
	CXX=${CXX}
	FC=${FC}
	F77=${F77}
	CPP=${CPP}
	CXXCPP=${CPP}
	EOF

	cat > build-config/common/platforms/platform-frontend-user-provided <<-EOF || die
	CC_FOR_BUILD=${CC}
	F77_FOR_BUILD=${F77}
	FC_FOR_BUILD=${FC}
	CXX_FOR_BUILD=${CXX}
	LDFLAGS_FOR_BUILD=${LDFLAGS}
	CFLAGS_FOR_BUILD=${CFLAGS}
	CXXFLAGS_FOR_BUILD=${CXXFLAGS}
	CPPFLAGS_FOR_BUILD=${CPPFLAGS}
	FCFLAGS_FOR_BUILD=${FCFLAGS}
	FFLAGS_FOR_BUILD=${FFLAGS}
	CXXFLAGS_FOR_BUILD_SCORE=${CXXFLAGS}
	EOF

	cat > build-config/common/platforms/platform-mpi-user-provided <<-EOF || die
	MPICC=mpicc
	MPICXX=mpicxx
	MPIF77=mpif77
	MPIFC=mpif90
	MPI_CPPFLAGS=${CPPFLAGS}
	MPI_CFLAGS=${CFLAGS}
	MPI_CXXFLAGS=${CXXFLAGS}
	MPI_FFLAGS=${FFLAGS}
	MPI_FCFLAGS=${FCFLAGS}
	MPI_LDFLAGS=${LDFLAGS}
	EOF

	cat > build-config/common/platforms/platform-shmem-user-provided <<-EOF || die
	SHMEMCC=oshcc
	SHMEMCXX=oshc++
	SHMEMF77=oshfort
	SHMEMFC=oshfort
	SHMEM_CPPFLAGS=${CPPFLAGS}
	SHMEM_CFLAGS=${CFLAGS}
	SHMEM_CXXFLAGS=${CXXFLAGS}
	SHMEM_FFLAGS=${FFLAGS}
	SHMEM_FCFLAGS=${FCFLAGS}
	SHMEM_LDFLAGS=${LDFLAGS}
	SHMEM_LIBS=-lsma
	SHMEM_LIB_NAME=libsma
	SHMEM_NAME=sandia-openshmem
	EOF

	rm -r vendor || die
	default
}

src_configure() {

	local myconf=(
		--disable-cuda
		--disable-experimental-platform
		--disable-openacc
		--disable-platform-mic
		--disable-static
		--enable-shared
		--with-cubelib
		--with-cubew
		--with-custom-compilers
		--with-libbfd
		--with-opari2
		--with-otf2
		--with-papi-header="/usr/include"
		--with-papi-lib="/usr/$(get_libdir)"
		--without-libcuda
		--without-libcudart
		--without-libcupti
		--without-liblustreapi
		--without-libnvidia-ml
		--without-librca
		--without-pdt

		$(use_enable debug)
		$(use_with gcc-plugin)
		$(use_with online-access)
		$(use_with opencl libOpenCL)
		$(use_with openshmem shmem openshmem)
		$(use_with pmi)
		$(use_with unwind libunwind)
	)
	if use llvm; then
		myconf+=( "--with-llvm=$(get_llvm_prefix)/bin" )
	else
		myconf+=( "--without-llvm" )
	fi
	use mpi || myconf+=( "--without-mpi" )

	econf "${myconf[@]}"
}

src_install() {
	default
	find "${ED}" -name '*.la' -delete || die
}