1 | //===-- lib/cuda/init.cpp ---------------------------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "flang/Runtime/CUDA/init.h" |
10 | #include "flang-rt/runtime/environment.h" |
11 | #include "flang-rt/runtime/terminator.h" |
12 | #include "flang/Runtime/CUDA/common.h" |
13 | |
14 | #include "cuda_runtime.h" |
15 | |
16 | extern "C" { |
17 | |
18 | void RTDEF(CUFInit)() { |
19 | // Perform ctx initialization based on execution environment if necessary. |
20 | if (Fortran::runtime::executionEnvironment.cudaStackLimit) { |
21 | CUDA_REPORT_IF_ERROR(cudaDeviceSetLimit(cudaLimitStackSize, |
22 | Fortran::runtime::executionEnvironment.cudaStackLimit)); |
23 | } |
24 | } |
25 | } |
26 | |