summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2016-01-30 11:54:29 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2016-01-30 11:54:29 +0100
commit44fb40e5c464a532d683352b73123c77d1a5a9f7 (patch)
tree532c762731ba4c01ea97a1559dac610caa2b7776
parentf573fe6bb3ac68dffbcca9da4c17c8bf0af178cf (diff)
Prepared for MSVC support
-rw-r--r--CMakeLists.txt22
-rw-r--r--README.md3
-rw-r--r--test/correctness/tester.cc50
-rw-r--r--test/performance/client.cc10
4 files changed, 46 insertions, 39 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 40119c4e..bc4a9ddd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,16 +55,20 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
endif()
# C++ compiler settings
-set(FLAGS "-O3 -std=c++11")
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
- set(FLAGS "${FLAGS} -Wall -Wno-comment -Wno-return-type -Wno-switch -Wno-missing-noreturn")
- if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0)
- set(FLAGS "${FLAGS} -Wno-attributes -Wno-unused-variable")
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+ set(FLAGS "/Ox")
+else ()
+ set(FLAGS "-O3 -std=c++11")
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ set(FLAGS "${FLAGS} -Wall -Wno-comment -Wno-return-type -Wno-switch -Wno-missing-noreturn")
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0)
+ set(FLAGS "${FLAGS} -Wno-attributes -Wno-unused-variable")
+ endif()
+ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ set(FLAGS "${FLAGS} -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded")
+ set(FLAGS "${FLAGS} -Wno-missing-prototypes -Wno-float-equal -Wno-switch-enum -Wno-switch")
+ set(FLAGS "${FLAGS} -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-noreturn")
endif()
-elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
- set(FLAGS "${FLAGS} -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded")
- set(FLAGS "${FLAGS} -Wno-missing-prototypes -Wno-float-equal -Wno-switch-enum -Wno-switch")
- set(FLAGS "${FLAGS} -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-noreturn")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
diff --git a/README.md b/README.md
index 8c7870a2..491ce489 100644
--- a/README.md
+++ b/README.md
@@ -41,10 +41,13 @@ The pre-requisites for compilation of CLBlast are:
- Clang 3.3 or newer
- AppleClang 5.0 or newer
- ICC 14.0 or newer
+ - MSVC (Visual Studio) 2015 or newer
* An OpenCL 1.1 or newer library, for example:
- Apple OpenCL
- NVIDIA CUDA SDK
- AMD APP SDK
+ - Intel OpenCL
+ - Beignet
An example of an out-of-source build (starting from the root of the CLBlast folder):
diff --git a/test/correctness/tester.cc b/test/correctness/tester.cc
index 350865f0..d9836500 100644
--- a/test/correctness/tester.cc
+++ b/test/correctness/tester.cc
@@ -80,11 +80,11 @@ template <typename T, typename U>
Tester<T,U>::~Tester() {
if (PrecisionSupported<T>(device_)) {
fprintf(stdout, "* Completed all test-cases for this routine. Results:\n");
- fprintf(stdout, " %lu test(s) passed\n", tests_passed_);
+ fprintf(stdout, " %zu test(s) passed\n", tests_passed_);
if (tests_skipped_ > 0) { fprintf(stdout, "%s", kPrintWarning.c_str()); }
- fprintf(stdout, " %lu test(s) skipped%s\n", tests_skipped_, kPrintEnd.c_str());
+ fprintf(stdout, " %zu test(s) skipped%s\n", tests_skipped_, kPrintEnd.c_str());
if (tests_failed_ > 0) { fprintf(stdout, "%s", kPrintError.c_str()); }
- fprintf(stdout, " %lu test(s) failed%s\n", tests_failed_, kPrintEnd.c_str());
+ fprintf(stdout, " %zu test(s) failed%s\n", tests_failed_, kPrintEnd.c_str());
}
fprintf(stdout, "\n");
clblasTeardown();
@@ -129,29 +129,29 @@ void Tester<T,U>::TestEnd() {
fprintf(stdout, " Status code %d (expected %d): ", entry.status_found, entry.status_expect);
}
for (auto &o: options_) {
- if (o == kArgM) { fprintf(stdout, "%s=%lu ", kArgM, entry.args.m); }
- if (o == kArgN) { fprintf(stdout, "%s=%lu ", kArgN, entry.args.n); }
- if (o == kArgK) { fprintf(stdout, "%s=%lu ", kArgK, entry.args.k); }
- if (o == kArgKU) { fprintf(stdout, "%s=%lu ", kArgKU, entry.args.ku); }
- if (o == kArgKL) { fprintf(stdout, "%s=%lu ", kArgKL, entry.args.kl); }
+ if (o == kArgM) { fprintf(stdout, "%s=%zu ", kArgM, entry.args.m); }
+ if (o == kArgN) { fprintf(stdout, "%s=%zu ", kArgN, entry.args.n); }
+ if (o == kArgK) { fprintf(stdout, "%s=%zu ", kArgK, entry.args.k); }
+ if (o == kArgKU) { fprintf(stdout, "%s=%zu ", kArgKU, entry.args.ku); }
+ if (o == kArgKL) { fprintf(stdout, "%s=%zu ", kArgKL, entry.args.kl); }
if (o == kArgLayout) { fprintf(stdout, "%s=%d ", kArgLayout, entry.args.layout);}
if (o == kArgATransp) { fprintf(stdout, "%s=%d ", kArgATransp, entry.args.a_transpose);}
if (o == kArgBTransp) { fprintf(stdout, "%s=%d ", kArgBTransp, entry.args.b_transpose);}
if (o == kArgSide) { fprintf(stdout, "%s=%d ", kArgSide, entry.args.side);}
if (o == kArgTriangle) { fprintf(stdout, "%s=%d ", kArgTriangle, entry.args.triangle);}
if (o == kArgDiagonal) { fprintf(stdout, "%s=%d ", kArgDiagonal, entry.args.diagonal);}
- if (o == kArgXInc) { fprintf(stdout, "%s=%lu ", kArgXInc, entry.args.x_inc);}
- if (o == kArgYInc) { fprintf(stdout, "%s=%lu ", kArgYInc, entry.args.y_inc);}
- if (o == kArgXOffset) { fprintf(stdout, "%s=%lu ", kArgXOffset, entry.args.x_offset);}
- if (o == kArgYOffset) { fprintf(stdout, "%s=%lu ", kArgYOffset, entry.args.y_offset);}
- if (o == kArgALeadDim) { fprintf(stdout, "%s=%lu ", kArgALeadDim, entry.args.a_ld);}
- if (o == kArgBLeadDim) { fprintf(stdout, "%s=%lu ", kArgBLeadDim, entry.args.b_ld);}
- if (o == kArgCLeadDim) { fprintf(stdout, "%s=%lu ", kArgCLeadDim, entry.args.c_ld);}
- if (o == kArgAOffset) { fprintf(stdout, "%s=%lu ", kArgAOffset, entry.args.a_offset);}
- if (o == kArgBOffset) { fprintf(stdout, "%s=%lu ", kArgBOffset, entry.args.b_offset);}
- if (o == kArgCOffset) { fprintf(stdout, "%s=%lu ", kArgCOffset, entry.args.c_offset);}
- if (o == kArgAPOffset) { fprintf(stdout, "%s=%lu ", kArgAPOffset, entry.args.ap_offset);}
- if (o == kArgDotOffset){ fprintf(stdout, "%s=%lu ", kArgDotOffset, entry.args.dot_offset);}
+ if (o == kArgXInc) { fprintf(stdout, "%s=%zu ", kArgXInc, entry.args.x_inc);}
+ if (o == kArgYInc) { fprintf(stdout, "%s=%zu ", kArgYInc, entry.args.y_inc);}
+ if (o == kArgXOffset) { fprintf(stdout, "%s=%zu ", kArgXOffset, entry.args.x_offset);}
+ if (o == kArgYOffset) { fprintf(stdout, "%s=%zu ", kArgYOffset, entry.args.y_offset);}
+ if (o == kArgALeadDim) { fprintf(stdout, "%s=%zu ", kArgALeadDim, entry.args.a_ld);}
+ if (o == kArgBLeadDim) { fprintf(stdout, "%s=%zu ", kArgBLeadDim, entry.args.b_ld);}
+ if (o == kArgCLeadDim) { fprintf(stdout, "%s=%zu ", kArgCLeadDim, entry.args.c_ld);}
+ if (o == kArgAOffset) { fprintf(stdout, "%s=%zu ", kArgAOffset, entry.args.a_offset);}
+ if (o == kArgBOffset) { fprintf(stdout, "%s=%zu ", kArgBOffset, entry.args.b_offset);}
+ if (o == kArgCOffset) { fprintf(stdout, "%s=%zu ", kArgCOffset, entry.args.c_offset);}
+ if (o == kArgAPOffset) { fprintf(stdout, "%s=%zu ", kArgAPOffset, entry.args.ap_offset);}
+ if (o == kArgDotOffset){ fprintf(stdout, "%s=%zu ", kArgDotOffset, entry.args.dot_offset);}
}
fprintf(stdout, "\n");
}
@@ -159,18 +159,18 @@ void Tester<T,U>::TestEnd() {
// Prints a test summary
auto pass_rate = 100*num_passed_ / static_cast<float>(num_passed_ + num_skipped_ + num_failed_);
fprintf(stdout, " Pass rate %s%5.1lf%%%s:", kPrintMessage.c_str(), pass_rate, kPrintEnd.c_str());
- fprintf(stdout, " %lu passed /", num_passed_);
+ fprintf(stdout, " %zu passed /", num_passed_);
if (num_skipped_ != 0) {
- fprintf(stdout, " %s%lu skipped%s /", kPrintWarning.c_str(), num_skipped_, kPrintEnd.c_str());
+ fprintf(stdout, " %s%zu skipped%s /", kPrintWarning.c_str(), num_skipped_, kPrintEnd.c_str());
}
else {
- fprintf(stdout, " %lu skipped /", num_skipped_);
+ fprintf(stdout, " %zu skipped /", num_skipped_);
}
if (num_failed_ != 0) {
- fprintf(stdout, " %s%lu failed%s\n", kPrintError.c_str(), num_failed_, kPrintEnd.c_str());
+ fprintf(stdout, " %s%zu failed%s\n", kPrintError.c_str(), num_failed_, kPrintEnd.c_str());
}
else {
- fprintf(stdout, " %lu failed\n", num_failed_);
+ fprintf(stdout, " %zu failed\n", num_failed_);
}
}
diff --git a/test/performance/client.cc b/test/performance/client.cc
index fb248854..a3b592cb 100644
--- a/test/performance/client.cc
+++ b/test/performance/client.cc
@@ -48,11 +48,11 @@ Arguments<U> Client<T,U>::ParseArguments(int argc, char *argv[], const GetMetric
for (auto &o: options_) {
// Data-sizes
- if (o == kArgM) { args.m = GetArgument(argc, argv, help, kArgM, 512UL); }
- if (o == kArgN) { args.n = GetArgument(argc, argv, help, kArgN, 512UL); }
- if (o == kArgK) { args.k = GetArgument(argc, argv, help, kArgK, 512UL); }
- if (o == kArgKU) { args.ku = GetArgument(argc, argv, help, kArgKU, 128UL); }
- if (o == kArgKL) { args.kl = GetArgument(argc, argv, help, kArgKL, 128UL); }
+ if (o == kArgM) { args.m = GetArgument(argc, argv, help, kArgM, size_t{512}); }
+ if (o == kArgN) { args.n = GetArgument(argc, argv, help, kArgN, size_t{512}); }
+ if (o == kArgK) { args.k = GetArgument(argc, argv, help, kArgK, size_t{512}); }
+ if (o == kArgKU) { args.ku = GetArgument(argc, argv, help, kArgKU, size_t{128}); }
+ if (o == kArgKL) { args.kl = GetArgument(argc, argv, help, kArgKL, size_t{128}); }
// Data-layouts
if (o == kArgLayout) { args.layout = GetArgument(argc, argv, help, kArgLayout, Layout::kRowMajor); }