summaryrefslogtreecommitdiffstats
path: root/gasnet/gasnet.spec
blob: e8086d453033fbebf689e288ad3a50c8cf371b5e (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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
Name:           gasnet
Version:        1.26.4
Release:        3%{?dist}
Summary:        A Portable High-Performance Communication Layer for GAS Languages
License:        PostgreSQL
Url:            https://bitbucket.org/berkeleylab/gasnet/
Source0:        https://bitbucket.org/berkeleylab/gasnet/downloads/GASNet-%{version}.tar.gz
# PATCH-FIX-UPSTREAM - ef402803a4791dd73792042a886e9c3fb0989d17.patch - Support overwriting of flags, see https://bitbucket.org/berkeleylab/gasnet/pull-requests/34
Patch0:         https://bitbucket.org/berkeleylab/gasnet/commits/ef402803a4791dd73792042a886e9c3fb0989d17/raw#/ef402803a4791dd73792042a886e9c3fb0989d17.patch
# PATCH-FIX-UPSTREAM - ef26bec6ac1531fd61ed4e6e7509046e45cd8614.patch - Filter fPIC functions in make check, see https://upc-bugs.lbl.gov/bugzilla/show_bug.cgi?id=3321 and https://bitbucket.org/berkeleylab/gasnet/pull-requests/37
Patch1:         https://bitbucket.org/berkeleylab/gasnet/commits/ef26bec6ac1531fd61ed4e6e7509046e45cd8614/raw#/ef26bec6ac1531fd61ed4e6e7509046e45cd8614.patch
BuildRequires:  automake
Requires:       %{name}-common%{?_isa} = %{version}-%{release}

%description
GASNet is a language-independent, low-level networking layer that provides
network-independent, high-performance communication primitives tailored for
implementing parallel global address space SPMD languages
such as UPC, Titanium, and Co-Array Fortran.

%package common
Summary:        GASNet Open MPI binaries and libraries
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

%description common
GASNet is a language-independent, low-level networking layer that provides
network-independent, high-performance communication primitives tailored for
implementing parallel global address space SPMD languages
such as UPC, Titanium, and Co-Array Fortran.

GASNet files shared between serial and parallel versions

%package openmpi
Summary:        GASNet Open MPI binaries and libraries
Requires:       %{name}-common%{?_isa} = %{version}-%{release}
BuildRequires:  openmpi-devel

%description openmpi
GASNet is a language-independent, low-level networking layer that provides
network-independent, high-performance communication primitives tailored for
implementing parallel global address space SPMD languages
such as UPC, Titanium, and Co-Array Fortran.

GASNet compiled with Open MPI, package incl. binaries and libraries

%package mpich
Summary:        GASNet Open MPI binaries and libraries
Requires:       %{name}-common%{?_isa} = %{version}-%{release}
BuildRequires:  mpich-devel

%description mpich
GASNet is a language-independent, low-level networking layer that provides
network-independent, high-performance communication primitives tailored for
implementing parallel global address space SPMD languages
such as UPC, Titanium, and Co-Array Fortran.

GASNet compiled with MPICH, package incl. binaries and libraries

%package devel
Summary:        Development package for GASNet
Requires:       %{name}%{?_isa} = %{version}
Requires:       mpich-devel
Requires:       openmpi-devel

%description devel
GASNet is a language-independent, low-level networking layer that provides
network-independent, high-performance communication primitives tailored for
implementing parallel global address space SPMD languages
such as UPC, Titanium, and Co-Array Fortran.

Development package for GASNet. Including header files and libraries.

%package doc
Summary:        Documentation package for GASNet
BuildArch:      noarch

%description doc
GASNet is a language-independent, low-level networking layer that provides
network-independent, high-performance communication primitives tailored for
implementing parallel global address space SPMD languages
such as UPC, Titanium, and Co-Array Fortran.

Documentation package for GASNet.

%prep
%setup -q -n GASNet-%{version}
%patch0 -p1
%patch1 -p1
./Bootstrap -y

%build
mkdir serial openmpi mpich
%global dconfigure %(printf %%s '%configure' | sed 's!\./configure!../configure!g')

pushd serial
%dconfigure --enable-udp --disable-mpi --enable-par --disable-aligned-segments  --enable-segment-fast --disable-pshm --with-segment-mmap-max=4GB CC="gcc -fPIC" CXX="g++ -fPIC"
%make_build MANUAL_CFLAGS="%optflags -fPIC" MANUAL_MPICFLAGS="%optflags -fPIC" MANUAL_CXXFLAGS="%optflags -fPIC"
popd

pushd openmpi
%{_openmpi_load}
%dconfigure --enable-udp --enable-mpi --enable-par --disable-aligned-segments  --enable-segment-fast --disable-pshm --with-segment-mmap-max=4GB --bindir="${MPI_BIN}"  --includedir="${MPI_INCLUDE}" --libdir="${MPI_LIB}" CC="gcc -fPIC" CXX="g++ -fPIC"
%make_build MANUAL_CFLAGS="%optflags -fPIC" MANUAL_MPICFLAGS="%optflags -fPIC" MANUAL_CXXFLAGS="%optflags -fPIC"
%{_openmpi_unload}
popd

pushd mpich
%{_mpich_load}
%dconfigure --enable-udp --enable-mpi --enable-par --disable-aligned-segments  --enable-segment-fast --disable-pshm --with-segment-mmap-max=4GB --bindir="${MPI_BIN}"  --includedir="${MPI_INCLUDE}" --libdir="${MPI_LIB}" CC="gcc -fPIC" CXX="g++ -fPIC"
%make_build MANUAL_CFLAGS="%optflags -fPIC" MANUAL_MPICFLAGS="%optflags -fPIC" MANUAL_CXXFLAGS="%optflags -fPIC"
%{_mpich_unload}
popd

%check
make -C serial check MANUAL_CFLAGS="%optflags -fPIC" MANUAL_MPICFLAGS="%optflags -fPIC" MANUAL_CXXFLAGS="%optflags -fPIC"
%{_openmpi_load}
make -C openmpi check MANUAL_CFLAGS="%optflags -fPIC" MANUAL_MPICFLAGS="%optflags -fPIC" MANUAL_CXXFLAGS="%optflags -fPIC"
%{_openmpi_unload}
%{_mpich_load}
make -C mpich check MANUAL_CFLAGS="%optflags -fPIC" MANUAL_MPICFLAGS="%optflags -fPIC" MANUAL_CXXFLAGS="%optflags -fPIC"
%{_mpich_unload}

%install
%make_install -C serial
%make_install -C openmpi
%make_install -C mpich

#shared between serial and parallel
rm -f %{buildroot}/%{_libdir}/*mpi*/bin/gasnet_trace

chmod +x %{buildroot}/%{_bindir}/*.pl
sed -i '1s@env @@' %{buildroot}/%{_bindir}/*.pl
chmod +x %{buildroot}/%{_libdir}/*mpi*/bin/*.pl
sed -i '1s@env @@' %{buildroot}/%{_libdir}/*mpi*/bin/*.pl

#Upstream doesn't want to support shared libs: https://bitbucket.org/berkeleylab/gasnet/pull-requests/36
#mind the order for link deps, libgasnet-smp-par first then libam* then the rest
for l in %{buildroot}/%{_libdir}/{,*mpi*/lib}/lib{gasnet_tools-seq,am*,*}.a; do \
    [[ -f $l ]] || continue; \
    soname=`basename $l .a`; \
    libdir=`dirname $l`; \
    libs= ; \
    [[ ${soname} = libgasnet-*-par* ]] && libs+=" -lpthread"; \
    [[ ${soname} = libamudp ]] && libs+=" -L${libdir} -lgasnet_tools-seq"; \
    [[ ${soname} = libammpi ]] && libs+=" -L${libdir#%{buildroot}} -lmpi"; \
    [[ ${soname} = libgasnet-udp-* ]] && libs+=" -L${libdir} -lamudp"; \
    [[ ${soname} = libgasnet-mpi-* ]] && libs+=" -L${libdir} -lammpi"; \
    [[ ${l} = *mpi*/libgasnet-*-* ]] && libs+=" -lrt"; \
    g++ -shared -Wl,-soname=${soname}-%{version}.so \
        -Wl,--as-needed -Wl,-z,defs -Wl,--rpath-link=. \
        -Wl,--whole-archive ${l} -Wl,--no-whole-archive \
        ${libs} -o ${libdir}/${soname}-%{version}.so && \
    ln -s ${soname}-%{version}.so ${libdir}/${soname}.so && \
    rm ${l} ; \
done

# MPI subpackages don't need the ldconfig magic.  They are hidden by
# default, in MPI back-end-specific directory, and only show to the
# user after the relevant environment module has been loaded.
# rpmlint will report that as errors, but it is fine.
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%{_bindir}/amudprun
%{_libdir}/lib*-%{version}.so
%doc ChangeLog README README-release README-tools
%license license.txt

%files common
%{_bindir}/gasnet_trace*

%files openmpi
%{_libdir}/openmpi*/bin/*
%{_libdir}/openmpi*/lib/lib*-%{version}.so

%files mpich
%{_libdir}/mpich*/bin/*
%{_libdir}/mpich*/lib/lib*-%{version}.so

%files doc
%{_datadir}/doc/GASNet

%files devel
%doc ChangeLog README-git README-devel
%{_includedir}/*.h
%{_includedir}/*.mak
%{_includedir}/*-conduit
%{_libdir}/lib*[a-z].so
%{_libdir}/valgrind
%{_includedir}/openmpi-*/*
%{_libdir}/openmpi*/lib/lib*[a-z].so
%{_libdir}/openmpi*/lib/valgrind
%{_includedir}/mpich-*/*
%{_libdir}/mpich*/lib/lib*[a-z].so
%{_libdir}/mpich*/lib/valgrind

%changelog
* Mon Sep 26 2016 Christoph Junghans <junghans@votca.org> - 1.26.4-3
- More changes from review (bug #1375744)

* Thu Sep 22 2016 Christoph Junghans <junghans@votca.org> - 1.26.4-2
- Minor changes from review (bug #1375744)

* Mon Sep 12 2016 Christoph Junghans <junghans@votca.org> - 1.26.4-1
- First release.