Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_checkLaunchBlocking.hpp
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TPETRA_DETAILS_CHECKLAUNCHBLOCKING_HPP
11#define TPETRA_DETAILS_CHECKLAUNCHBLOCKING_HPP
12
13#include "TpetraCore_config.h"
14#include <cstdlib>
15#include <stdexcept>
16#include "Kokkos_Core.hpp"
17
18namespace Tpetra {
19namespace Details {
20#ifdef HAVE_TPETRACORE_CUDA
21 //Verify that for pre-Pascal CUDA architectures, $CUDA_LAUNCH_BLOCKING == 1
22 inline void checkOldCudaLaunchBlocking()
23 {
24 if(!Kokkos::is_initialized())
25 throw std::logic_error("Kokkos must be initialized in order to check CUDA_LAUNCH_BLOCKING setting.");
26 size_t arch = Kokkos::Cuda::device_arch();
27 if(arch < 600)
28 {
29 //Compiling for Kepler/Maxwell: require launch blocking.
30 const char* launchBlockingEnv = std::getenv("CUDA_LAUNCH_BLOCKING");
31 if(!launchBlockingEnv || strcmp(launchBlockingEnv, "1"))
32 {
33 throw std::runtime_error(
34 "Tpetra::initialize(): Kokkos was compiled for an older CUDA architecture than Pascal, but\n"
35 "the environment variable CUDA_LAUNCH_BLOCKING is either unset or is not \"1\".\n"
36 "It must be set to \"1\" at runtime.\n");
37 }
38 }
39 }
40#else
41 inline void checkOldCudaLaunchBlocking() {}
42#endif
43}}
44
45#endif
Nonmember function that computes a residual Computes R = B - A * X.
Namespace Tpetra contains the class and methods constituting the Tpetra library.