Skip to content

Commit 722f6c5

Browse files
authored
[LAPACK] unit tests update (#190)
* Logging refactor * Accuracy tests corrected and moved to common header * Dependency variable scope fixed * Backward compatibility for netlib libraries with weirdNEC macro
1 parent 28c6dee commit 722f6c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+449
-410
lines changed

cmake/FindLAPACKE.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
include_guard()
2121

2222
find_library(LAPACKE64_file NAMES lapacke64.dll.lib lapacke64.lib lapacke64 HINTS ${REF_LAPACK_ROOT} PATH_SUFFIXES lib lib64)
23-
find_package_handle_standard_args(LAPACKE64 REQUIRED_VARS LAPACKE64_file)
23+
find_package_handle_standard_args(LAPACKE REQUIRED_VARS LAPACKE64_file)
2424
find_library(LAPACK64_file NAMES lapack64.dll.lib lapack64.lib lapack64 HINTS ${REF_LAPACK_ROOT} PATH_SUFFIXES lib lib64)
25-
find_package_handle_standard_args(LAPACK64 REQUIRED_VARS LAPACK64_file)
25+
find_package_handle_standard_args(LAPACKE REQUIRED_VARS LAPACK64_file)
2626
find_library(CBLAS64_file NAMES cblas64.dll.lib cblas64.lib cblas64 HINTS ${REF_LAPACK_ROOT} PATH_SUFFIXES lib lib64)
27-
find_package_handle_standard_args(CBLAS64 REQUIRED_VARS CBLAS64_file)
27+
find_package_handle_standard_args(LAPACKE REQUIRED_VARS CBLAS64_file)
2828
find_library(BLAS64_file NAMES blas64.dll.lib blas64.lib blas64 HINTS ${REF_LAPACK_ROOT} PATH_SUFFIXES lib lib64)
29-
find_package_handle_standard_args(BLAS64 REQUIRED_VARS BLAS64_file)
29+
find_package_handle_standard_args(LAPACKE REQUIRED_VARS BLAS64_file)
3030

3131
get_filename_component(LAPACKE64_LIB_DIR ${LAPACKE64_file} DIRECTORY)
3232
find_path(LAPACKE_INCLUDE lapacke.h HINTS ${REF_LAPACK_ROOT} PATH_SUFFIXES include)
@@ -40,4 +40,4 @@ list(APPEND LAPACKE_LINK ${CBLAS64_file})
4040
list(APPEND LAPACKE_LINK ${BLAS64_file})
4141

4242
include(FindPackageHandleStandardArgs)
43-
find_package_handle_standard_args(LAPACKE64 REQUIRED_VARS LAPACKE_INCLUDE LAPACKE_LINK)
43+
find_package_handle_standard_args(LAPACKE REQUIRED_VARS LAPACKE_INCLUDE LAPACKE_LINK)

src/lapack/backends/cusolver/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ set(LIB_NAME onemkl_lapack_cusolver)
2121
set(LIB_OBJ ${LIB_NAME}_obj)
2222
find_package(cuSOLVER REQUIRED)
2323
set(SOURCES cusolver_lapack.cpp
24-
cusolver_batch.cpp
25-
$<$<STREQUAL:${ONEMKL_SYCL_IMPLEMENTATION},dpc++>:cusolver_scope_handle.cpp >
24+
cusolver_batch.cpp
25+
$<$<STREQUAL:${ONEMKL_SYCL_IMPLEMENTATION},dpc++>:cusolver_scope_handle.cpp >
2626
$<$<BOOL:${BUILD_SHARED_LIBS}>: cusolver_wrappers.cpp>)
2727
add_library(${LIB_NAME})
2828
add_library(${LIB_OBJ} OBJECT ${SOURCES})

tests/unit_tests/lapack/common/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#===============================================================================
1919

2020
# Build object from all test sources
21-
set(LAPACK_COMMON_SOURCES "dependency_check.cpp" "global.cpp")
21+
set(LAPACK_COMMON_SOURCES "dependency_check.cpp" "test_log.cpp")
2222

2323
if(BUILD_SHARED_LIBS)
2424
target_sources(lapack_source_rt PRIVATE ${LAPACK_COMMON_SOURCES})

tests/unit_tests/lapack/common/dependency_check.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ sycl::event create_dependency(sycl::queue queue) {
3737
return host_to_device_copy(queue, ::host_data.data(), ::device_data, ::host_data.size());
3838
}
3939

40-
void print_status(const char* name, sycl::info::event_command_status status) {
41-
global::log << name << " command execution status: ";
40+
void log_status(const char* name, sycl::info::event_command_status status) {
41+
test_log::lout << name << " command execution status: ";
4242
if (sycl::info::event_command_status::submitted == status)
43-
global::log << "submitted";
43+
test_log::lout << "submitted";
4444
else if (sycl::info::event_command_status::running == status)
45-
global::log << "running";
45+
test_log::lout << "running";
4646
else if (sycl::info::event_command_status::complete == status)
47-
global::log << "complete";
47+
test_log::lout << "complete";
4848
else
49-
global::log << "status unknown";
50-
global::log << " (" << static_cast<int64_t>(status) << ")" << std::endl;
49+
test_log::lout << "status unknown";
50+
test_log::lout << " (" << static_cast<int64_t>(status) << ")" << std::endl;
5151
}
5252

5353
bool check_dependency(sycl::queue queue, sycl::event in_event, sycl::event func_event) {
@@ -63,8 +63,8 @@ bool check_dependency(sycl::queue queue, sycl::event in_event, sycl::event func_
6363
/* Print results */
6464
auto result = (in_status == sycl::info::event_command_status::complete);
6565
if (!result) {
66-
print_status("in_event", in_status);
67-
print_status("func_event", func_status);
66+
log_status("in_event", in_status);
67+
log_status("func_event", func_status);
6868
}
6969

7070
device_free(queue, ::device_data);

tests/unit_tests/lapack/common/global.cpp

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*******************************************************************************
2+
* Copyright 2021 Intel Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions
14+
* and limitations under the License.
15+
*
16+
*
17+
* SPDX-License-Identifier: Apache-2.0
18+
*******************************************************************************/
19+
20+
#include <array>
21+
#include <iostream>
22+
#include <sstream>
23+
24+
namespace test_log {
25+
26+
std::stringstream lout{};
27+
std::array<char, 1024> buffer{};
28+
std::string padding{};
29+
30+
void print() {
31+
std::cout.clear();
32+
if (lout.rdbuf()->in_avail()) { /* check if stream is non-empty */
33+
while (lout.good()) {
34+
std::string line;
35+
std::getline(lout, line);
36+
std::cout << padding << "\t" << line << std::endl;
37+
}
38+
}
39+
lout.str("");
40+
lout.clear();
41+
}
42+
43+
} // namespace test_log

0 commit comments

Comments
 (0)