stdgpu/compiler.h Source File

stdgpu/compiler.h Source File#

stdgpu: stdgpu/compiler.h Source File
stdgpu Latest
Efficient STL-like Data Structures on the GPU
compiler.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Patrick Stotko
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef STDGPU_COMPILER_H
17#define STDGPU_COMPILER_H
18
28namespace stdgpu
29{
30
35#define STDGPU_HOST_COMPILER_UNKNOWN 10
40#define STDGPU_HOST_COMPILER_GCC 11
45#define STDGPU_HOST_COMPILER_CLANG 12
50#define STDGPU_HOST_COMPILER_MSVC 13
51
56#define STDGPU_DEVICE_COMPILER_UNKNOWN 20
61#define STDGPU_DEVICE_COMPILER_NVCC 21
66#define STDGPU_DEVICE_COMPILER_HIPCLANG 22
71#define STDGPU_DEVICE_COMPILER_CUDACLANG 23
72
78#if defined(__GNUC__) && !defined(__clang__)
79 #define STDGPU_HOST_COMPILER STDGPU_HOST_COMPILER_GCC
80#elif defined(__clang__)
81 #define STDGPU_HOST_COMPILER STDGPU_HOST_COMPILER_CLANG
82#elif defined(_MSC_VER)
83 #define STDGPU_HOST_COMPILER STDGPU_HOST_COMPILER_MSVC
84#else
85 #define STDGPU_HOST_COMPILER STDGPU_HOST_COMPILER_UNKNOWN
86#endif
87
93#if defined(__NVCC__)
94 #define STDGPU_DEVICE_COMPILER STDGPU_DEVICE_COMPILER_NVCC
95#elif defined(__HIP__)
96 #define STDGPU_DEVICE_COMPILER STDGPU_DEVICE_COMPILER_HIPCLANG
97#elif defined(__clang__) && defined(__CUDA__)
98 #define STDGPU_DEVICE_COMPILER STDGPU_DEVICE_COMPILER_CUDACLANG
99#else
100 #define STDGPU_DEVICE_COMPILER STDGPU_DEVICE_COMPILER_UNKNOWN
101#endif
102
103} // namespace stdgpu
104
105#endif // STDGPU_COMPILER_H