Skip to content
Snippets Groups Projects
Commit 0c730402 authored by Maxence Naud's avatar Maxence Naud
Browse files

Change code lines order to avoid pointer error

parent 75102058
Branches main
No related tags found
2 merge requests!61v0.4.0,!59Change code lines order to avoid pointer error
Pipeline #61076 passed
......@@ -37,7 +37,7 @@ TEST_CASE("CUDA test") {
}
// Allocate device memory
float *d_a, *d_b, *d_out;
float *d_a, *d_b, *d_out;
cudaMalloc(reinterpret_cast<void**>(&d_a), sizeof(float) * N);
cudaMalloc(reinterpret_cast<void**>(&d_b), sizeof(float) * N);
cudaMalloc(reinterpret_cast<void**>(&d_out), sizeof(float) * N);
......@@ -46,9 +46,9 @@ TEST_CASE("CUDA test") {
cudaMemcpy(d_a, a, sizeof(float) * N, cudaMemcpyHostToDevice);
cudaMemcpy(d_b, b, sizeof(float) * N, cudaMemcpyHostToDevice);
// Executing kernel
// Executing kernel
vector_add(d_out, d_a, d_b, N);
// Transfer data back to host memory
cudaMemcpy(out, d_out, sizeof(float) * N, cudaMemcpyDeviceToHost);
......@@ -71,7 +71,6 @@ TEST_CASE("CUDA test") {
TEST_CASE("Tensor creation", "[Connector]") {
SECTION("from const array") {
Tensor x;
x.setBackend("cuda");
x = Array3D<int,2,2,2>{
{
{
......@@ -83,6 +82,7 @@ TEST_CASE("Tensor creation", "[Connector]") {
{7, 8}
}
}};
x.setBackend("cuda");
REQUIRE(x.nbDims() == 3);
REQUIRE(x.dims()[0] == 2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment