summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-12-27 17:16:08 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-12-27 17:16:08 +0100
commit0eb9b35481531d5ddc7e22371a44a12dc0e69c50 (patch)
tree36401555f718ffa5dd0415b5b9959190cf06cbc9
parent2b9bf3a9aa7f2879911303d158c32842760989ba (diff)
Added a simple test to check compilation of the invert kernels (issue with AMD APP)
-rw-r--r--CMakeLists.txt2
-rw-r--r--test/correctness/misc/compile_invert.cpp65
2 files changed, 66 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53944b25..759f6d2e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -578,7 +578,7 @@ if(TESTS)
endforeach()
# Miscellaneous tests
- set(MISC_TESTS override_parameters)
+ set(MISC_TESTS override_parameters compile_invert)
if(NOT CUDA)
set(MISC_TESTS ${MISC_TESTS} preprocessor)
endif()
diff --git a/test/correctness/misc/compile_invert.cpp b/test/correctness/misc/compile_invert.cpp
new file mode 100644
index 00000000..4ce458d1
--- /dev/null
+++ b/test/correctness/misc/compile_invert.cpp
@@ -0,0 +1,65 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file contains a simple test to compile the invert kernel.
+//
+// =================================================================================================
+
+#include <string>
+#include <vector>
+#include <cstdio>
+
+#include "utilities/utilities.hpp"
+#include "routines/levelx/xinvert.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+template <typename T>
+size_t CompileInvertKernels(int argc, char *argv[], const bool silent) {
+
+ // Retrieves the arguments
+ auto help = std::string{"Options given/available:\n"};
+ auto arguments = RetrieveCommandLineArguments(argc, argv);
+ const auto platform_id = GetArgument(arguments, help, kArgPlatform, ConvertArgument(std::getenv("CLBLAST_PLATFORM"), size_t{0}));
+ const auto device_id = GetArgument(arguments, help, kArgDevice, ConvertArgument(std::getenv("CLBLAST_DEVICE"), size_t{0}));
+
+ // Prints the help message (command-line arguments)
+ if (!silent) { fprintf(stdout, "\n* %s\n", help.c_str()); }
+
+ // Initializes OpenCL
+ const auto platform = Platform(platform_id);
+ const auto device = Device(platform, device_id);
+ const auto context = Context(device);
+ auto queue = Queue(context, device);
+
+ // Compiles the invert kernels
+ auto diagonal_invert_event = Event();
+ auto inverter = Xinvert<T>(queue, diagonal_invert_event.pointer());
+
+ // Report and return
+ printf("\n");
+ printf(" 1 test(s) passed\n");
+ printf(" 0 test(s) failed\n");
+ printf("\n");
+ return 0;
+}
+
+// =================================================================================================
+} // namespace clblast
+
+// Main function (not within the clblast namespace)
+int main(int argc, char *argv[]) {
+ auto errors = size_t{0};
+ errors += clblast::CompileInvertKernels<float>(argc, argv, false);
+ errors += clblast::CompileInvertKernels<clblast::float2>(argc, argv, true);
+ if (errors > 0) { return 1; } else { return 0; }
+}
+
+// =================================================================================================