early-access version 2853

This commit is contained in:
pineappleEA
2022-07-23 03:01:36 +02:00
parent 1f2b5081b5
commit 1f111bb69c
8955 changed files with 418777 additions and 999 deletions

View File

@@ -0,0 +1,22 @@
diff --git a/src/backend/common/half.hpp b/src/backend/common/half.hpp
index ce06eed..fb25d03 100644
--- a/src/backend/common/half.hpp
+++ b/src/backend/common/half.hpp
@@ -879,15 +879,9 @@ class alignas(2) half {
return *this;
}
-#if defined(NVCC) || defined(__CUDACC_RTC__)
- AF_CONSTEXPR __DH__ explicit half(__half value) noexcept
#ifdef __CUDA_ARCH__
- : data_(value) {
- }
-#else
- : data_(*reinterpret_cast<native_half_t*>(&value)) {
- }
-#endif
+ AF_CONSTEXPR __DH__ explicit half(__half value) noexcept : data_(value) {}
+
AF_CONSTEXPR __DH__ half& operator=(__half value) noexcept {
// NOTE Assignment to ushort from __half only works with device code.
// using memcpy instead

220
externals/vcpkg/ports/arrayfire/build.patch vendored Executable file
View File

@@ -0,0 +1,220 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 682f416..a8cbec8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,8 +104,6 @@ mark_as_advanced(
CUDA_HOST_COMPILER
CUDA_USE_STATIC_CUDA_RUNTIME
CUDA_rt_LIBRARY
- SPDLOG_BUILD_EXAMPLES
- SPDLOG_BUILD_TESTING
ADDR2LINE_PROGRAM
Backtrace_LIBRARY
AF_WITH_STATIC_MKL
@@ -159,9 +157,7 @@ if(NOT LAPACK_FOUND)
endif()
endif()
-set(SPDLOG_BUILD_TESTING OFF CACHE INTERNAL "Disable testing in spdlog")
-add_subdirectory(extern/spdlog EXCLUDE_FROM_ALL)
-add_subdirectory(extern/glad)
+find_package(spdlog CONFIG REQUIRED)
add_subdirectory(src/backend/common)
add_subdirectory(src/api/c)
add_subdirectory(src/api/cpp)
@@ -269,10 +265,6 @@ install(DIRECTORY examples/ #NOTE The slash at the end is important
DESTINATION ${AF_INSTALL_EXAMPLE_DIR}
COMPONENT examples)
-install(DIRECTORY assets/examples/ #NOTE The slash at the end is important
- DESTINATION ${AF_INSTALL_EXAMPLE_DIR}
- COMPONENT examples)
-
install(DIRECTORY "${ArrayFire_SOURCE_DIR}/LICENSES/"
DESTINATION LICENSES
COMPONENT licenses)
diff --git a/CMakeModules/AFInstallDirs.cmake b/CMakeModules/AFInstallDirs.cmake
index 2c7b96e..b5006ee 100644
--- a/CMakeModules/AFInstallDirs.cmake
+++ b/CMakeModules/AFInstallDirs.cmake
@@ -7,8 +7,12 @@ include(GNUInstallDirs)
# NOTE: These paths are all relative to the project installation prefix.
# Executables
-if(NOT DEFINED AF_INSTALL_BIN_DIR)
- set(AF_INSTALL_BIN_DIR "lib" CACHE PATH "Installation path for executables")
+if(CMAKE_BUILD_TYPE MATCHES Debug)
+ set(AF_INSTALL_BIN_DIR "${AF_BIN_DIR}/debug/bin")
+ message(STATUS " Setting install to debug path ${AF_INSTALL_BIN_DIR}")
+else()
+ set(AF_INSTALL_BIN_DIR "${AF_BIN_DIR}/bin")
+ message(STATUS " Setting install to release path ${AF_INSTALL_BIN_DIR}")
endif()
# Libraries
diff --git a/CMakeModules/AFconfigure_forge_submodule.cmake b/CMakeModules/AFconfigure_forge_submodule.cmake
index d16849f..36ab01b 100644
--- a/CMakeModules/AFconfigure_forge_submodule.cmake
+++ b/CMakeModules/AFconfigure_forge_submodule.cmake
@@ -39,13 +39,13 @@ if(AF_BUILD_FORGE)
COMPONENT common_backend_dependencies)
set_property(TARGET forge APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
else(AF_BUILD_FORGE)
- set(FG_VERSION "1.0.0")
+ set(FG_VERSION "1.0.5")
set(FG_VERSION_MAJOR 1)
set(FG_VERSION_MINOR 0)
- set(FG_VERSION_PATCH 0)
+ set(FG_VERSION_PATCH 5)
set(FG_API_VERSION_CURRENT 10)
configure_file(
- ${PROJECT_SOURCE_DIR}/extern/forge/CMakeModules/version.h.in
- ${PROJECT_BINARY_DIR}/extern/forge/include/fg/version.h
+ ${AF_FORGE_PATH}/CMakeModules/version.h.in
+ ${AF_FORGE_PATH}/include/fg/version.h
)
endif(AF_BUILD_FORGE)
diff --git a/src/api/unified/CMakeLists.txt b/src/api/unified/CMakeLists.txt
index 967eaa6..16bb633 100644
--- a/src/api/unified/CMakeLists.txt
+++ b/src/api/unified/CMakeLists.txt
@@ -96,7 +96,8 @@ target_include_directories(af
target_link_libraries(af
PRIVATE
cpp_api_interface
- spdlog
+ spdlog::spdlog
+ spdlog::spdlog_header_only
Threads::Threads
Boost::boost
${CMAKE_DL_LIBS}
diff --git a/src/backend/common/CMakeLists.txt b/src/backend/common/CMakeLists.txt
index c9fe088..8c128fa 100644
--- a/src/backend/common/CMakeLists.txt
+++ b/src/backend/common/CMakeLists.txt
@@ -77,12 +77,15 @@ else()
target_sources(afcommon_interface INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/module_loading_unix.cpp)
endif()
+find_package(glad CONFIG REQUIRED)
+
target_link_libraries(afcommon_interface
INTERFACE
- spdlog
+ spdlog::spdlog
+ spdlog::spdlog_header_only
Boost::boost
- af_glad_interface
${CMAKE_DL_LIBS}
+ glad::glad
)
if(AF_BUILD_FORGE)
@@ -93,10 +96,9 @@ target_include_directories(afcommon_interface
INTERFACE
${ArrayFire_SOURCE_DIR}/src/backend
${ArrayFire_BINARY_DIR}
+ ${AF_FORGE_PATH}/include # passed via vcpkg
SYSTEM INTERFACE
$<$<PLATFORM_ID:Darwin>:${OPENGL_INCLUDE_DIR}>
- ${ArrayFire_SOURCE_DIR}/extern/forge/include
- ${ArrayFire_BINARY_DIR}/extern/forge/include
)
if(APPLE AND NOT USE_MKL)
diff --git a/src/backend/cpu/CMakeLists.txt b/src/backend/cpu/CMakeLists.txt
index 170bb0f..c6e2017 100644
--- a/src/backend/cpu/CMakeLists.txt
+++ b/src/backend/cpu/CMakeLists.txt
@@ -266,9 +266,10 @@ endif(AF_WITH_CPUID)
target_sources(afcpu
PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}/threads/async_queue.hpp
- ${CMAKE_CURRENT_SOURCE_DIR}/threads/event.hpp
+ ${AF_CPU_THREAD_PATH}/include/threads/async_queue.hpp
+ ${AF_CPU_THREAD_PATH}/include/threads/event.hpp
)
+target_include_directories(afcpu PRIVATE ${AF_CPU_THREAD_PATH}/include)
arrayfire_set_default_cxx_flags(afcpu)
diff --git a/src/backend/cuda/CMakeLists.txt b/src/backend/cuda/CMakeLists.txt
index 7e3e408..2edaacd 100644
--- a/src/backend/cuda/CMakeLists.txt
+++ b/src/backend/cuda/CMakeLists.txt
@@ -110,7 +110,11 @@ cuda_include_directories(
${COMMON_INTERFACE_DIRS}
)
if(CUDA_VERSION_MAJOR VERSION_LESS 11)
- cuda_include_directories(${ArrayFire_SOURCE_DIR}/extern/cub)
+ find_path(CUB_INCLUDE_DIRS "cub/agent/agent_histogram.cuh")
+ if (${CUB_INCLUDE_DIRS} EQUAL "CUB_INCLUDE_DIRS-NOTFOUND")
+ set(CUB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/cub)
+ endif()
+ cuda_include_directories(${CUB_INCLUDE_DIRS})
endif()
file(GLOB jit_src "kernel/jit.cuh")
@@ -242,7 +246,7 @@ endif()
if(CUDA_VERSION_MAJOR VERSION_GREATER 10 OR
(UNIX AND
- CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 0))
+ CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 1))
list(APPEND cxx_definitions -DAF_USE_NEW_CUSPARSE_API)
endif()
@@ -301,7 +305,7 @@ set_target_properties(af_cuda_static_cuda_library
if(CUDA_VERSION_MAJOR VERSION_GREATER 10 OR
(UNIX AND
- CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 0))
+ CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 1))
target_compile_definitions(af_cuda_static_cuda_library PRIVATE AF_USE_NEW_CUSPARSE_API)
endif()
diff --git a/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt b/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt
index 9a796c9..d9864b0 100644
--- a/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt
+++ b/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt
@@ -27,6 +27,7 @@ foreach(SBK_BINARY_OP ${SBK_BINARY_OPS})
add_dependencies(opencl_scan_by_key_${SBK_BINARY_OP}
${cl_kernel_targets} OpenCL::cl2hpp Boost::boost)
+ find_package(glad CONFIG REQUIRED)
target_include_directories(opencl_scan_by_key_${SBK_BINARY_OP}
PRIVATE
.
@@ -39,9 +40,7 @@ foreach(SBK_BINARY_OP ${SBK_BINARY_OPS})
$<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:OpenCL::cl2hpp,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:Boost::boost,INTERFACE_INCLUDE_DIRECTORIES>
- $<TARGET_PROPERTY:af_glad_interface,INTERFACE_INCLUDE_DIRECTORIES>
- ${ArrayFire_SOURCE_DIR}/extern/forge/include
- ${ArrayFire_BINARY_DIR}/extern/forge/include
+ $<TARGET_PROPERTY:glad::glad,INTERFACE_INCLUDE_DIRECTORIES>
)
set_target_properties(opencl_scan_by_key_${SBK_BINARY_OP}
diff --git a/src/backend/opencl/kernel/sort_by_key/CMakeLists.txt b/src/backend/opencl/kernel/sort_by_key/CMakeLists.txt
index d618ff2..9f51739 100644
--- a/src/backend/opencl/kernel/sort_by_key/CMakeLists.txt
+++ b/src/backend/opencl/kernel/sort_by_key/CMakeLists.txt
@@ -32,14 +32,13 @@ foreach(SBK_TYPE ${SBK_TYPES})
../../../include
${CMAKE_CURRENT_BINARY_DIR})
+ find_package(glad CONFIG REQUIRED)
target_include_directories(opencl_sort_by_key_${SBK_TYPE}
SYSTEM PRIVATE
$<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:OpenCL::cl2hpp,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:Boost::boost,INTERFACE_INCLUDE_DIRECTORIES>
- $<TARGET_PROPERTY:af_glad_interface,INTERFACE_INCLUDE_DIRECTORIES>
- ${ArrayFire_SOURCE_DIR}/extern/forge/include
- ${ArrayFire_BINARY_DIR}/extern/forge/include
+ $<TARGET_PROPERTY:glad::glad,INTERFACE_INCLUDE_DIRECTORIES>
)
set_target_properties(opencl_sort_by_key_${SBK_TYPE}

View File

@@ -0,0 +1,88 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO arrayfire/arrayfire
REF d99887ae431fcd58168b653a1e69f027f04d5188 # v3.8.0
SHA512 d8ddf6ba254744e62acf5ecf680f0ae56b05f8957b5463572923977ba2ffea7fa37cc1b6179421a1188a6f9e66565ca0f8cd00807513ccbe66ba1e9bbd41a3da
HEAD_REF master
PATCHES
build.patch
Fix-constexpr-error-with-vs2019-with-half.patch
)
# arrayfire cpu thread lib needed as a submodule for the CPU backend
vcpkg_from_github(
OUT_SOURCE_PATH CPU_THREADS_PATH
REPO arrayfire/threads
REF b666773940269179f19ef11c8f1eb77005e85d9a
SHA512 b3e8b54acf3a588b1f821c2774d5da2d8f8441962c6d99808d513f7117278b9066eb050b8b501bddbd3882e68eb5cc5da0b2fca54e15ab1923fe068a3fe834f5
HEAD_REF master
)
# Get forge. We only need headers and aren't actually linking.
# We don't want to use the vcpkg dependency since it is broken in many
# environments - see https://github.com/microsoft/vcpkg/issues/14864. This
# can be relaxed when the issue is fixed. Forge and its dependencies
# are still runtime dependencies, so the user can use the graphics
# library by installing forge and freeimage.
vcpkg_from_github(
OUT_SOURCE_PATH FORGE_PATH
REPO arrayfire/forge
REF 1a0f0cb6371a8c8053ab5eb7cbe3039c95132389 # v1.0.5
SHA512 8f8607421880a0f0013380eb5efb3a4f05331cd415d68c9cd84dd57eb727da1df6223fc6d65b106675d6aa09c3388359fab64443c31fadadf7641161be6b3b89
HEAD_REF master
)
################################### Build ###################################
# Default flags
set(AF_DEFAULT_VCPKG_CMAKE_FLAGS
-DBUILD_TESTING=OFF
-DAF_BUILD_DOCS=OFF
-DAF_BUILD_EXAMPLES=OFF
-DUSE_CPU_MKL=ON
-DUSE_OPENCL_MKL=ON
-DAF_CPU_THREAD_PATH=${CPU_THREADS_PATH} # for building the arrayfire cpu threads lib
-DAF_FORGE_PATH=${FORGE_PATH} # forge headers for building the graphics lib
-DAF_BUILD_FORGE=OFF
-DAF_INSTALL_CMAKE_DIR=${CURRENT_PACKAGES_DIR}/share/${PORT} # for CMake configs/targets
)
# bin/dll directory for Windows non-static builds for the unified backend dll
if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(AF_BIN_DIR ${CURRENT_PACKAGES_DIR})
list(APPEND AF_DEFAULT_VCPKG_CMAKE_FLAGS "-DAF_BIN_DIR=${AF_BIN_DIR}")
endif()
if (VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
message(WARNING "NOTE: Windows support with static linkeage is still experimental.")
endif()
# Determine which backend to build via specified feature
vcpkg_check_features(
OUT_FEATURE_OPTIONS AF_BACKEND_FEATURE_OPTIONS
FEATURES
unified AF_BUILD_UNIFIED
cpu AF_BUILD_CPU
cuda AF_BUILD_CUDA
opencl AF_BUILD_OPENCL
)
# Build and install
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${AF_DEFAULT_VCPKG_CMAKE_FLAGS}
${AF_BACKEND_FEATURE_OPTIONS}
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/examples")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/LICENSES")
# Copyright and license
file(INSTALL "${SOURCE_PATH}/COPYRIGHT.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

52
externals/vcpkg/ports/arrayfire/vcpkg.json vendored Executable file
View File

@@ -0,0 +1,52 @@
{
"name": "arrayfire",
"version-semver": "3.8.0",
"description": "ArrayFire is a general-purpose library that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices.",
"supports": "x64",
"dependencies": [
"boost-compute",
"boost-stacktrace",
"glad",
"spdlog",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"cpu",
"unified"
],
"features": {
"cpu": {
"description": "ArrayFire CPU backend",
"dependencies": [
"intel-mkl"
]
},
"cuda": {
"description": "ArrayFire CUDA backend. This feature only supports dynamic because dependency cudnn is dynamic only.",
"dependencies": [
"cub",
"cuda",
"cudnn"
]
},
"opencl": {
"description": "ArrayFire OpenCL backend",
"dependencies": [
"opencl"
]
},
"unified": {
"description": "ArrayFire unified backend",
"dependencies": [
"intel-mkl"
]
}
}
}