From 0eb9b35481531d5ddc7e22371a44a12dc0e69c50 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Wed, 27 Dec 2017 17:16:08 +0100 Subject: Added a simple test to check compilation of the invert kernels (issue with AMD APP) --- CMakeLists.txt | 2 +- test/correctness/misc/compile_invert.cpp | 65 ++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 test/correctness/misc/compile_invert.cpp 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 +// +// This file contains a simple test to compile the invert kernel. +// +// ================================================================================================= + +#include +#include +#include + +#include "utilities/utilities.hpp" +#include "routines/levelx/xinvert.hpp" + +namespace clblast { +// ================================================================================================= + +template +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(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(argc, argv, false); + errors += clblast::CompileInvertKernels(argc, argv, true); + if (errors > 0) { return 1; } else { return 0; } +} + +// ================================================================================================= -- cgit v1.2.3