DeviceCUDAkernel.cu File Reference

#include <stdio.h>
#include "CudaUtils.h"
#include <cuda.h>

Go to the source code of this file.

Functions

__global__ void read_CUDA_ARCH_kernel (int *cuda_arch)
int read_CUDA_ARCH ()


Function Documentation

int read_CUDA_ARCH (  ) 

Definition at line 38 of file DeviceCUDAkernel.cu.

References cudaCheck, and cudaDie().

00038                      {
00039   int *d_cuda_arch;
00040   int h_cuda_arch;
00041   allocate_device<int>(&d_cuda_arch, 1);
00042   
00043   read_CUDA_ARCH_kernel <<< 1, 1 >>> (d_cuda_arch);
00044   cudaError_t err = cudaGetLastError();
00045   if (err != cudaSuccess) {
00046     char str[1024];
00047     sprintf(str, "Error executing CUDA kernel read_CUDA_ARCH_kernel in file %s\nError string: %s\nPossible cause: Device compute capability is less than the compute capability the code was compiled for.\n",
00048       __FILE__,cudaGetErrorString(err));
00049     cudaDie(str);
00050   }
00051   cudaCheck(cudaDeviceSynchronize());
00052 
00053   copy_DtoH_sync<int>(d_cuda_arch, &h_cuda_arch, 1);
00054   deallocate_device<int>(&d_cuda_arch);
00055 
00056   return h_cuda_arch;
00057 }

__global__ void read_CUDA_ARCH_kernel ( int *  cuda_arch  ) 

Definition at line 7 of file DeviceCUDAkernel.cu.

00007                                                       {
00008   if (threadIdx.x == 0) {
00009 
00010 #if __CUDA_ARCH__ == 100
00011     *cuda_arch = 100;
00012 #elif __CUDA_ARCH__ == 110
00013     *cuda_arch = 110;
00014 #elif __CUDA_ARCH__ == 120
00015     *cuda_arch = 120;
00016 #elif __CUDA_ARCH__ == 130
00017     *cuda_arch = 130;
00018 #elif __CUDA_ARCH__ == 200
00019     *cuda_arch = 200;
00020 #elif __CUDA_ARCH__ == 210
00021     *cuda_arch = 210;
00022 #elif __CUDA_ARCH__ == 300
00023     *cuda_arch = 300;
00024 #elif __CUDA_ARCH__ == 350
00025     *cuda_arch = 350;
00026 #elif __CUDA_ARCH__ == 500
00027     *cuda_arch = 500;
00028 #else
00029     *cuda_arch = 500;
00030 #endif
00031 
00032   }
00033 }


Generated on Tue Sep 19 01:17:15 2017 for NAMD by  doxygen 1.4.7