-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cupla [Qapla'] is a simple user interface for the platform independent parallel kernel acceleration library alpaka. It follows a similar concept as the NVIDIA® CUDA® API by providing a software layer to manage accelerator devices. alpaka is used as backend for cupla. See https://github.com/ComputationalRadiationPhysics/cupla/blob/master/README.md for more information. See https://github.com/ComputationalRadiationPhysics/cupla/releases forthe latest changes.
- Loading branch information
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
### RPM external cupla-toolfile 1.0 | ||
Requires: cupla | ||
|
||
%prep | ||
|
||
%build | ||
|
||
%install | ||
|
||
mkdir -p %i/etc/scram.d | ||
cat << \EOF_TOOLFILE >%i/etc/scram.d/cupla.xml | ||
<tool name="cupla" version="@TOOL_VERSION@"> | ||
<use name="boost"/> | ||
<client> | ||
<environment name="CUPLA_BASE" default="@TOOL_ROOT@"/> | ||
<environment name="INCLUDE" default="$CUPLA_BASE/include"/> | ||
<environment name="LIBDIR" default="$CUPLA_BASE/lib"/> | ||
</client> | ||
</tool> | ||
EOF_TOOLFILE | ||
|
||
cat << \EOF_TOOLFILE >%i/etc/scram.d/cupla-serial.xml | ||
<tool name="cupla-serial" version="@TOOL_VERSION@"> | ||
<use name="cupla"/> | ||
<flags CXXFLAGS="-DALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED -DCUPLA_STREAM_ASYNC_ENABLED=0"/> | ||
</tool> | ||
EOF_TOOLFILE | ||
|
||
cat << \EOF_TOOLFILE >%i/etc/scram.d/cupla-tbb.xml | ||
<tool name="cupla-tbb" version="@TOOL_VERSION@"> | ||
<use name="cupla"/> | ||
<use name="tbb"/> | ||
<flags CXXFLAGS="-DALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLED -DCUPLA_STREAM_ASYNC_ENABLED=1"/> | ||
</tool> | ||
EOF_TOOLFILE | ||
|
||
cat << \EOF_TOOLFILE >%i/etc/scram.d/cupla-cuda.xml | ||
<tool name="cupla-cuda" version="@TOOL_VERSION@"> | ||
<use name="cupla"/> | ||
<use name="cuda"/> | ||
<flags CXXFLAGS="-DALPAKA_ACC_GPU_CUDA_ENABLED -DCUPLA_STREAM_ASYNC_ENABLED=1"/> | ||
</tool> | ||
EOF_TOOLFILE | ||
|
||
## IMPORT scram-tools-post |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
### RPM external cupla 0.2.0 | ||
|
||
Source: https://github.com/ComputationalRadiationPhysics/%{n}/archive/%{realversion}.tar.gz | ||
Requires: alpaka | ||
Requires: cuda | ||
Requires: tbb | ||
|
||
%prep | ||
%setup -n %{n}-%{realversion} | ||
|
||
%build | ||
mkdir build lib | ||
|
||
# remove the version of Alpaka bundled with Cupla | ||
rm -rf alpaka | ||
|
||
CXXFLAGS="-m64 -std=c++14 -g -O3 -DALPAKA_DEBUG=0 -I$CUDA_ROOT/include -I$TBB_ROOT/include -I$BOOST_ROOT/include -I$ALPAKA_ROOT/include -Iinclude" | ||
HOST_FLAGS="-pthread -fPIC -Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-attributes -Wno-reorder -Wno-sign-compare" | ||
NVCC_FLAGS="-w --generate-line-info --source-in-ptx --cudart=shared --expt-extended-lambda --expt-relaxed-constexpr -gencode arch=compute_35,code=sm_35 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70" | ||
FILES=$(find src -type f -name *.cpp) | ||
|
||
# build the serial CPU backend | ||
mkdir build/seq-seq-sync | ||
for FILE in $FILES; do | ||
g++ -DALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED -DCUPLA_STREAM_ASYNC_ENABLED=0 $CXXFLAGS $HOST_FLAGS -c $FILE -o build/seq-seq-sync/$(basename $FILE).o | ||
done | ||
|
||
# build the TBB CPU backend | ||
mkdir build/tbb-seq-async | ||
for FILE in $FILES; do | ||
g++ -DALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLED -DCUPLA_STREAM_ASYNC_ENABLED=1 $CXXFLAGS $HOST_FLAGS -c $FILE -o build/tbb-seq-async/$(basename $FILE).o | ||
done | ||
|
||
# build the CUDA GPU backend | ||
mkdir build/cuda-async | ||
for FILE in $FILES; do | ||
nvcc -DALPAKA_ACC_GPU_CUDA_ENABLED -DCUPLA_STREAM_ASYNC_ENABLED=1 $CXXFLAGS $NVCC_FLAGS -Xcompiler "$HOST_FLAGS" -x cu -c $FILE -o build/cuda-async/$(basename $FILE).o | ||
done | ||
|
||
# link all backends in a single library | ||
g++ $CXXFLAGS $HOST_FLAGS build/*/*.o -L$CUDA_ROOT/lib64 -lcudart -L$TBB_ROOT/lib -ltbbmalloc -ltbb -shared -o lib/libcupla.so | ||
|
||
|
||
%install | ||
cp -ar include %{i}/include | ||
cp -ar lib %{i}/lib | ||
|
||
%post |