Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix oneAPI find_package command to look at the MKLROOT env var #3392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 3, 2023
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
15 changes: 11 additions & 4 deletions 15 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ if(AF_WITH_EXTERNAL_PACKAGES_ONLY)
set(AF_REQUIRED REQUIRED)
endif()

#Set Intel OpenMP as default MKL thread layer
if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CXX_COMPILER_NAME STREQUAL "dpcpp" OR CXX_COMPILER_NAME STREQUAL "dpcpp.exe"
OR CXX_COMPILER_NAME STREQUAL "icpx" OR CXX_COMPILER_NAME STREQUAL "icx.exe")
set(MKL_THREAD_LAYER "TBB" CACHE STRING "The thread layer to choose for MKL")
set(MKL_INTERFACE "ilp64")
set(MKL_INTERFACE_INTEGER_SIZE 8)
Expand Down Expand Up @@ -125,7 +125,14 @@ elseif(MKL_THREAD_LAYER STREQUAL "TBB")
set(MKL_THREADING "tbb_thread")
else()
endif()
find_package(MKL)

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
# VCPKG overrides the find_package command and the PATH parameter is currently
# broken with the current version of VCPKG so we are setting the MKL_ROOT
# directory to the MKLROOT environment variable.
set(MKL_ROOT "$ENV{MKLROOT}")
find_package(MKL)
endif()

af_multiple_option(NAME AF_COMPUTE_LIBRARY
DEFAULT ${default_compute_library}
Expand Down Expand Up @@ -218,7 +225,7 @@ if(${AF_BUILD_CPU} OR ${AF_BUILD_OPENCL})
if("${AF_COMPUTE_LIBRARY}" STREQUAL "Intel-MKL"
OR "${AF_COMPUTE_LIBRARY}" STREQUAL "MKL")
af_mkl_batch_check()
dependency_check(MKL_FOUND "Please ensure Intel-MKL / oneAPI-oneMKL is installed")
dependency_check(MKL_Shared_FOUND "Please ensure Intel-MKL / oneAPI-oneMKL is installed")
set(BUILD_WITH_MKL ON)
elseif("${AF_COMPUTE_LIBRARY}" STREQUAL "FFTW/LAPACK/BLAS")
dependency_check(FFTW_FOUND "FFTW not found")
Expand Down
6 changes: 5 additions & 1 deletion 6 src/backend/opencl/Array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,15 @@ kJITHeuristics passesJitHeuristics(span<Node *> root_nodes) {
(3 * sizeof(uint));

const cl::Device &device = getDevice();
size_t max_param_size = device.getInfo<CL_DEVICE_MAX_PARAMETER_SIZE>();
// typical values:
// NVIDIA = 4096
// AMD = 3520 (AMD A10 iGPU = 1024)
// Intel iGPU = 1024
//
// Setting the maximum to 5120 bytes to keep the compile times
// resonable. This still results in large kernels but its not excessive.
size_t max_param_size =
min(5120UL, device.getInfo<CL_DEVICE_MAX_PARAMETER_SIZE>());
max_param_size -= base_param_size;

struct tree_info {
Expand Down
21 changes: 9 additions & 12 deletions 21 src/backend/opencl/compile_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ Module loadModuleFromDisk(const int device, const string &moduleKey,
try {
std::ifstream in(cacheFile, std::ios::binary);
if (!in.is_open()) {
AF_ERROR("Unable to open binary cache file", AF_ERR_INTERNAL);
AF_TRACE("{{{:<20} : Unable to open {} for {}}}", moduleKey,
cacheFile, dev.getInfo<CL_DEVICE_NAME>());
removeFile(cacheFile);
return retVal;
}
in.exceptions(std::ios::failbit | std::ios::badbit);

Expand All @@ -247,24 +250,18 @@ Module loadModuleFromDisk(const int device, const string &moduleKey,
const size_t recomputedHash =
deterministicHash(clbin.data(), clbinSize);
if (recomputedHash != clbinHash) {
AF_ERROR("Binary on disk seems to be corrupted", AF_ERR_LOAD_SYM);
AF_TRACE(
"{{{:<20} : Corrupt binary({}) found on disk for {}, removed}}",
moduleKey, cacheFile, dev.getInfo<CL_DEVICE_NAME>());
removeFile(cacheFile);
return retVal;
}
program = Program(arrayfire::opencl::getContext(), {dev}, {clbin});
program.build();

AF_TRACE("{{{:<20} : loaded from {} for {} }}", moduleKey, cacheFile,
dev.getInfo<CL_DEVICE_NAME>());
retVal.set(program);
} catch (const AfError &e) {
if (e.getError() == AF_ERR_LOAD_SYM) {
AF_TRACE(
"{{{:<20} : Corrupt binary({}) found on disk for {}, removed}}",
moduleKey, cacheFile, dev.getInfo<CL_DEVICE_NAME>());
} else {
AF_TRACE("{{{:<20} : Unable to open {} for {}}}", moduleKey,
cacheFile, dev.getInfo<CL_DEVICE_NAME>());
}
removeFile(cacheFile);
} catch (const std::ios_base::failure &e) {
AF_TRACE("{{{:<20} : IO failure while loading {} for {}; {}}}",
moduleKey, cacheFile, dev.getInfo<CL_DEVICE_NAME>(), e.what());
Expand Down
4 changes: 3 additions & 1 deletion 4 test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ function(af_add_test target backend is_serial)
if(${is_serial})
set_tests_properties(${target}
PROPERTIES
RUN_SERIAL ON)
ENVIRONMENT AF_PRINT_ERRORS=1
TIMEOUT 900
RUN_SERIAL ON)
endif(${is_serial})
endif()
endfunction()
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.