1 //===-- runtime/CUDA/init.cpp ---------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "flang/Runtime/CUDA/init.h"
10 #include "../environment.h"
11 #include "../terminator.h"
12 #include "flang/Runtime/CUDA/common.h"
14 #include "cuda_runtime.h"
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
));