Persistent GPU data in Visual Studio AMP? - c++

Its easy to create a block of GPU memory in CUDA/OpenCL that persists over multiple GPU calls. But how is that done in Visual Studio AMP? The best I've seen is an incorrect answer on another site that says just make local references to host-persistent data. But I know that's wrong because it would still do a host-to-GPU copy every time you instantiate the reference, right?
Surely Microsoft wouldn't go to all the trouble of developing AMP and then neglect a thing that makes it worth using! Any thoughts or ideas welcome.
I'm using Visual Studio 2015 C++11.

Related

Visual studio code C++ : how to display types and address in watches/locals

I recently switched to Visual Studio Code for C++ programming.
I'm now facing a rather nasty bug (some accesses to freed memory), so I need to look more into detail into what is where in memory.
It would help a lot if when debugging, in the watches/locals, I could display the type and address of variables "automatically". Do you know if there is some solution?
For now, for the addresses, I found I can create a new watch with "&my_variable", but that's quite time consuming if I have to do it for every variable. It would be nicer if it could be always displayed, or at least if there were an option like "left click/display address". If you have a solution working for just objects and/or arrays, it would already be a big step forwards.
PS : platform : linux(xubuntu 20.4); visual code studio v1.66.0 ; debugger : gdb

Microsoft Visual C++ 6.0 destroys project

I have an old application written with VC++ 6.0, that I have to maintain. The application is quite large, and it would require a lot of time to convert it to a newer VC++ (like VS2005).
The problem is, that every time I make the smallest changes in the code, the solution (.dsw-file) is destroyed.
I use a VMware Virtual Machine running Windows XP 32bit as Development Environment.
Has anyone else experienced the same problem with Microsoft Visual C++ 6.0?
Hard to give advice, VS6 is not well known to spontaneously destruct project files. You could arbitrarily set the read-only attribute on the .dsw file, you ought to get some kind of message when whatever code is doing this finds out it can no longer delete the file.
I have to add some unwelcome advice. Using a grossly outdated version of Visual Studio is okayish, but as time ticks on the inconveniences and quirks build up. It never gets better. Until you get to a point where investing the time to update the project (don't pick the grossly outdated VS2005) gets to be competitive with the amount of time you waste keeping the old one going. Sounds like D-day has arrived. Time to ditch it.

C++ Video Game Programming IDE

I am looking for a C++ IDE in which I can actively play the game and test the updates live instead of testing it, redoing th code, compiling it and running it again. I'm running Windows 7 x86 professional.
This isn't really an answer, and so probably shouldn't get upvotes, but has information.
I don't know of any C++ IDE that can do runtime updates of code, but it's definitely not impossible. There's lots of C++ assemblers which already JIT code, live updates is merely the next step that no IDE has taken quite yet that I know of.
asmjit can JIT C++
Visual Studio can JIT C++/CLI (which isn't quite C++) (RMartinho corrects that VIsual Studio compiles C++/CLI to IL, and then JITs the IL. Tehcnically different.)
cling uses the clang fruntend and LLVM backend, which has a JIT code generation system.
R.Martinho has also reminded me that Microsoft Visual Studio already has this feature. http://msdn.microsoft.com/en-us/library/esaeyddf(v=vs.100).aspx If you "stop" the code, you can make changes, and it will apply those changes and resume execution.
There's an interesting project at http://runtimecompiledcplusplus.blogspot.co.uk/ that is working on this problem and looks like it might work for you; I haven't used it myself but it looks active if still a little raw. It uses the Visual Studio 2010 compiler.
You can't run C++ code without compiling. Minor syntactic differences between languages shouldn't be an issue so you shouldn't limit yourself to just one language.
I suggest you give Unity a chance; there's a fairly robust free version available. You can write scripts in C# (a language similar to C++), or UnityScript (somehting similar to JavaScript) or Boo (similar to Python) and you can test the results right away, without having to compile.
What about Edit and Continue in Visual Studio? In order to use it, you have to pause execution (either by breakpoint or Pause button), recompile and resume. Note, that you can edit the code while the program is running. I know you can't test the game live, but you don't have to reload resources etc. It's IDE integration makes it really easy and straightforward to use.
If you want changes to be visible live, though, consider using script language such as Lua. One of their purposes is what you want to achieve.
I've listed the options for runtime compilation of C++ code on the alternatives wiki page of Runtime Compiled C++.
From the sounds you may interested in either Recode or Alcanterea.
Organize your C++ game to use plugins, and add a feature to load a new (binary version of) plugin during the game.
Then, you could play your game, recompile a plugin, reload it (so invoke your dynamic linker at runtime), and continue playing.
It is not failproof, but it might usually work.
Of course you cannot unload a plugin which has some active call frame on the (or some thread's) call stack. I would suggest to avoid unloading old plugins...

C++ syntax highlighting for Visual Studio 2008?

I just want to see my own datatypes/functions/function parameters with a different color.
I have used Visual Assist X before, but it stopped working for some unknown reason. It doesn't color the custom functions or function parameters every time. Also, my trial time is over soon, and I am not going to buy something that doesn't work properly or whose most features I don't even use.
So, if there's any free syntax highlighting that colors all functions, etc. for Visual Studio 2008, that's what I'm looking for.
You can create a file(usertype.dat) containing any names, these will be colored differently.
You can read more about that here
Unfortunately you can't give your different types different colors from there but at least you can get your own types colored.
To color your own data structures, functions and parameters, a highlighter should know that they are your own data structures, functions and parameters. It means it should be able to parse C++ code. But, C++ code parsing is extremely hard task, so no one will do that just to highlight a couple of words. So, this may be just an associated feature of some powerful tool that definitely costs money.
Actually, it seems there are just some problems with your environment. I use Visual Assist X with Visual Studio 2003, 2005 and 2008 and it works like a charm!
I'd recommend proceeding with Visual Assist X if you are serious about MS VC++ programming. Actually, it is a must have tool as, say, ReSharper for CSharpers.
If you have the option to use Visual Studio 2010, there is Highlighterr, which changes the colors of classes, structs, macros and typedefs. There doesn’t appear to be a version for Visual Studio 2008, but what are you waiting for? ;-) C++0X awaits…

MSVC6: Breakpoint stops program

Using Microsoft Visual Studio 98, Microsoft Visual C++ 6.0 SP6
When running under the debugger, there's only one problem. If I pause the program and resume, everything's fine.
The problem? When I hit a breakpoint, my program stops. But not in a good way; execution halts, I'm thrown out of debug mode into edit mode. All's fine until a breakpoint is hit. And I know it's hitting the breakpoint - I see a flash of the little yellow arrow pointing at the right line of code, local variables in the inspect window and the call stack in that window. And then I'm staring at the editor.
This happens in all projects.
I've uninstalled and re-installed MSVC6. It didn't help.
I'm about to start over on a new PC; before I go that far, anyone know what I've done to this one?
Note: MSVC6 is not my choice, but there are reasons. It's the tool I work with. And, we get to target NT4, so given 2008 can't target NT4 and 2005 has issues with MFC and NT4, MSVC6 it is.
Stop beating on VC6. It's old. The STL was updated in 1996 from HP code written in 1994. C++ was ratified in 1998.
What is the code doing when you are breaking? Can you reduce the situation into a simple test. When I try that I usually find the cause. If you can do that so it still happens then I'll take a look at it for you. I too am unfortunate enough to use VC6 for my day to day work.
Visual C++ Express 2008 can't be used in certain situations.
The first thing I would check is if this project does the same thing on other machines. If not, it could be your box is heading south. If not it's the VC6 project itself.
Typically I get goofiness with the debugger when my program is doing something with the hardware, especially the video.
I would recommend turning off parts of your program until you figure out what part is causing this. If your program is small and not doing much it might be that the project is corrupted and needs to get rebuilt. Make a new project from scratch and put your files and settings back in by hand.
Is it specific to the app you're working on or do all breakpoints in any app break the debugger?
Is anything different if you attach the debugger manually after launching the app normally?
Is the device running out of memory and therefore gives up the ghost when it requires the additional memory to stop at the breakpoint?
Is the device running out of memory and therefore gives up the ghost when it requires the additional memory to stop at the breakpoint?
No, there's over a gig of RAM to go, and even more of virtual memory.
I haven't used MSVC6 in years, but I remember the debugger basically being a flaky piece of crap. Things like this would regularly happen for no apparent reason because it just didn't like your code that day.
In addition to the debugger being a flaky piece of crap, the rest of it was too.
It's STL implementation isn't threadsafe, it doesn't support very much of the C++ standard, and the IDE is sorely lacking in niceties.
I'm pretty sure you also just simply can't use any versions of the Platform SDK from the last 5 years because it's too old to grok them. Not a good thing.
You'd be mad to keep using it when there is Visual C++ Express 2008 which you can download for free.