Skip to content

Commit

Permalink
fix example build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed Apr 17, 2021
1 parent ff0e23d commit fd796c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
24 changes: 11 additions & 13 deletions examples/build-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@

# copy libraries
LIBRARY_DIRS="core core/device_hooks reference omp cuda hip"
LIBRARY_NAMES="ginkgo ginkgo_reference ginkgo_omp ginkgo_cuda ginkgo_hip ginkgo_dpcpp"
LIBRARY_NAMES="ginkgo ginkgo_reference ginkgo_omp ginkgo_cuda ginkgo_hip ginkgo_dpcpp ginkgo_device"
SUFFIXES=".so .dylib .dll d.so d.dylib d.dll"
VERSION="1.4.0"
for prefix in ${LIBRARY_DIRS}; do
for name in ${LIBRARY_NAMES}; do
for suffix in ${SUFFIXES}; do
cp ${BUILD_DIR}/${prefix}/lib${name}${suffix}.${VERSION} \
${THIS_DIR} 2>/dev/null
if [ -e "${THIS_DIR}/lib${name}${suffix}.${VERSION}" ]
then
ln -s ${THIS_DIR}/lib${name}${suffix}.${VERSION} ${THIS_DIR}/lib${name}${suffix} 2>/dev/null
fi
done
for name in ${LIBRARY_NAMES}; do
for suffix in ${SUFFIXES}; do
cp ${BUILD_DIR}/lib/lib${name}${suffix}.${VERSION} \
${THIS_DIR} 2>/dev/null
if [ -e "${THIS_DIR}/lib${name}${suffix}.${VERSION}" ]
then
ln -s ${THIS_DIR}/lib${name}${suffix}.${VERSION} ${THIS_DIR}/lib${name}${suffix} 2>/dev/null
fi
done
done

# figure out correct compiler flags
if ls ${THIS_DIR} | grep -F "libginkgo." >/dev/null; then
LINK_FLAGS="-lginkgo -lginkgo_omp -lginkgo_cuda -lginkgo_reference -lginkgo_hip -lginkgo_dpcpp -Wl,-rpath,${THIS_DIR}"
LINK_FLAGS="-lginkgo -lginkgo_omp -lginkgo_cuda -lginkgo_reference -lginkgo_hip -lginkgo_dpcpp -lginkgo_device -Wl,-rpath,${THIS_DIR}"
else
LINK_FLAGS="-lginkgod -lginkgo_ompd -lginkgo_cudad -lginkgo_referenced -lginkgo_hipd -lginkgo_dpcppd -Wl,-rpath,${THIS_DIR}"
LINK_FLAGS="-lginkgod -lginkgo_ompd -lginkgo_cudad -lginkgo_referenced -lginkgo_hipd -lginkgo_dpcppd -lginkgo_deviced -Wl,-rpath,${THIS_DIR}"
fi
if [ -z "${CXX}" ]; then
CXX="c++"
Expand Down
3 changes: 3 additions & 0 deletions examples/cb-gmres/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" &>/dev/null && pwd )

source ${THIS_DIR}/../build-setup.sh

mkdir -p data
cp ${THIS_DIR}/../../matrices/test/ani1.mtx data/A.mtx

# build
${CXX} -std=c++14 -o ${THIS_DIR}/cb-gmres ${THIS_DIR}/cb-gmres.cpp \
-I${THIS_DIR}/../../include -I${BUILD_DIR}/include \
Expand Down
9 changes: 2 additions & 7 deletions examples/custom-matrix-format/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ source ${THIS_DIR}/../build-setup.sh

CXX="nvcc"

# figure out correct compiler flags
if ls ${THIS_DIR} | grep -F "libginkgo." >/dev/null; then
LINK_FLAGS="-lginkgo -lginkgo_omp -lginkgo_cuda -lginkgo_reference -lginkgo_dpcpp -lginkgo_hip -Xlinker -rpath -Xlinker ${THIS_DIR}"
else
LINK_FLAGS="-lginkgod -lginkgo_ompd -lginkgo_cudad -lginkgo_referenced -lginkgo_dpcppd -lginkgo_hipd -Xlinker -rpath -Xlinker ${THIS_DIR}"
fi

# adjust to nvcc style link flags
LINK_FLAGS="${LINK_FLAGS/-Wl,-rpath,/-Xlinker -rpath -Xlinker }"

# build
${CXX} -std=c++14 -o ${THIS_DIR}/custom-matrix-format \
Expand Down

0 comments on commit fd796c9

Please sign in to comment.