diff options
Diffstat (limited to 'parallel-libs/streamexecutor/examples')
-rw-r--r-- | parallel-libs/streamexecutor/examples/CMakeLists.txt | 4 | ||||
-rw-r--r-- | parallel-libs/streamexecutor/examples/CUDASaxpy.cpp (renamed from parallel-libs/streamexecutor/examples/Example.cpp) | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/parallel-libs/streamexecutor/examples/CMakeLists.txt b/parallel-libs/streamexecutor/examples/CMakeLists.txt index a5220526a2d..1d09a545429 100644 --- a/parallel-libs/streamexecutor/examples/CMakeLists.txt +++ b/parallel-libs/streamexecutor/examples/CMakeLists.txt @@ -1,2 +1,2 @@ -add_executable(example Example.cpp) -target_link_libraries(example streamexecutor) +add_executable(cuda_saxpy_example CUDASaxpy.cpp) +target_link_libraries(cuda_saxpy_example streamexecutor) diff --git a/parallel-libs/streamexecutor/examples/Example.cpp b/parallel-libs/streamexecutor/examples/CUDASaxpy.cpp index a96648abac6..eab0cbe69d6 100644 --- a/parallel-libs/streamexecutor/examples/Example.cpp +++ b/parallel-libs/streamexecutor/examples/CUDASaxpy.cpp @@ -1,4 +1,4 @@ -//===-- Example.cpp - Example code for documentation ----------------------===// +//===-- CUDASaxpy.cpp - Example of CUDA saxpy with StreamExecutor API -----===// // // The LLVM Compiler Infrastructure // @@ -15,6 +15,7 @@ /// //===----------------------------------------------------------------------===// +#include <algorithm> #include <cassert> #include <cstdio> #include <cstdlib> @@ -51,6 +52,7 @@ static streamexecutor::MultiKernelLoaderSpec SaxpyLoaderSpec = []() { /// [Example saxpy compiler-generated] /// [Example saxpy host PTX] +// The PTX text for a saxpy kernel. const char *__compilergen::SaxpyPTX = R"( .version 4.3 .target sm_20 @@ -130,8 +132,6 @@ int main() { // Process output data in HostX. std::vector<float> ExpectedX = {4, 47, 90, 133}; - for (size_t I = 0; I < ArraySize; ++I) { - assert(HostX[I] == ExpectedX[I]); - } + assert(std::equal(ExpectedX.begin(), ExpectedX.end(), HostX.begin())); /// [Example saxpy host main] } |