-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly integrate CUDA, remove testCUDA file
Also remove c++14 specific code since compiler doesn't support it anymore
- Loading branch information
Showing
9 changed files
with
167 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,53 @@ | ||
#include "Application.h" | ||
#include <memory> | ||
#include <cuda_runtime_api.h> | ||
#include <cuda.h> | ||
|
||
using std::cout; | ||
void printCudaDetails(); | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
|
||
//std::unique_ptr<Application> app = std::make_unique<Application>(); | ||
std::unique_ptr<Application> app(make_unique<Application>()); | ||
|
||
printCudaDetails(); | ||
std::unique_ptr<Application> app(new Application()); | ||
app->run(); | ||
return 0; | ||
} | ||
|
||
void printCudaDetails() { | ||
int deviceCount = 0; | ||
cudaError_t error_id = cudaGetDeviceCount(&deviceCount); | ||
if (error_id != cudaSuccess) { | ||
cout<<"cudaGetDeviceCount returned "<<static_cast<int>(error_id)<<"\n" | ||
<< cudaGetErrorString(error_id)<<"\n"; | ||
cout<<"Result = FAIL\n"; | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
// This function call returns 0 if there are no CUDA capable devices. | ||
if (deviceCount == 0) { | ||
cout<<"There are no available device(s) that support CUDA\n"; | ||
} else { | ||
cout<<"Detected "<<deviceCount<<" CUDA Capable device(s)\n"; | ||
} | ||
|
||
int dev, driverVersion = 0, runtimeVersion = 0; | ||
|
||
for (dev = 0; dev < deviceCount; ++dev) { | ||
cudaSetDevice(dev); | ||
cudaDeviceProp deviceProp; | ||
cudaGetDeviceProperties(&deviceProp, dev); | ||
|
||
cout<<"\nDevice: "<<dev<<" "<<deviceProp.name<<"\n"; | ||
|
||
// Console log | ||
cudaDriverGetVersion(&driverVersion); | ||
cudaRuntimeGetVersion(&runtimeVersion); | ||
cout<<" CUDA Driver Version / Runtime Version "<<driverVersion / 1000<<"."<<(driverVersion % 100) / 10 | ||
<<" / "<<runtimeVersion / 1000<<", "<< ((runtimeVersion % 100) / 10)<<"\n", | ||
cout<<" CUDA Capability Major/Minor version number: "<<deviceProp.major<<"."<< deviceProp.minor<<"\n\n"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.