FLANG
complex.h
1//===-- include/flang/Runtime/complex.h -------------------------*- 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// A single way to expose C++ complex class in files that can be used
10// in F18 runtime build. With inclusion of this file std::complex
11// and the related names become available, though, they may correspond
12// to alternative definitions (e.g. from cuda::std namespace).
13
14#ifndef FORTRAN_RUNTIME_COMPLEX_H
15#define FORTRAN_RUNTIME_COMPLEX_H
16
17#include "flang/Common/api-attrs.h"
18
19#if RT_USE_LIBCUDACXX && defined(RT_DEVICE_COMPILATION)
20#include <cuda/std/complex>
21namespace Fortran::runtime::rtcmplx {
22using cuda::std::complex;
23using cuda::std::conj;
24} // namespace Fortran::runtime::rtcmplx
25#else // !(RT_USE_LIBCUDACXX && defined(RT_DEVICE_COMPILATION))
26#include <complex>
27namespace Fortran::runtime::rtcmplx {
28using std::complex;
29using std::conj;
30} // namespace Fortran::runtime::rtcmplx
31#endif // !(RT_USE_LIBCUDACXX && defined(RT_DEVICE_COMPILATION))
32
33#endif // FORTRAN_RUNTIME_COMPLEX_H