Debugging Issues in CLion of CUDA files: the debugger does not stop at breakpoints - cuda

I've started a CUDA application in the new CLion 2020.1 version. Although I can compile and run it, I am not able to debug it, not even the host code. Specifically, debug does not stop at breakpoints, even though I am running the debug build. I'm not encountering this issue with running a regular C project in CLion 2020.1. I don't receive any error message of any kind. Here is my CMakeLists.txt file:
# Setup the CUDA compiler
set(CMAKE_CUDA_COMPILER /usr/local/cuda-10.2/bin/nvcc)
# Setup the host compiler
set(CMAKE_CUDA_HOST_COMPILER /usr/bin/g++-8)
# CMAKE minimum required version
cmake_minimum_required(VERSION 3.16)
project(PageRank_GPU CUDA)
set(CMAKE_CUDA_STANDARD 14)
add_executable(PageRank_GPU main.cu graph.cu graph.cuh vertex.cuh error.cuh parser.cu parser.cuh)
set_target_properties(
PageRank_GPU
PROPERTIES
CUDA_SEPARABLE_COMPILATION ON)

Reporting that the issue has disappeared after playing around in the project settings a bit. Specifically, under Build, Execution, Deployment then Toolchain, I set the C and C++ compilers to gcc-8 and g++-8 respectively (even though I am specifying the compiler in the CMakeLists.txt file) and under CMake, I set the toolchain to "Default" (the one I just modified) instead of "Use Default". After doing that, the debugger stops at breakpoints and I am able to step through my code. I don't understand what happened because, even after reverting the changes, I cannot make the problem re-appear.

Related

Octave and warning "ARPACK library found, but does not seem to work properly; disabling eigs function"

Situation
I work with Ubuntu 14.04. I am building GNU Octave 4.2.1 from source with GNU 6.3.0. This version of Octave is quite new, but I see the issue arising also when trying to compile older Octave releases (down to 3.8.1).
I configure the build of Octave with
${sourcedir}/configure --prefix=/opt/octave/4.2.1 \
--with-java-homedir=/usr/lib/jvm/default-java \
--with-java-libdir=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server
Issue
The compilation is successful but the undesired warning shows up
configure: WARNING: ARPACK library found, but does not seem to work properly; disabling eigs function
I would rather like to have the eigs() function in place.
Information
I have built ARPACK-ng myself with the same compiler. All tests in the test suite (make check) are passed. The environment variables LD_LIBRARY_PATH and PKG_CONFIG_PATH point to the ARPACK library directory as intended. The configure file of Octave recognizes that location correctly, as seen before.
Besides, I get the same message if I compile Octave in another computer where ARPACK is installed natively (libarpack2 and libarpack2-dev version 3.1.5-2). It does not change a thing if I also install the related extra libraries libarpack++2c2a and libarpack++2-dev using the package repository. So the issue appears to be independent of the origin of the ARPACK files.
The part of the configure.ac file of Octave that throws this error is
### Check for ARPACK library.
save_LIBS="$LIBS"
LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
OCTAVE_CHECK_LIB([arpack], ARPACK,
[ARPACK not found. The eigs function will be disabled.],
[],
[dseupd],
[Fortran 77], [don't use the ARPACK library, disable eigs function],
[warn_arpack=
OCTAVE_CHECK_LIB_ARPACK_OK(
[AC_DEFINE(HAVE_ARPACK, 1, [Define to 1 if ARPACK is available.])],
[warn_arpack="ARPACK library found, but does not seem to work properly; disabling eigs function"])])
LIBS="$save_LIBS"
The farthest I go in tracing back the issue is that the subroutine OCTAVE_CHECK_LIB_ARPACK_OK issuing the warning lives in the file ${octave_source}/m4/acinclude.m4. It is written in m4 language, which I don't know
Question
Is it possible to understand why ARPACK 'does not seem to work properly'?
Is there any workaround for this?
Is this a false alarm or a bug?

(VS13) mysqlclient.lib compiles (i think) as Static Multithreaded Debug even if the Runtime Library setting is Multithreaded Debug DLL

I'm trying to compile the mysqlclient.lib library as a Multithreaded Debug DLL. I need it in this configuration to be able to link it to my project. To give some context I will explain what have I done so far:
I cloned the MySQL repository: git clone https://github.com/mysql/mysql-server.git
I created the MySQL.sln by running CMake.
I opened the solution in Visual Studio 2013 and built it with the Runtime Library setting equal to /MDd.
I have tried to link the thus compiled library mysqlclient.lib to my project(which is compiled with /MDd) but I'm still getting the error:
mysqlclient.lib(plugin_client.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj
I have run dumpbin /all mysqlclient.lib | find /i "mvscr" obtaining as a result /DEFAULTLIB:MSVCRTD which suggests that the library has been compiled as /MDd.
I have to admit that before wanting to link mysqlclient.lib to my project I was not even aware of the Runtime Library setting. At this point I don't completely understand why I'm getting the linker error above, which is why I wrote in the title that I think that the library is still getting compiled as /MTd. If anyone could point me to the right direction in order to solve my problem it would be very much appreciated.
EDIT
Reading better the MySQL documentation I found out that if my project is built as /MDd or /MD I have to link it to the libmysql.dll dynamic library. Section Compiling MySQL Clients on Microsoft Windows, second to last paragraph.
https://dev.mysql.com/doc/refman/5.6/en/c-api-building-clients.html

Cuda and Nsight - launch

I've successfully installed Cuda SDK and tested the compiler with an HelloWorld
Then I've opened Nsight and I've tried with the same code.
I got this answer " Launch Failed. Binary not found." Is this a problem of the compiler involved in Nsight?
Thank you
This is a known bug. We are aware of it and will try to fix it in one of our future releases.
You need to manually build the project at least once before starting the debug - this is needed for the debugger to be able to detect executable and setup all settings. Note that the debugger will automatically trigger the build on subsequent runs - when it already knows the executable and build configuration you are using..

Cuda/output of nsight different from the command line (nvcc ) output

I run code using nvcc command and it gave correct output but when I run the same code on the nsight eclipse it gave wrong output. Any one have any idea why is this behavior.
Finally I found there is problem in one of the array allocation.While the command line doesn't make any problem the nsight does.
Nsight EE builds the projects by generating make files based on the project settings and by invoking the OS make utility to build the project. It is using nvcc compiler found in the PATH but it relies on some newer options introduced in NVCC compiler 5.0 (that is a part of the same toolkit distribution).
Please do a clean rebuild in Nsight Eclipse - it will print out the command lines used to build your application. Then you can compare that command line with the one you use outside. Possible differences are:
Nsight specifies debug flags and optimization flag when building in debug and release modes.
By default, Nsight sets the new project to build for the hardware detected on your system. NVCC default is SM 1.0.
Make sure the compiler used by Nsight and from the command line are one and the same. It is possible that you have different compilers (e.g. 4.x and 5.0) installed on your system that may generate a slightly different code.
In any case, it is likely your code has some bug that manifests itself under different compilation settings. I would recommend running CUDA memcheck on you program to ensure there is no hidden bugs.

Flash Builder Mac Breakpoints generate NullPointerExceptions

I have a complex, pre-existing Actionscript project to work with at my current employer. The project was originally created with FlashDevelop, which is not an option for me as a Mac user. I can successfully build the project and deploy it to others. It runs as expected.
The problem is with the debugging. I cannot make it work. I believe users of Flash Builder on Windows machines have successfully debugged this project on their machine. I can build and debug projects I make myself. It's THIS particular project, or something about how it is constructed, that is preventing debugging from occurring.
Symptoms:
Starting the program via the Debug button runs the program, but the presence of a breakpoint causes the program to freeze the browser where it is running
Removing the breakpoint or stopping the debugger allows the browser to unfreeze and continue normally
At no point does the breakpoint actually get reached and break into the debugger
Attempting to place a breakpoint during execution results in an internal error: java.lang.NullPointerException
Example log message from within .metadata/.log
java.lang.NullPointerException
!STACK 0
!MESSAGE Error processing debugger commands
!ENTRY com.adobe.flexbuilder.project 4 43 2011-08-24 13:35:07.404
at java.lang.Thread.run(Thread.java:680)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.run(FlexDebugTarget.java:793)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.eventLoop(FlexDebugTarget.java:732)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread$1.run(FlexDebugTarget.java:752)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.access$7(FlexDebugTarget.java:642)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.advanceStateMachine(FlexDebugTarget.java:668)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget$FdbThread.installDeferredBreakpoints(FlexDebugTarget.java:637)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget.access$4(FlexDebugTarget.java:1006)
at com.adobe.flexbuilder.debug.model.FlexDebugTarget.instantiateBreakpoint(FlexDebugTarget.java:1012)
at com.adobe.flexbuilder.debug.breakpoints.FlexLineBreakpoint.instantiate(FlexLineBreakpoint.java:465)
at com.adobe.flexbuilder.debug.breakpoints.FlexLineBreakpoint.findSourceFiles(FlexLineBreakpoint.java:412)
Attempted Fixes:
Cleaned project
Cleared browser cache
Tried different browsers (Yes, I have the debug player)
Deleted .metadata
Deleted workspace
Reinstalled Flash Builder
Reinstalled Debug Flash Player
Restarted Mac
Tried a different SDK
Reordered Java preference for both 32 and 64 bit configurations
Removed symlinks from project configuration (that is, symlinks are no longer needed to correctly find the build or run location)
Cleared Flash logs
Ensured no more than one version of the program was getting compiled (so it can't actually be running from another location)
Explicitly turned on debugging through compiler argument: -debug=true
Changing just about every relevant and lots of irrelevant settings within Project Properties
Project Details:
Interestingly, clicking on Actionscript Applications in the Project Properties results in Flash Builder immediately becoming unresponsive
Uses third-party libraries for functionality that may or may not be Debug builds
Uses third-party code for functionality that is included with the rest of the code via Actionscript Build Path > Source path (note that this folder must be included explicitly for this project even though the path included is already in the source directory)
Runs from a local web server, accessing local database using a custom domain that is not "localhost" nor an IP address (changed for Chrome cookie issues), rather it looks like http://programname.local/
Launch configuration starts the web browser at the correct local url (as opposed to starting up from a file), probably irrelevant
There is one additional compiler argument that simply creates a global, compile-time constant, probably irrelevant
Source and project directories contain svn repository folders and files, probably irrelevant
I have an NDA, so I can only talk about the project and its structure, I can't post code
Configuration:
Mac OS 10.6.8
Flash Builder 4 (through CS5)
Flex SDK 4.0 and 4.5.1
Figured it out. Our app uses a preloader which I had always gotten from others. I had assumed it was compiled to debug because I always got my copy from our debug server. I didn't fully understand how it worked or what it was doing.
Due to a Flash error in the preloader, this morning I was forced to compile it for the first time. Compiling it normally (as debug) I realized the problem with non-debug swfs loading debug swfs might apply here.
Breakpoints worked as expected once I correctly compiled the preloader and fixed its bug. Apparently our preloader is doing the actual loading of the main app. Flash Builder apparently can't handle this setup (non-debug loading a debug swf), whereas FlashDevelop apparently can.
Have you tried restarting your Mac?
I feel your pain, and your list of attempted fixes are what I'd try first :)
I had a similar situation to this and after hours of cursing Adobe I restarted my Mac and that solved it (probably some kind of memory error).