Skip to content

Instantly share code, notes, and snippets.

@ChrisLane
Created February 22, 2018 14:54
Show Gist options
  • Save ChrisLane/d9a79c67efe20737f8ffe06572bd1237 to your computer and use it in GitHub Desktop.
Save ChrisLane/d9a79c67efe20737f8ffe06572bd1237 to your computer and use it in GitHub Desktop.
// Fix CUDA in CLion
#ifdef __JETBRAINS_IDE__
#define __CUDACC__ 1
#define __host__
#define __device__
#define __global__
#define __forceinline__
#define __shared__
inline void __syncthreads() {}
inline void __threadfence_block() {}
template<class T>
inline T __clz(const T val) { return val; }
struct __cuda_fake_struct {
int x;
};
#endif
#include <stdio.h>
#include <time.h>
// For the CUDA runtime routines (prefixed with "cuda_")
#include <cuda_runtime.h>
#include <helper_cuda.h>
#include <helper_functions.h>
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(assignment1 CXX CUDA)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast -Wall -Wextra -Wpedantic")
set(CMAKE_CUDA_STANDARD 11)
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -arch=sm_50")
include_directories(/opt/cuda/include)
include_directories(/opt/cuda/samples/common/inc/)
add_executable(main src/main.cu src/dummy.cpp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment