Changes in defines are not seen by studio F5 (debug-run)

(sorry about mistackes, I’m russian)
I have preproc.h files in my project, where have declared defines, like CUDA_THREADS_COUNT:
#define CUDA_THREADS_COUNT 256
It uses only in .cu file, which is single in all project. When I try to change this number (for example, 512 threads), I need to push down ctrl+alt+F7 for full project rebuilding, because F5 (start debugging) see only changes in the code of C++/C files, not .cu, so they are not recompiled, because that constant uses only in .cu. But if ever it uses in .cpp and .cu (like, #define COLLISION_ENABLE true), it anyway compiles only C/C++ code.
How can I make my studio to understand, when .cu should be recompiled? I guess, there is some linking problem?..
(If I write something wrong or incomprehensible, please, tell it to me, I will try to rewrite some part)

Hi Nexxen,

I am guessing that the .cu file may be “excluded from build” for some reason. If things build correctly now, I think just turning off “excluded from build” will probably fail to build.

How is the .cu file compiled?

Nope, the .cu-file doesn’t excluded from the build. If it is so, I won’t get correct program when pushing atl+ctrl+F7.
File doesn’t compiled especially. As I said, alt+ctrl+F7. I guess, this combination makes nvcc works, in turn it makes compiler of VS works, so, the executable file appears.
But if I push only “debug run” with button F5, compiler of VS starts at first, so nvcc doesn’t recompiled.
But if I push “debug run” by F5 and before the .cu code was changed, the nvcc starts.
(only my guess about nvcc and cl)

This I changed define constant and press F5 : only vs-compiler started, so .cu see previous value of constant!

This I press full rebuild by alt+ctrl+F7 : nvcc started and after that vs-compiler started too, so .cu and .cpp see now current value!

won’t display images with tag [_img] for some reason…

Hi,

Our IT infrastructure is blocking me from looking at what you provided.
How did you create the project?

Could you share the project and sources? or at least the project?

Thanks

I guess, I can’t upload my project.
I create with “CUDA Project”. I also installed Nsight. I did’t change something in settings, so it is a default project.
Where is also no sources dependence. I mean:
1.cpp
#include “preproc.h”
extern void CUFunc();
int main()
{
printf("%d\n", X);
CUFunc();
}

preproc.h
#define X 10

kernel.cu
#include
void CUFunc()
{
printf("%d\n", X);
}

alt+ctrl+F7 and f5 (run) = nvcc, cl (what was started and in what sequence) => 10 10 (output)
change X to 5
f5 = cl => 5 10
alt+ctrl+F7 and f5 = nvcc, cl => 5 5

As you can see, no nvcc with f5. It means, VS see X changing, but redirect message like “There was some changes, you should recompile some stuff, dude” only to cl (VS compiler), but no to nvcc. But if alt+ctrl+F7 was pressed, VS broadcast to all “Recompile all of included files into the project!”, after that nvcc runs, because the project is CUDA, so nvcc is a boss :P

^— It is only my opinion. I can be wrong. No, I guess, I am wrong, but don’t know there :( Or maybe VS must be setup much more for rebuilding all changes by pressing f5

p.s I remebered something! I changed an option “/Zi” in compiler settings, because CUDA swears it. I guess, nvcc can’t work with “edit and continue” option. I also exclude some .lib file, because CUDA swears it too. It says, what that .lib was included before:
Linker -> Command Line -> /NODEFAULTLIB:msvcrt.lib
/NODEFAULTLIB:libcmt.lib

Linker -> General -> Enable incremental linking: No (/INCREMENTAL:NO)

C/C++ -> Debug information format: Program Database (/Zi)

that options are enables.

p.s It isn’t related to this theme, but I have some trouble with debugging kernel. When I make a breakpoint in it, I have a freeze for ~30-60 seconds and BSOD with 0x00…05 (maybe some other number… don’t remember well) error. Is there someone with the same problem which was solved?

p.p.s Hi :)

Any ideas? Or it can’t be helped without sources of the project? :(

I’ll try this out during my day tomorrow (Friday)