Allow docker container to use GPU

Signed-off-by: brian <brian@brutex.de>
master
Brian Rosenberger 2023-08-15 23:14:12 +02:00
parent 74ad5087c1
commit 1c1ec071ef
2 changed files with 7 additions and 4 deletions

View File

@ -336,11 +336,12 @@ chipList.each { thisChip ->
&& !project.getProperty("skip-native").equals("true") && !VISUAL_STUDIO_INSTALL_DIR.isEmpty()) { && !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 proc = ["cmd.exe", "/c", "${VISUAL_STUDIO_VCVARS_CMD} > nul && where.exe cl.exe"].execute()
def outp = proc.text def outp = proc.text
def cl = outp.replace("\\", "\\\\").trim() def cl = "\"" + outp.replace("\\", "\\\\").trim() + "\""
def currentCompiler = "" def currentCompiler = ""
doFirst{ doFirst{
currentCompiler = System.getProperty("org.bytedeco.javacpp.platform.compiler") currentCompiler = System.getProperty("org.bytedeco.javacpp.platform.compiler")
System.setProperty("org.bytedeco.javacpp.platform.compiler", cl) System.setProperty("org.bytedeco.javacpp.platform.compiler", cl)
System.setProperty("platform.compiler.cpp11", cl)
logger.quiet("Task ${thisTask.name} overrides compiler '${currentCompiler}' with '${cl}'.") logger.quiet("Task ${thisTask.name} overrides compiler '${currentCompiler}' with '${cl}'.")
} }
doLast { doLast {

View File

@ -102,16 +102,18 @@ ENDIF()
IF(${SD_EXTENSION} MATCHES "avx2") IF(${SD_EXTENSION} MATCHES "avx2")
message("Extension AVX2 enabled.") 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") ELSEIF(${SD_EXTENSION} MATCHES "avx512")
message("Extension AVX512 enabled.") message("Extension AVX512 enabled.")
# we need to set flag here, that we can use hardware f16 conversion + tell that cpu features should be tracked # 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() ENDIF()
if (NOT WIN32) if (NOT WIN32)
# we don't want this definition for msvc # 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() endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" AND SD_X86_BUILD) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" AND SD_X86_BUILD)