1

I am writing code to handle communication between two users and require a CUDA implementation of LDPC to quickly check for errors. I have not used CUDA before but I have found a repo on GitHub (https://github.com/robertwgh/cuLDPC) which does everything I need. My problem is that I am unable to compile this library, possibly due to it being an old version of CUDA (v4/v5).

I have tried compiling using Visual Studio by adding all of the files to a project, but various errors appear. Some of these seem to be with the code itself but the main issue is a problem with nvcc, given in an MSB3721 error.

In the repo there is a pull request which contains a makefile, so I checked that out but this has not changed the error.

I then tried going into the command prompt and using nvcc manually, but get the error

Cannot find compiler 'cl.exe' in PATH

I have tried solving this by adding

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\

to my PATH variable, but I get the same error. I also ran vcvars32.bat and vcvars64.bat after resetting my PATH but this still had no effect both times.

Additionally, I have added cublas.lib, cudart.lib and cusparse.lib to the linker input dependencies in the project properties and I have checked CUDA 10.1 in the build dependencies > build customisations menu.

I am at a loss on where to go now and would very much appreciate some help from people with some more knowledge on the matter.

1 Answers1

2

FWIW that github repo built and ran for me, almost out-of-the-box. The only few hacks needed were:

  • Don't compile cuLDPC_kernel.cu directly, because it's treated like a header file from cuLDPC.cu
  • Comment out some broken timing code, that is non-critical to the functionality. I guess the variables are in the wrong lexical scope. (result of git diff below)

First create a new CUDA-enabled Visual Studio project:

Create new CUDA-enabled Visual Studio Project

Drag in the "src" directory from the github repo. Then modify file properties for cuLDPC_kernel.cu to not be built.

Solution explorer menu

Set "Excluded from Build" = Yes

Excluded from Build

Code changes required to build:

diff --git a/src/cuLDPC.cu b/src/cuLDPC.cu
index f217de4..3c3865c 100755
--- a/src/cuLDPC.cu
+++ b/src/cuLDPC.cu
@@ -448,17 +448,17 @@ int runTest()

 #if MEASURE_CPU_TIME == 1
         cudaDeviceSynchronize();
-        cpu_timer.stop();
-        cpu_run_time += cpu_timer.stop_get();
+        //cpu_timer.stop();^M
+        //cpu_run_time += cpu_timer.stop_get();^M

         printf ("\n=================================\n\r");
         printf ("GPU CUDA Demo\n");
         printf ("SNR = %1.1f dB\n", snr);
         printf ("# codewords = %d, # streams = %d, CW=%d, MCW=%d\r\n",total_codeword * NSTREAMS, NSTREAMS, CW, MCW);
         printf("number of iterations = %1.1f \r\n", aver_iter);
-        printf("CPU time: %f ms, for %d simulations.\n", cpu_run_time, MAX_SIM);
-        float throughput = (float)CODEWORD_LEN * NSTREAMS * MCW * CW * MAX_SIM / cpu_run_time /1000;
-        printf("Throughput = %f Mbps\r\n", (float)CODEWORD_LEN * NSTREAMS * MCW * CW * MAX_SIM / cpu_run_time /1000);
+        //printf("CPU time: %f ms, for %d simulations.\n", cpu_run_time, MAX_SIM);^M
+        //float throughput = (float)CODEWORD_LEN * NSTREAMS * MCW * CW * MAX_SIM / cpu_run_time /1000;^M
+        //printf("Throughput = %f Mbps\r\n", (float)CODEWORD_LEN * NSTREAMS * MCW * CW * MAX_SIM / cpu_run_time /1000);                        ^M
 #endif

 #if MEASURE_CUDA_TIME == 1
fifoforlifo
  • 724
  • 5
  • 9
  • Thanks so much for the detail, finally got it to work. Your steps solved nearly every problem, the only other thing I needed to do was modify my VS2017 installation to include the Windows 10 SDK for desktop C++ x86 and x64, found [here](https://stackoverflow.com/questions/43410631/visual-studio-2017-cant-find-windows-h/46435707). – Chris Walker Jul 16 '19 at 13:15