Commit 249561ff authored by Andrey Filippov's avatar Andrey Filippov

debug cuda

parent 6833a295
...@@ -48,6 +48,9 @@ import static jcuda.nvrtc.JNvrtc.nvrtcCreateProgram; ...@@ -48,6 +48,9 @@ import static jcuda.nvrtc.JNvrtc.nvrtcCreateProgram;
import static jcuda.nvrtc.JNvrtc.nvrtcDestroyProgram; import static jcuda.nvrtc.JNvrtc.nvrtcDestroyProgram;
import static jcuda.nvrtc.JNvrtc.nvrtcGetPTX; import static jcuda.nvrtc.JNvrtc.nvrtcGetPTX;
import static jcuda.nvrtc.JNvrtc.nvrtcGetProgramLog; import static jcuda.nvrtc.JNvrtc.nvrtcGetProgramLog;
import static jcuda.nvrtc.JNvrtc.nvrtcVersion;
import static jcuda.nvrtc.JNvrtc.nvrtcGetNumSupportedArchs;
import static jcuda.nvrtc.JNvrtc.nvrtcGetSupportedArchs;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -506,8 +509,35 @@ public class GPUTileProcessor { ...@@ -506,8 +509,35 @@ public class GPUTileProcessor {
// Use the NVRTC to create a program by compiling the source code // Use the NVRTC to create a program by compiling the source code
nvrtcProgram program = new nvrtcProgram(); nvrtcProgram program = new nvrtcProgram();
nvrtcCreateProgram( program, sourceCode, null, 0, null, null); nvrtcCreateProgram( program, sourceCode, null, 0, null, null);
int nvrtc_rslt = -1;
/*
nvrtc_rslt= nvrtcVersion(nvrtc_version[0],nvrtc_version[0]);
System.out.println("nvrtcVersion="+nvrtc_version[0][0]+"."+nvrtc_version[1][0]+" (returned "+nvrtc_rslt+").");
*/
int [] nvrtc_num_arch = new int[1];
nvrtc_rslt= nvrtcGetNumSupportedArchs(nvrtc_num_arch);
System.out.println("nvrtc_num_arch="+nvrtc_num_arch[0]+" (returned "+nvrtc_rslt+").");
int [] nvrtc_archs = new int[nvrtc_num_arch[0]];
nvrtc_rslt= nvrtcGetSupportedArchs(nvrtc_archs);
int max_arch = 0;
for (int sa: nvrtc_archs) {
max_arch = Math.max(max_arch, sa);
}
for (int sa: nvrtc_archs) {
System.out.println("Supported arch "+sa);
}
System.out.println("Max supported arch is "+max_arch+", gpu capability = "+capability);
if (capability > max_arch) {
capability = max_arch;
System.out.println("Reduced capability to match NVRTC compiler to "+capability);
}
System.out.println();
String options[] = {"--gpu-architecture=compute_"+capability,"--extensible-whole-program"}; String options[] = {"--gpu-architecture=compute_"+capability,"--extensible-whole-program"};
System.out.println("Running NVRTC with the following options:");
for (String s:options) {
System.out.println(s);
}
System.out.println();
try { try {
nvrtcCompileProgram(program, options.length, options); nvrtcCompileProgram(program, options.length, options);
OK = true; OK = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment