Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

add arch selection #338

Merged
merged 7 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ anakin_option(BUILD_FAT_BIN "Build anakin cuda fat-bin lib for all device plantf

cmake_minimum_required(VERSION ${MIN_CMAKE_V} FATAL_ERROR)

if(USE_CUDA)
if(USE_CUDA AND (NOT SELECTED_SASS_TARGET_ARCH))
# Select gpu target arch for local high performance implement sass code . Now we have checked on sm_61 sm_50 and it works well.
set(SELECTED_SASS_TARGET_ARCH "61")
endif()
Expand Down
34 changes: 21 additions & 13 deletions tools/gpu_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
ANAKIN_ROOT="$( cd "$(dirname "$0")"/.. ; pwd -P)"
echo "-- Anakin root dir is: $ANAKIN_ROOT"

# Choose GPU architecture.
if [ "$1" == "sm50" ]; then
NV_ARCH=50
else
NV_ARCH=61
fi

# build the target into gpu_build.
BUILD_ROOT=$ANAKIN_ROOT/gpu_build
BUILD_ROOT=$ANAKIN_ROOT/gpu_build_sm$NV_ARCH

mkdir -p $BUILD_ROOT
echo "-- Build anakin gpu(NVIDIA) into: $BUILD_ROOT"
Expand All @@ -15,18 +22,19 @@ cd $BUILD_ROOT

cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_ARM_PLACE=NO \
-DUSE_GPU_PLACE=YES \
-DUSE_X86_PLACE=NO \
-DBUILD_FAT_BIN=YES \
-DBUILD_WITH_UNIT_TEST=YES \
-DUSE_PYTHON=OFF \
-DENABLE_DEBUG=NO \
-DENABLE_VERBOSE_MSG=NO \
-DDISABLE_ALL_WARNINGS=YES \
-DENABLE_NOISY_WARNINGS=NO \
-DUSE_OPENMP=NO\
-DBUILD_SHARED=YES
-DUSE_ARM_PLACE=NO \
-DUSE_GPU_PLACE=YES \
-DUSE_X86_PLACE=NO \
-DBUILD_FAT_BIN=YES \
-DBUILD_WITH_UNIT_TEST=YES \
-DUSE_PYTHON=OFF \
-DENABLE_DEBUG=NO \
-DENABLE_VERBOSE_MSG=NO \
-DDISABLE_ALL_WARNINGS=YES \
-DENABLE_NOISY_WARNINGS=NO \
-DUSE_OPENMP=NO \
-DBUILD_SHARED=YES \
-DSELECTED_SASS_TARGET_ARCH="$NV_ARCH"

# build target lib or unit test.
if [ "$(uname)" = 'Darwin' ]; then
Expand Down