cuPrintf cuda function - cuda

I want to use the cuPrintf function, and I get it from SDK. In the readme file they write the following
Use The cuPrintf package consists of two device functions (i.e. called
from within a CUDA kernel) and three host functions (i.e. called from
within the host application). These are packaged in a single
cuPrintf.cu file, along with declarations included in a separate
cuPrintf.cuh header file. To use cuPrintf in your application, you
must do one of the following:
a) Either: Include the header-file cuPrintf.cuh at the top of your
device code, and add cuPrintf.cu to your makefile or build
command-line so that the file is included in your program.
b) Or: Directly “#include cuPrintf.cu” at the top of your device
code. In this case you should not add this file to your
makefile/build-command, and you should take care to only include it
once in your entire project.
I tried some ways but all of them give me error, ( fatal error C1083: Cannot open include file: 'cuPrintf.cuh': No such file or directory )
I put the 'cuPrintf.cu' in the header folder in the VB 2008, and
include but give me error, and change it to
cuPrintf.cuh but also don't work.
I put both files in the extension of the project , and include them
in the code , and also give me error.
Any suggestions about how to fix it, I need this function for my code.

I solved my error , by this way :
put both files ".cu & .cuh" in the same path of the project , and include "cuPrintf.cu" in the top of the code and delete the .cu file from the header
Hope this will help who face the same error

Related

Perl Cannot Find/Reload File

I have a submit.html file that prints calculations done in a file called Observation.pm. Observation.pm exists in the folder called project. However, when the script runs, these error are printed:
Error during compilation of submit.html:Attempt to reload project/Observation.pm aborted.Compilation failed in require at submit.html line 67.
Line 67 in submit.html is:
use project::Observation.pm;
For some reason, it cannot find the Observation.pm file.
I have tried deleting and adding the Observation.pm file again. I've also tried using
use lib /path/name/to/project/;
in submit.html.
Any ideas on why this is happening or how to fix it? Let me know if I left out some vital info of the problem, wasn't sure what was relevant.
Try to use: Observation::Attempt instead of Atempt and also use path to the .pm file
When you use project::Observation;, Perl looks in #INC directories, if it finds an appropriate module.
In your case (use lib '/path/name/to/project';), this means it looks for a module named /path/name/to/project/project/Observation.pm.
Note the double .../project/project/.... So the correct search path must include /path/name/to instead, e.g.
use lib /path/name/to;
or if you want/need to keep use lib '/path/name/to/project';, say
use Observation;
instead.
Also note #ChrisTurner's comment, don't add the .pm extension.

ns modification and compiling error

i am working on ns-allinone-2.35 . and i modified the aodv protocol that located on /ns-allinone-2.35/ns-2.35/aodv folder. i do make clean , then make, every thing is ok.
but i notice that no changing in the result.
and i notice that if i change all aodv code to comments, the TCL file will running even if delete the aodv.o.
can any one help to specify exactly where is the changing on ns-allinone-2.35? and from where the TCL file read the routing protocol?
»»
the TCL file will running even if delete the aodv.o
««
Files{.cc, .h, .o}, etc. in the ns-2.35/ folder are not used at simulation time. ( Exceptions : Some simulations can/will use some traffic files, e.g. from tcl/mobility/** ).
All functions from the c++ files (and tcl/lib/files*) are compiled into one file : 'ns'.
Files used by the executable 'ns' are the these only :
ns-allinone-2.35/{ lib/**, bin/tclsh8* }.
Changes : Be aware that ns2 speaks "otcl". And that all the (o)tcl functions in tcl/lib/ are also compiled into the executable 'ns'.
So may be your new function is missing in tcl/lib/{ files.tcl } ?

ANE Extension Context null

I am using FreshPlanet KeyboardSize ANE in my project. I have successfully added to my project but when I run
MeasureKeyboard.getInstance().setKeyboardAdjustNothing();
I get the following error.
ArgumentError: Error #3500: The extension context does not have a method with the name setKeyboardAdjustNothing.
at flash.external::ExtensionContext/_call()
at flash.external::ExtensionContext/call()
at com.freshplanet.ane.KeyboardSize::MeasureKeyboard/setKeyboardAdjustNothing()e
How can I fix this?
Thanks.
Make sure both your Application-app.xml from the src and from your bin-debug folder contain the NAME_OF_THE_EXTENSION_ID tag matching exactly what is being called in your ExtensionContext.createExtensionContext(NAME_OF_THE_EXTENSION_ID,null) inside the source code of the ANE. If they don't match you'll not be able to set the external context in the initialization. That should also match the alias from your RemoteClass descriptor before the class declaration. I hope it's helpful info.
In my case what happened was that MSVCR (Microsoft visual c++ redistribution) was missing which is required to run c++ code.
Because the code in the extension was not able to run, the app could not find any function included in the ANE.
Make sure the code of your ANE is able of running either by writing logs or by running some sample native code independently.

Failed to create shared library with wx and STL, "multiple definition" error?

I tried to build a shared library using wx and STL, and failed in an error of "multiple definition of". Please refer to:
https://code.google.com/p/gppanel/issues/detail?id=7
The declaration of wxPointListNode is not found in the sources. The suspicious lines are like these:
include/mathplot.h:85:WX_DECLARE_LIST(wxPoint, PointList);
include/mathplot.h:87:WX_DEFINE_LIST(PointList);
include/gpLineLayer.h:16:typedef std::deque<mpPointLayer*> mpPointList_t;
What the problem is?
Without the actual code this is just a guess, but I suspect that
include/mathplot.h:87:WX_DEFINE_LIST(PointList);
generates the full definition of PointList, including a non-templated method wxPointListNode::DeleteData. mathplot.h is included by all of the .cpp files (gpPanel.cpp, gpSeries.cpp, and baseData.cpp). Each cpp file is compiled into a .o file, so each has its own definition of DeleteData, and when you try to link the .o files together into lib/libgpPanel.so the linker issues the errors you're reporting.
The definition of the method needs to be in its own cpp file that's compiled and linked in.
All wxWidgets methods with DEFINE in their name expand into a definition of something and a definition can only be used once in a module, so it typically can't appear in a header file (unless you can guarantee that it's included by only a single source file). So just don't put it there.
Moreover, if this is your code, you should avoid using the legacy WX_DECLARE_LIST macro at all and just use std::list<> or std::vector<> instead. Or, if you really want to use only wx (which can only be important if you are targeting some embedded platform without good STL implementation), then use wxVector<>.

Custom module undefined functions

I am developing a custom module for my employer. The my_module.module fill got too big and unmanageable so I decided to separate related code into separate .inc files.
I then included those files in the following code:
function my_module_init(){
module_load_include('inc', 'my_module', 'questionnaire_nodetypes');
module_load_include('inc', 'my_module', 'questionnaire_config');
module_load_include('inc', 'my_module', 'email_friends');
}
My code continued to work for a while but I suddenly got a undefined function error for a function that was definitely present in questionnaire_config.inc. Other similar errors soon followed for other confirmed and existing function in the other included .inc files.
It was suggested to me to run the update.php script but this did not fix the problem. In fact, I got more undefined function errors.
There's no need to put those lines in a hook, just dump them straight into the top of the module file (I've been doing it for years and it's never caused an issue).
hook_init() doesn't get called for cached pages, so it's conceivable your files aren't being included when another (non-cached) part of the system is relying on the existence of those functions.