[CCCL] 瘦身 + 补全: 移除 cudax/python/libcudacxx-tests 冗余文件, 新增 c2h 测试助手 + cmake 构建系统 + 8 个 CUDA thrust examples
变更摘要:
- 删除: cudax/ (783 files, 7.2M) — 实验性组件,竞赛不需要
- 删除: python/ (226 files, 2.0M) — Python 绑定,竞赛不需要
- 删除: libcudacxx/{test,benchmarks,codegen,cmake,share} (4432 files, 31M)
保留: libcudacxx/include/ (1463 headers, cuda::std 编译依赖)
- 新增: c2h/ (27 files) — CUB Catch2 测试辅助头文件,编译 243 个测试必需
- 新增: cmake/ (29 files) — CCCL 原生 CMake 构建系统
- 新增: thrust/examples/cuda/ (7 files) + cpp_integration/ (1 file)
async_reduce, custom_temporary_allocation, explicit_cuda_stream,
global_device_vector, range_view, unwrap_pointer, wrap_pointer, device
结果: cccl_upstream 从 74M→35M (瘦身 53%), 核心内容 100% 保留:
27/27 tuning headers, 78 benchmarks, 243 tests,
60 thrust examples, 18 CUB examples, 全部编译头文件
This commit is contained in:
@@ -1,91 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ensure an error is detected when a task uses a logical data from a
|
||||
* different context
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/stf.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Ctx, size_t n>
|
||||
void run(double (&X)[n])
|
||||
{
|
||||
Ctx ctx1;
|
||||
auto lX = ctx1.logical_data(X);
|
||||
|
||||
// We are now using lX in the wrong context
|
||||
should_abort = true;
|
||||
|
||||
Ctx ctx2;
|
||||
ctx2.task(lX.rw())->*[&](cudaStream_t /*unused*/, auto /*unused*/) {};
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
const int n = 12;
|
||||
double X[n];
|
||||
|
||||
for (int ind = 0; ind < n; ind++)
|
||||
{
|
||||
X[ind] = 1.0 * ind;
|
||||
}
|
||||
|
||||
// We can't run both stream and graph tests because either will abort the program. So choose one at random.
|
||||
srand(static_cast<unsigned>(time(nullptr)));
|
||||
if (rand() % 2 == 0)
|
||||
{
|
||||
run<stream_ctx>(X);
|
||||
}
|
||||
else
|
||||
{
|
||||
run<graph_ctx>(X);
|
||||
}
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ensure an error is detected dynamically if we access a data instance
|
||||
* with the wrong interface type
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/__stf/graph/graph_ctx.cuh>
|
||||
#include <cuda/experimental/__stf/stream/stream_ctx.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Ctx, size_t n>
|
||||
void run(double (&X)[n])
|
||||
{
|
||||
Ctx ctx;
|
||||
// This creates an untyped logical data that is implicitly a vector of size
|
||||
// n. Had the code used `auto` instead of `logical_data_untyped`, errors
|
||||
// would have been rejected statically. We want to disable static checking
|
||||
// for the purposes of this test.
|
||||
logical_data_untyped handle_X = ctx.logical_data(X);
|
||||
|
||||
// Here we create a dynamically-typed task, again to go around static typechecking.
|
||||
auto t = ctx.task();
|
||||
t.add_deps(handle_X.rw());
|
||||
|
||||
t->*[&](auto&) {
|
||||
should_abort = true;
|
||||
// We have a programming error here with a vector of `double` accessad as a vector of `float`.
|
||||
handle_X.instance<slice<float>>(t);
|
||||
should_abort = false;
|
||||
};
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
const int n = 12;
|
||||
double X[n];
|
||||
|
||||
for (int ind = 0; ind < n; ind++)
|
||||
{
|
||||
X[ind] = 1.0 * ind;
|
||||
}
|
||||
|
||||
// We can't run both stream and graph tests because either will abort the program. So choose one at random.
|
||||
srand(static_cast<unsigned>(time(nullptr)));
|
||||
if (rand() % 2 == 0)
|
||||
{
|
||||
run<stream_ctx>(X);
|
||||
}
|
||||
else
|
||||
{
|
||||
run<graph_ctx>(X);
|
||||
}
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ensure an error is detected if we can finalize more than once
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/stf.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// This test only works when assert() is enabled in
|
||||
#ifndef NDEBUG
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
# if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
# else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
# endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
context ctx;
|
||||
|
||||
const int n = 12;
|
||||
double X[n];
|
||||
|
||||
for (int ind = 0; ind < n; ind++)
|
||||
{
|
||||
X[ind] = 1.0 * ind;
|
||||
}
|
||||
|
||||
// This creates a handle that is implicitly a vector of size n
|
||||
auto lX = ctx.logical_data(X);
|
||||
|
||||
ctx.task(lX.rw())->*[](cudaStream_t, auto) { /* no-op */ };
|
||||
|
||||
ctx.finalize();
|
||||
|
||||
should_abort = true;
|
||||
// We cannot call sync twice
|
||||
ctx.finalize();
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
#endif
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Ensure temporary data are destroyed
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/__stf/graph/graph_ctx.cuh>
|
||||
#include <cuda/experimental/__stf/stream/stream_ctx.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stream_ctx ctx;
|
||||
const int N = 16;
|
||||
int X[N];
|
||||
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
X[i] = i;
|
||||
}
|
||||
|
||||
auto lX = ctx.logical_data(X);
|
||||
|
||||
lX.freeze(access_mode::rw, data_place::current_device());
|
||||
|
||||
// This should cause an error because lX is frozen while the context is finalized
|
||||
should_abort = true;
|
||||
|
||||
ctx.finalize();
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ensure that an error is detected if we end a task twice
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/__stf/stream/stream_ctx.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// This test only works when assert() is enabled in
|
||||
#ifndef NDEBUG
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
# if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
# else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
# endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stream_ctx ctx;
|
||||
|
||||
const int n = 12;
|
||||
double X[n];
|
||||
|
||||
for (int ind = 0; ind < n; ind++)
|
||||
{
|
||||
X[ind] = 1.0 * ind;
|
||||
}
|
||||
|
||||
// This creates a handle that is implicitly a vector of size n
|
||||
auto lX = ctx.logical_data(X);
|
||||
|
||||
auto t = ctx.task(lX.rw());
|
||||
t.start();
|
||||
t.end();
|
||||
should_abort = true;
|
||||
t.end();
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
#endif
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ensure that an error is detected if we start a task twice
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/__stf/stream/stream_ctx.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stream_ctx ctx;
|
||||
|
||||
const int n = 12;
|
||||
double X[n];
|
||||
|
||||
for (int ind = 0; ind < n; ind++)
|
||||
{
|
||||
X[ind] = 1.0 * ind;
|
||||
}
|
||||
|
||||
// This creates a handle that is implicitly a vector of size n
|
||||
auto lX = ctx.logical_data(X);
|
||||
|
||||
auto t = ctx.task(lX.rw());
|
||||
t.start();
|
||||
should_abort = true;
|
||||
t.start();
|
||||
t.end();
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ensure an error is detected when trying to declare a logical data
|
||||
* with a managed memory data place while the data is not in managed
|
||||
* memory
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/__stf/graph/graph_ctx.cuh>
|
||||
#include <cuda/experimental/__stf/stream/stream_ctx.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#ifndef NDEBUG
|
||||
# if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
# else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
# endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stream_ctx ctx;
|
||||
|
||||
logical_data<slice<int>> lX;
|
||||
|
||||
should_abort = true;
|
||||
|
||||
int X[128];
|
||||
lX = ctx.logical_data(X, data_place::managed());
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
#endif
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ensure that out of bound accesses on slices are detected with the
|
||||
* CUDASTF_BOUNDSCHECK option set
|
||||
*/
|
||||
|
||||
/*
|
||||
* We are forcing this option by defining this value to be set.
|
||||
*/
|
||||
#ifndef NDEBUG
|
||||
# ifndef CUDASTF_BOUNDSCHECK
|
||||
# define CUDASTF_BOUNDSCHECK
|
||||
# endif // CUDASTF_BOUNDSCHECK
|
||||
#endif // NDEBUG
|
||||
|
||||
#include <cuda/experimental/stf.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#ifndef NDEBUG
|
||||
# if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
# else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
# endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
context ctx;
|
||||
|
||||
int X[128];
|
||||
logical_data<slice<int>> lX;
|
||||
lX = ctx.logical_data(X);
|
||||
|
||||
should_abort = true;
|
||||
|
||||
// The last access will be out of bounds
|
||||
ctx.parallel_for(lX.shape(), lX.rw())->*[] __device__(size_t i, auto X) {
|
||||
X(i + 1) = 42;
|
||||
};
|
||||
|
||||
ctx.finalize();
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
#endif
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Ensure fence() in a nested stackable context triggers an abort
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/stf.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stackable_ctx sctx;
|
||||
|
||||
auto lA = sctx.logical_data(shape_of<slice<int>>(64));
|
||||
|
||||
sctx.parallel_for(lA.shape(), lA.write())->*[] __device__(size_t i, auto a) {
|
||||
a(i) = static_cast<int>(i);
|
||||
};
|
||||
|
||||
{
|
||||
auto scope = sctx.graph_scope();
|
||||
|
||||
sctx.parallel_for(lA.shape(), lA.rw())->*[] __device__(size_t i, auto a) {
|
||||
a(i) *= 2;
|
||||
};
|
||||
|
||||
should_abort = true;
|
||||
sctx.fence(); // fence() in nested context must abort
|
||||
}
|
||||
|
||||
_CCCL_ASSERT(false, "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Ensure we detect erroneous access on non exportable stackable logical
|
||||
* data after the context was popped
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/stf.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stackable_ctx sctx;
|
||||
sctx.push();
|
||||
|
||||
auto lB = sctx.logical_data_no_export(shape_of<slice<int>>(1024));
|
||||
lB.set_symbol("B");
|
||||
|
||||
sctx.parallel_for(lB.shape(), lB.write())->*[] __device__(size_t i, auto b) {
|
||||
b(i) = 42;
|
||||
};
|
||||
|
||||
sctx.pop();
|
||||
|
||||
// We are going to try to access B while it was not exportable, and that the
|
||||
// context where it was created has been popped: this should raise an error.
|
||||
should_abort = true;
|
||||
|
||||
sctx.host_launch(lB.read())->*[](auto b) {
|
||||
for (size_t i = 0; i < b.size(); i++)
|
||||
{
|
||||
EXPECT(b(i) == 42);
|
||||
}
|
||||
};
|
||||
|
||||
_CCCL_ASSERT(false, "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Test that ensures we catch programming errors with inconsistent access modes in nested contexts
|
||||
*
|
||||
* This test verifies that attempting to escalate from read-only to read-write access mode
|
||||
* in nested stackable contexts is properly caught and produces a clear error message.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/stf.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stackable_ctx sctx;
|
||||
|
||||
size_t sz = 1024;
|
||||
::std::vector<int> data(sz);
|
||||
|
||||
// Initialize data
|
||||
for (size_t i = 0; i < sz; i++)
|
||||
{
|
||||
data[i] = static_cast<int>(i);
|
||||
}
|
||||
|
||||
// Create logical data
|
||||
auto ldata = sctx.logical_data(make_slice(data.data(), sz));
|
||||
|
||||
// First scope: push with READ access mode
|
||||
{
|
||||
stackable_ctx::graph_scope_guard scope1{sctx};
|
||||
ldata.push(access_mode::read);
|
||||
|
||||
// We are going to try to escalate from read to rw access mode in nested context:
|
||||
// this should raise an error.
|
||||
should_abort = true;
|
||||
|
||||
// NESTED second scope: attempt to push with RW access mode
|
||||
// This should be caught as an invalid access mode escalation
|
||||
{
|
||||
stackable_ctx::graph_scope_guard scope2{sctx};
|
||||
ldata.push(access_mode::rw); // This should trigger abort()!
|
||||
}
|
||||
}
|
||||
|
||||
_CCCL_ASSERT(false, "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Ensure wait() in a nested stackable context triggers an abort
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/stf.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stackable_ctx sctx;
|
||||
|
||||
auto lval = sctx.logical_data(shape_of<scalar_view<int>>());
|
||||
|
||||
sctx.parallel_for(box(1), lval.write())->*[] __device__(size_t, auto val) {
|
||||
*val = 42;
|
||||
};
|
||||
|
||||
{
|
||||
auto scope = sctx.graph_scope();
|
||||
|
||||
sctx.parallel_for(box(1), lval.rw())->*[] __device__(size_t, auto val) {
|
||||
*val += 1;
|
||||
};
|
||||
|
||||
should_abort = true;
|
||||
sctx.wait(lval); // wait() in nested context must abort
|
||||
}
|
||||
|
||||
_CCCL_ASSERT(false, "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ensure an error is detected if we use an uninitialized logical data in a task
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/__stf/graph/graph_ctx.cuh>
|
||||
#include <cuda/experimental/__stf/stream/stream_ctx.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#ifndef NDEBUG
|
||||
# if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
# else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
# endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stream_ctx ctx;
|
||||
|
||||
logical_data<slice<int>> lX;
|
||||
logical_data<slice<int>> lY;
|
||||
|
||||
int X[128];
|
||||
lX = ctx.logical_data(X);
|
||||
|
||||
should_abort = true;
|
||||
|
||||
// We did not initialize lY, so this task should not be able to use it.
|
||||
ctx.task(lX.rw(), lY.rw())->*[](cudaStream_t, auto, auto) {};
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
#endif
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ensure an error is raised if we try to ask for an unreasonnable
|
||||
* amount of resources in a thread hierarchy spec
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/stf.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#ifndef NDEBUG
|
||||
# if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
# else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
# endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
context ctx;
|
||||
|
||||
int X[128];
|
||||
auto lX = ctx.logical_data(X);
|
||||
|
||||
should_abort = true;
|
||||
|
||||
// We are asking an unreasonnable amount of threads per block
|
||||
auto spec = con(con<128000>());
|
||||
ctx.launch(spec, lX.rw())->*[] __device__(auto th, auto X) {
|
||||
X[th.rank()] = th.rank();
|
||||
};
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
#endif
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of CUDASTF in CUDA C++ Core Libraries,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Ensure temporary data are destroyed
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cuda/experimental/__stf/graph/graph_ctx.cuh>
|
||||
#include <cuda/experimental/__stf/stream/stream_ctx.cuh>
|
||||
|
||||
#include <csignal>
|
||||
|
||||
using namespace cuda::experimental::stf;
|
||||
|
||||
bool should_abort = false;
|
||||
|
||||
void cleanupRoutine(int /*unused*/)
|
||||
{
|
||||
if (should_abort)
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unexpected SIGABRT !\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Setup an handler to catch the SIGABRT signal during the programming error */
|
||||
#if _CCCL_COMPILER(MSVC)
|
||||
signal(SIGABRT, &cleanupRoutine);
|
||||
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC)
|
||||
struct sigaction sigabrt_action{};
|
||||
memset(&sigabrt_action, 0, sizeof(sigabrt_action));
|
||||
sigabrt_action.sa_handler = &cleanupRoutine;
|
||||
|
||||
if (sigaction(SIGABRT, &sigabrt_action, nullptr) != 0)
|
||||
{
|
||||
perror("sigaction SIGABRT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif // !_CCCL_COMPILER(MSVC)
|
||||
|
||||
stream_ctx ctx;
|
||||
const int N = 16;
|
||||
int X[N];
|
||||
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
X[i] = i;
|
||||
}
|
||||
|
||||
auto lX = ctx.logical_data(X);
|
||||
|
||||
lX.freeze(access_mode::rw, data_place::current_device());
|
||||
|
||||
// This is an illegal access because we cannot make a write access on a frozen data
|
||||
should_abort = true;
|
||||
|
||||
ctx.task(lX.rw())->*[](cudaStream_t, auto) {};
|
||||
|
||||
ctx.finalize();
|
||||
|
||||
assert(0 && "This should not be reached");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
Reference in New Issue
Block a user