Is there any way to debug cuda functions called by java (jcuda) ?
My program launch this exception:
Exception in thread "main" jcuda.CudaException:CUDA_ERROR_ILLEGAL_ADDRESS
at jcuda.driver.JCudaDriver.checkResult(JCudaDriver.java:288)
at jcuda.driver.JCudaDriver.cuCtxSynchronize(JCudaDriver.java:1852)
at CalculateurGPU.updateAndCompute(rGPUcalculator.java:129)
at Test.main(Test.java:90)
I have a very long cuda code, and i can't find any information in that to help me find where the error is.
Another question: when i click on "JCudaDriver.java:288" i don't have access to it, it says "source not found". How can i attach thesesources to my project ?
Thanks in advance
The best way I have been able to debug my JCuda executable code is by putting printf statements everywhere. Obviously delete them after you are done but you have to start somewhere.
Add the following to your .java code that is calling your kernel code.
JCudaDriver.cuCtxSetLimit(CUlimit.CU_LIMIT_PRINTF_FIFO_SIZE, 4096);
Then inside your CUDA kernel, use printf(""); statements in your CUDA kernel code to determine where the problem exists. If I had a guess it would be due to you access a piece of memory that you shouldn't be.
I would also suggest wrapping the printf with a if(gtid == 0){printf("hello\n");} otherwise you are going to have every thread trying to perform the printf.
Source: http://forum.byte-welt.net/byte-welt-projekte-projects/swogl-jcuda-jocl/jcuda/3255-gpu-printf-compute-capility-2-0-a.html
EDIT:
I would like to add that there has been a debugging section added on the JCuda website. It suggests using a tool called "cuda-memcheck" to aid in debugging your CUDA applications.
http://www.jcuda.org/debugging/Debugging.html
Related
I'm running VisualVM to profile a simple Java application. When I double-click on a method in the profiling pane (hoping to get more details on it), then it says "No source found for class ....". I know where the source is. How do I tell VisualVM where to look?
I took a stack dump of the VisualVM process while it was displaying that error dialog, and it seems that the problem lies in the class org.netbeans.modules.profiler.api.GoToSource, in the method openSourceImpl.
This method tries to load the source using any registered implementations of the GoToSourceProvider service provider interface, and displays the error message if none of them manage to display the source code in question.
My guess is that the current, default version of VisualVM doesn't have any GoToSourceProviders registered, and therefore will always fail to look-up source code.
From the package name it appears that GoToSourceProvider is an SPI for the profiler module, but I wasn't able to find any documentation on how to implement this SPI, and it doesn't seem to be part of the VisualVM extension points.
Hello something virtually same like VisualVM is implemented in NetBeans IDE (I'm using 8.0.2). You just click Profile->Project Profile. Showing you source code upon clicking is working there. But unfortunately there is no more detailed info which lines of code takes most time.
For that I will modify code and I will count manually using
long beg = System.nanoTime()
lineISuspect
sum += System.nanoTime() - beg;
I am new to java.I have a doubt that only ".java" files supports debugging whereas the
".class" files does not supports debugging in IDE.
Can you please suggest an answer?
Most IDE's (I know eclipse does, and pretty sure IntelliJ and netbeans do) will allow you to step through the processing of a class file, however they won't let you see what code is being executed, however you can see the variables in use. However to get there you will need to add a breakpoint in your code, and step down to the relevant class file. If you can attach the source, it will let you see the code being executed, as well as add a breakpoint directly in the file in question.
I am trying to debug my java application and getting Thread.exit line: not available. Source not found. Edit source look-up path...
I am using java 1.6_35 and have jdk installed in my system. I find the same problem described here!
But couldn't able to resolve in my system as i am not able to see any src.zip file in jdk and there is not much information given about what to do to resolve this.
Additionally,In my application two Thread is running 1.Thraed [main] suspended which is producing this error & 2.Thraed [Thread-3]. This application is a Swing application and i am checking on an issue associated with the second pop-up whick produces some error.
The problem is, In success scenario i am able to debug the 2nd Thread, But in failure case after the Thread.exit() I am not able to proceed, So i couldn't find exactly where the problem occurs? Please suggest to resolve this... Thanks in advance
I know this issue is old, but maybe it would be useful for someone:
You can use (for instance right after the end of the loop)
System.exit(0);
This will stop the thread.
Trying to figure out my way around Sphinx 4 (the CMU speech recognition engine in Java), I tried to use a demo included with the distribution by altering it to what I wanted it to do (the name of the demo is Aligner). I am running into problems and want to use jdb from the command line for debugging the same. I read the documentation given here, but it is limited and does not have a solution to my problem, which in brief is as follows:
I invoke jdb like so:
jdb Aligner (name of the main class of the project).
Set a breakpoint like so: stop at Aligner:33
The output I get (on the command line):
Deferring breakpoint Aligner:33.
It will be set after the class is loaded.
In the file demo.xml (which is the makefile equivalent for this Project),
javac debug=true is mentioned.
My questions:
1. Where should I invoke jdb from? Should it be invoked from anywhere in the entire sphinx directory or should I invoke it from the same directory as Aligner.java?
2. How can I use jdb with the jar for this project?
P.S: I know I can use Eclipse with this, but I am not sure I know how to do that. My first priority is to get this up and running.
P.P.S: I am a Java newbie and do not know much about the language. My preference for the command line comes from my background of C/C++ programming on the command line.
Any help is most welcome,
Thanks!
What are you actually trying to do?
If you are not so familiar with Java, why not use Sphinx3 or pocketsphinx, both of which are implemented in C?
http://cmusphinx.sourceforge.net/wiki/download/
Also, you might get better responses on this topic by checking the forums on the above site, or checking in to the IRC channel #cmusphinx
Finally, you mention that your program name is 'aligner', which makes it sound like maybe you are trying to do forced alignment? There are already existing tools for this in the sphinx3/sphinxtrain/pocketsphinx packages and it would probably be worth your while to check them out.
I am working with a third party API http://jortho.sourceforge.net/
While using the API, I always get an exception
java.util.zip.zipexception : unknown compression method
There are no zip files involved, I tried not using the .jar file of the API, instead using the class files directly, but it still gives me the same error.
What possibly could be the reason? How can I start off with my debugging?
There is a class WordIterator which uses java.util.zip.InflaterInputStream but I don't think the problem is with the API.
I am stuck! What can be the possible way out?
I sounds to me as if someone is trying to unzip a corrupted zip-file/stream, or something which isn't a zip-file or stream at all.
Since JOrtho is GPL, your best shot is to get the source code and debug the thing yourself. In Eclipse, you can set an exception breakpoint on ZipException and the debugger will stop immediately before the exception is thrown.