replacing CUT_CHECK_ERROR and CUT_DEVICE_INIT from cutil.h - c++

I recently came across code that includes calls to the functions CUDA_SAFE_CALL, CUT_CHECK_ERROR and CUT_DEVICE_INIT. [note, my question is a general one regarding these kinds of function calls, so I'm not copying the code which is irrelevant here.]
After getting errors on these 3 functions calls, I found that they belong to cutil.h which is no longer a supported library (was used only for SDK examples).
I've found a solution for CUDA_SAFE_CALL which seems to work, here: What is the canonical way to check for errors using the CUDA runtime API?
However, haven't found yet a solution for the other two functions- CUT_CHECK_ERROR and CUT_DEVICE_INIT.
Do you know of anything that can replace these functions specifically and cutil's functions in general?
Don't know if this is relevant - but I'm using CUDA v 6.0, Visual Studio 2010 and windows 7.

You can find replacements in the current CUDA samples. This will require some programming ability on your part, the replacements are not exact drop-ins.
Or you can download a previous cuda SDK package (e.g. CUDA 4.2) which contains those functions, and build the necessary libraries under your current toolchain. You should then be able to link against the function directly for a drop-in replacement.

Related

Runtime compatibility for library packaging

I want to package a library as a NuGet native package. This question is not specific to a way in which the packaged lib/dll/pdb/includes are distributed; but to be specific, I am looking at CoApp scripts (I wish there was something better I could link to), and I got an impression that there are too many different build targets, obtained combinatorially. I am trying to come up with a more or less minimal set of targets that is usable by applications that depend on the package. There are the following mostly orthogonal axes for build targets:
32 bit vs 64 bit. Obviously, this is legit.
Dynamic vs static builds. This is also sensible.
Debug vs. Release build. This also makes perfect sense, as debug builds reference the debug runtime (libcmtd.lib or msvcdrtd.lib) and the release builds reference the static runtime (libcmtd.lib or msvcdrtd.lib). Makes sense to include these to avoid a default library conflict.
The above are unquestionably good axes. The next one is questionable, although present in many examples:
_cdecl vs _stdcall vs __fastcall vs __thiscall. I think this makes little sense. The calling conventions would be supported for this particular library regardless of other linked libraries. Besides, variable arguments are for _cdecl only in Win32, and also 64 bit calling conventions are different anyway. My understanding is that anything I select will do, as long as header files declare a calling conventions compatible with the platform. Microsoft runtime libraries are not supplied for different calling conventions in any case.
And the next one I am not sure how to handle. Again, the examples declare
libraries build by different toolsets, which come with different Visual Studio versions: from v100 (v10.0, VS 2010) to vs140 (v14.0, VS 2015). My main question is, how compatible are the runtime libraries across different Visual C++ libraries? A problem here is we are using also other toolsets (Intel C++ is an example), and these usually have no corresponding packaging cases in CoApp, while being compatible with Microsoft runtimes.
I want to avoid packaging for a particular toolset. How possible is that, provided the code compiles with the oldest vesrion and also not using any newer runtime functions (e. g., v110 being the lowest supported version)? I am worried about two main things here (sorry, another numbered list starts here):
If I compile a static library with VS 2012 (provided bithood, staticity and debugness match), will I be able to link against it in VS2013 (its libcmt[d].lib)?
Under same conditions, will I be able to link against it in VS2010?
Same two questions, but speaking of a shared, DLL runtime?
Same questions, but taking into account runtime library defined exceptions that might be thrown by the library: will e. g. std exceptions be compatible up and down the version chain of the compilers, provided I compile the library with RTTI enabled?
More generally, is there a runtime compatibility matrix provided by Microsoft?
And if any other numbered list points, I'd like to hear that too.

How can I get the boost numeric bindings?

I have a file that needs to use boost numeric bindings's library. How can I get that binding library?
The following link seems not able to work anymore. The zipped file is corrupted.
http://mathema.tician.de/dl/software/boost-numeric-bindings/
And I hope I could use it in Window and Visual Studio tool.
I have a file that needs to use boost numeric bindings's library. How can I get that binding library?
You can grab the sources of the current version via
svn co http://svn.boost.org/svn/boost/sandbox/numeric_bindings
The version from http://mathema.tician.de/dl/software/boost-numeric-bindings/ is an older version with a different interface. You can grab the sources of that older version via
svn co http://svn.boost.org/svn/boost/sandbox/numeric_bindings-v1
And I hope I could use it in Window and Visual Studio tool.
You need a blas/lapack library in addition to the bindings. For windows, Intel MKL, AMD's ACML, clapack and atlas used to work, last time I checked. (You only need one of these, but note that atlas only implements blas and a small subset of lapack). These libraries have widely different performance and license conditions, but they all implement the same interface (more or less).
In general, the people at http://lists.boost.org/mailman/listinfo.cgi/ublas seem to be helpful, if you try to use the bindings (or ublas) and run into problems. But I'm not sure if any of them checks here at stackoverflow for potential users that ran into problems.

What is an alternative to including sys/times.h on windows?

Background
I am trying to compile some code on windows that has previously been compiled on QNX. According to this SO Question and this SO Question, I can resolve this issue by simply removing the include statements for sys/times.h. When I remove the includes, I get a bunch of errors saying that variables have not been defined within the scope. I assume this is because I have removed the include call.
Question
What is an alternative to using sys/times.h in the code so I can use it on windows?
Attempted Solutions
Download & install cygwin to compile code - I cannot download cygwin due to network restrictions. I would prefer not to have to download cygwin on my home network
Here's how one project solved the problem:
https://code.google.com/p/madp-win/source/browse/src/include/sys/times.h?r=4ef496e2071896b295262c89eb36a8b3d7656bae
They use various includes available on Windows to fill in most of it, and define the rest themselves. You may have to dig in the codebase a bit if you want to see the implementations for the other two functions - note that the library is LGPL.
According to the questions you linked sys/times.h is only supported in cygwin and not in MinGW. They also indicate that if you can't use cygwin your only recourse is to rewrite the calls to use a standard Windows API instead, and remove the include of sys/times.h.

using freeglut instead of GLUT

I am learning OpenGL with the help of tutorials found online. Many of them use GLUT library, even though it is generally recommended to use freeglut instead. How will replacing GLUT header file with freeglut header affect the compilation ? Is such a simple replacement possible ? Are there many differences in terms of syntax, function names and usage ?
As mentioned by Andon, replacing the header will do next to nothing. The FreeGLUT about page has a good description of the what and why (http://freeglut.sourceforge.net/index.php).
Why not to use GLUT, from the above link:
The original GLUT library seems to have been abandoned with the most
recent version (3.7) dating back to August 1998. Its license does not
allow anyone to distribute modified library code. This would be OK, if
not for the fact that GLUT is getting old and really needs
improvement. Also, GLUT's license is incompatible with some software
distributions (e.g., XFree86).
As for the syntax and function names, if your code currently compiles fine with GLUT, it should compile fine with FreeGLUT. You may need to tell the compiler to use/link against FreeGLUT instead of GLUT (and where to find it).
A quick Google search produced this result (using FreeGLUT), might be useful... http://peon-developments.blogspot.com.au/2011/04/creating-opengl-window-with-freeglut-in.html

c++ profiling of the g++ based application with libraries

I'm trying to find performance problems inside melt framework and especially with affine transformations.
I've tried 3 profilers: gprof, Zoom and GooglePerfomanceTools.
I've compiled all code with disabled optimizations and explicitly removed any inline functions changing it by ordinary functions.
But all of this profilers getting me unresolved function names in a Call Graph. In the true is that the most of these functions are the most time consuming.
So the question is what is the correct procedure to profile g++ based application with libraries
Thanks,
you need to compile your program with debugging info enabled (which I assume you did, but mentioning it nonetheless), install debug enabled versions of your dependency libraries, and link your program against them.
in debian based linux environments, they are usually named like the original library, with a -dbg suffix. for example, libxml2-dbg.
hope this helps.