How to use CUTThread in CUDA - gpu

I am trying to run my own multi-gpu example, and I am following the NVIDIA's example. However, I cannot find where CUTThread is defined and then the compiler says:
error: ‘CUTThread’ was not declared in this scope

The short answer is 'dont use cutThread at all'. It comes from the SDK, not the toolkit, and it not intended for general use - NVIDIA don't document any of these function, nor do they guarantee that they either work, or won't change in definition or function from release to release. If you are interested in multiGPU computing, have a look at this answer to a very recent Stackoverflow question.

Related

Best pratice on using `tf.compat.v1.metrics.auc`?

I try to migrate my code from tf1.* to tf2, while in tf2 doc it says that tf.compat.v1.metrics.auc is deprecated because "The value of AUC returned by this may race with the update". This statement is vague to me. Does it mean that it can't be used in multithreading context? If not, in what situation can I use this function?
tf.compat.v1.metrics.auc has been moved under tf.keras.
As mentioned in the error message itself you can start using tf.keras.metrics.AUC in Tf2.
There are some changes in hyper parameters in the updated version, details with the example can be found in the above mentioned document.

Is there any good tutoria or reference for writing code with Magma?

Currently I am trying to use Magma to do matrix operation on GPU, however, I found few documents about it. The only thing I can refer to is its testing program and the online generated document(here), which is not convenient to use. And the user guide seems outdated.
If you look here, getri and potri are supported.

User-specified function in mpfit

I have been an IDL programmer for sometime now and looking to transition to Python. I find that MPFIT's IDL version exists in Python. However, I am looking for MPFITFUN version in Python (http://www.physics.wisc.edu/~craigm/idl/down/mpfitfun.pro) or something similar.
Basically, I am looking for a Python function that takes a user-defined function and uses like Levenberg-Marquardt least-squared fit (like MPFIT).
Thanks,
There are fitting functions built into SciPy but I do not know of any which account for uncertainties in data as MPFITFUN does.
I have found Sherpa to be an excellent modeling and fitting package for Python which accounts for uncertainties and replaces MPFITFUN: http://cxc.harvard.edu/contrib/sherpa/
Since Sherpa is produced by astronomers it has a lot of built in astrophysical models, but you can build your own function to fit with Sherpa's Levenberg-Marquardt, Nelder-Mead or Monte Carlo algorithms. I used the template from the pysherpa blog:
http://pysherpa.blogspot.com/2010/06/user-defined-sherpa-model-types-using.html
mpfit.py is available from https://code.google.com/p/astrolibpy/ and an older version hosted at http://cars.uchicago.edu/software/python/mpfit.html.
A good alternative is lmfit: https://pypi.python.org/pypi/lmfit/, https://github.com/lmfit/lmfit-py, http://lmfit.github.io//lmfit-py/
I accidentally found that there also exists the MPFITEXPR in Python. Here's the link to the code. You can also download it via Astrolibpy project.
Link:
https://code.google.com/p/astrolibpy/source/browse/mpfit/mpfitexpr.py?r=3545675a0662392e3e09c88beaf275c9e7881cf6

How do I find solutions for deprecated code?

I'm new to Mac programming. When I open sample projects, I often get 'deprecated' code warnings during a build. I'd like to fix these and get a clean build using XCode 4.
When Apple deprecates something, how do I find out why it was deprecated?
More importantly, how do I find out what is the 'new' correct way to implement the deprecated task?
For example, I'm seeing deprecation warnings for: QTMovieSizeDidChangeNotification, writeWithBackupToFile, documentForFileName, shouldCreateUI, setShowPanels, QTMovieCurrentSizeAttribute, and many others.
Look up the method in the documentation - they show the deprecated methods and tell you what the preferred methods are.
For example writeWithBackupToFile is clearly marked as deprecated and shows that writeSafelyToURL:ofType:forSaveOperation:error: should be used instead.
Same with shouldCreateUI which shows that either openUntitledDocumentAndDisplay:error: or openDocumentWithContentsOfURL:display:error: should be used instead.
Also, read the other methods in the documentation - you'll find things that do what you need. For example you list QTMovieSizeDidChangeNotification as being deprecated (in QuickTime 7.6.3). Right above it in the documentation you can see QTMovieNaturalSizeDidChangeNotification which has been available since QuickTime 7.6.3). Use that instead.
Look for the deprecated things in the documentation. Usually, there's a note that suggests what to use instead.
For example, the documentation for writeWithBackupToFile:ofType:saveOperation: says:
This method is called by action methods to save document contents to a file. (Deprecated in Mac OS X v10.4. Use writeSafelyToURL:ofType:forSaveOperation:error: instead.)
Search the documentation for that method/function/constant. It should list there what to use instead, or at least bring up a class that obviously has other methods that do something similar.

Where can I browse the sourcecode for libc online (like doxygen)

Sometimes I want to look up the implementations of functions in the stdlib, I've downloaded the sourcecode, but it's quite messy.
Just greping is not really suitable because of the many hits.
Does anyone know a webpage doxygen style that has the documentation.
The same goes for the linux kernel.
Thanks
You should check if your distribution is using the vanilla GLIBC or the EGLIBC fork (Debian and Ubuntu have switched to EGLIBC EDIT: they switched back around 2014).
Anyway, the repository browser for GLIBC is at http://sourceware.org/git/?p=glibc.git
http://code.woboq.org/userspace/glibc/, posted by #guruz below, is a good alternative.
The source is a bit complicated by the presence of multiple versions of the same files.
How about this for libc documentation? And perhaps this for the kernel? There is also Google Code search; here is an example search.
More on Google Code Search You can enter search queries like this: package:linux-2.6 malloc for any references to malloc in the linux-2.6 kernel.
Edit: Google Code search is now shut down. But you can access the git repo at http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git and it has search as well.
You can try http://code.woboq.org/userspace/glibc/
It has nice navigation/hilighting similar to an IDE.
To help navigate the source to glibc, perhaps try something like ctags or cscope?
Note: I get dumber every time I look at the glibc source, so please be careful! :)
If you are using GNU C (glibc), the functions (beyond the GNU extensions) follow the POSIX standard as far as their arguments, implementation, failure and return values. If you want to peek under the hood of static members, you'll have to look at the code.
Every push (that I can remember) to try and adopt something like Doxygen for glibc was rejected for the following reasons:
Redundant, POSIX already documents almost everything thats exposed, as well as man and info pages.
Too much work initially
More work for maintainers
As far as the kernel goes, Linux does use a system very similar to Doxygen called Kerneldoc.
You can also get actual Doxygen-generated docs from http://fossies.org/dox/glibc.