Skip to content

Commit

Permalink
add the issue test for cuda/hip reset collision
Browse files Browse the repository at this point in the history
  • Loading branch information
yhmtsai committed Jul 28, 2021
1 parent 404a316 commit 92970cd
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Expand Up @@ -315,17 +315,17 @@ build/cuda91/clang/all/release/shared:

# cuda 9.2 and friends
build/cuda92/gcc/all/release/shared:
<<: *default_build
<<: *default_build_with_test
extends:
- .full_test_condition
- .quick_test_condition
- .use_gko-cuda92-gnu7-llvm50-intel2017
variables:
<<: *default_variables
BUILD_OMP: "ON"
BUILD_CUDA: "ON"
BUILD_HIP: "ON"
BUILD_TYPE: "Release"
CUDA_ARCH: 35
CUDA_ARCH: 61

# cuda 10.0 and friends
# Make sure that our jobs run when using self-installed
Expand Down
3 changes: 1 addition & 2 deletions .gitlab/image.yml
Expand Up @@ -30,8 +30,7 @@
image: ginkgohub/cuda:92-gnu7-llvm50-intel2017
tags:
- private_ci
- controller
- cpu
- nvidia-gpu

.use_gko-cuda100-gnu7-llvm60-intel2018:
image: ginkgohub/cuda:100-gnu7-llvm60-intel2018
Expand Down
1 change: 1 addition & 0 deletions cuda/test/base/CMakeLists.txt
@@ -1,5 +1,6 @@
ginkgo_create_cuda_test(array)
ginkgo_create_cuda_test(cuda_executor)
ginkgo_create_cuda_test(cuda_executor_reset)
if(GINKGO_HAVE_HWLOC)
find_package(NUMA REQUIRED)
ginkgo_create_cuda_test(cuda_executor_topology NUMA::NUMA)
Expand Down
65 changes: 65 additions & 0 deletions cuda/test/base/cuda_executor_reset.cu
@@ -0,0 +1,65 @@
/*******************************<GINKGO LICENSE>******************************
Copyright (c) 2017-2021, the Ginkgo authors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************<GINKGO LICENSE>*******************************/

#include <ginkgo/core/base/executor.hpp>


#include <gtest/gtest.h>


namespace {


#define GTEST_ASSERT_NO_EXIT(statement) \
ASSERT_EXIT({ {statement} exit(0); }, ::testing::ExitedWithCode(0), "")

TEST(DeviceReset, HipCuda)
{
GTEST_ASSERT_NO_EXIT({
auto ref = gko::ReferenceExecutor::create();
auto hip = gko::HipExecutor::create(0, ref, true);
auto cuda = gko::CudaExecutor::create(0, ref, true);
});
}


TEST(DeviceReset, CudaHip)
{
GTEST_ASSERT_NO_EXIT({
auto ref = gko::ReferenceExecutor::create();
auto cuda = gko::CudaExecutor::create(0, ref, true);
auto hip = gko::HipExecutor::create(0, ref, true);
});
}


} // namespace
1 change: 1 addition & 0 deletions hip/test/base/CMakeLists.txt
@@ -1,4 +1,5 @@
ginkgo_create_hip_test(hip_executor)
ginkgo_create_hip_test(hip_executor_reset)
if(GINKGO_HAVE_HWLOC)
find_package(NUMA REQUIRED)
ginkgo_create_hip_test(hip_executor_topology NUMA::NUMA)
Expand Down
65 changes: 65 additions & 0 deletions hip/test/base/hip_executor_reset.hip.cpp
@@ -0,0 +1,65 @@
/*******************************<GINKGO LICENSE>******************************
Copyright (c) 2017-2021, the Ginkgo authors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************<GINKGO LICENSE>*******************************/

#include <ginkgo/core/base/executor.hpp>


#include <gtest/gtest.h>


namespace {


#define GTEST_ASSERT_NO_EXIT(statement) \
ASSERT_EXIT({ {statement} exit(0); }, ::testing::ExitedWithCode(0), "")

TEST(DeviceReset, HipCuda)
{
GTEST_ASSERT_NO_EXIT({
auto ref = gko::ReferenceExecutor::create();
auto hip = gko::HipExecutor::create(0, ref, true);
auto cuda = gko::CudaExecutor::create(0, ref, true);
});
}


TEST(DeviceReset, CudaHip)
{
GTEST_ASSERT_NO_EXIT({
auto ref = gko::ReferenceExecutor::create();
auto cuda = gko::CudaExecutor::create(0, ref, true);
auto hip = gko::HipExecutor::create(0, ref, true);
});
}


} // namespace

0 comments on commit 92970cd

Please sign in to comment.