From a63bee1b942bbb040dd6504a57128c3d5a6d99f0 Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 15 Aug 2023 23:14:12 +0200 Subject: [PATCH] Allow docker container to use GPU Signed-off-by: brian (cherry picked from commit 1c1ec071efc5c4d9fbb991be38b49a31c8c76644) --- cavis-native/cavis-native-lib/build.gradle | 3 ++- .../cavis-native-lib/src/main/cpp/blas/CMakeLists.txt | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cavis-native/cavis-native-lib/build.gradle b/cavis-native/cavis-native-lib/build.gradle index 4369274b1..249bf2717 100644 --- a/cavis-native/cavis-native-lib/build.gradle +++ b/cavis-native/cavis-native-lib/build.gradle @@ -336,11 +336,12 @@ chipList.each { thisChip -> && !project.getProperty("skip-native").equals("true") && !VISUAL_STUDIO_INSTALL_DIR.isEmpty()) { def proc = ["cmd.exe", "/c", "${VISUAL_STUDIO_VCVARS_CMD} > nul && where.exe cl.exe"].execute() def outp = proc.text - def cl = outp.replace("\\", "\\\\").trim() + def cl = "\"" + outp.replace("\\", "\\\\").trim() + "\"" def currentCompiler = "" doFirst{ currentCompiler = System.getProperty("org.bytedeco.javacpp.platform.compiler") System.setProperty("org.bytedeco.javacpp.platform.compiler", cl) + System.setProperty("platform.compiler.cpp11", cl) logger.quiet("Task ${thisTask.name} overrides compiler '${currentCompiler}' with '${cl}'.") } doLast { diff --git a/cavis-native/cavis-native-lib/src/main/cpp/blas/CMakeLists.txt b/cavis-native/cavis-native-lib/src/main/cpp/blas/CMakeLists.txt index a56ad2b77..9bbd09e20 100644 --- a/cavis-native/cavis-native-lib/src/main/cpp/blas/CMakeLists.txt +++ b/cavis-native/cavis-native-lib/src/main/cpp/blas/CMakeLists.txt @@ -102,16 +102,18 @@ ENDIF() IF(${SD_EXTENSION} MATCHES "avx2") message("Extension AVX2 enabled.") - set(ARCH_TUNE "${ARCH_TUNE} -mmmx -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -mf16c -mprefetchwt1 -DSD_F16C=true -DF_AVX2=true") + #-mmmx -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -mf16c -mprefetchwt1 + set(ARCH_TUNE "${ARCH_TUNE} -DSD_F16C=true -DF_AVX2=true") ELSEIF(${SD_EXTENSION} MATCHES "avx512") message("Extension AVX512 enabled.") # we need to set flag here, that we can use hardware f16 conversion + tell that cpu features should be tracked - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmmx -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -mf16c -mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd -mbmi -mbmi2 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves -DSD_F16C=true -DF_AVX512=true") + #-mmmx -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -mf16c -mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd -mbmi -mbmi2 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves + set(ARCH_TUNE "${ARCH_TUNE} -DSD_F16C=true -DF_AVX512=true") ENDIF() if (NOT WIN32) # we don't want this definition for msvc - set(ARCH_TUNE "-march=${SD_ARCH} -mtune=${ARCH_TYPE}") + set(ARCH_TUNE "${ARCH_TUNE} -march=${SD_ARCH} -mtune=${ARCH_TYPE}") endif() if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" AND SD_X86_BUILD)