openNI interferes with cvCreateCameraCapture() - exception

I am using opencv 2.3 on ubuntu 11.04. while compiling, for completeness, I'd set WITH_OPENNI=ON. (regret it now, because I dont plan to use a kinect soon, and openni is giving me headaches with normal opencv programs)
anyway, to test the opencv installation i compiled following code that shows me video from my laptop webcam:
#include <stdio.h>
#include <string.h>
#include "highgui.h"
#include "cv.h"
int main()
{
cvNamedWindow("Webcam",CV_WINDOW_AUTOSIZE);
CvCapture* capture=cvCaptureFromCAM(0);
IplImage* frame;
while(1)
{
frame=cvQueryFrame(capture);
if(!frame) break;
cvShowImage("Webcam",frame);
char c=cvWaitKey(33);
if(c==27) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Webcam");
}
the code complies correctly but gives the following error on execution:
OpenCV Error: Unspecified error (Failed to enumerate production trees: Can't create any node of the requested type!) in CvCapture_OpenNI, file /home/samarth/OpenCV-2.3.0/modules/highgui/src/cap_openni.cpp, line 188
terminate called after throwing an instance of 'cv::Exception'
what(): /home/samarth/OpenCV-2.3.0/modules/highgui/src/cap_openni.cpp:188: error: (-2) Failed to enumerate production trees: Can't create any node of the requested type! in function CvCapture_OpenNI
Aborted
has anybody faced the same problem? any idea to cure this would be highly appreciated.

This problem was fixed in OpenCV 2.3.1 release.
See following link for the details:
https://code.ros.org/trac/opencv/ticket/1237

Related

cudaErrorUnknown when calling cuda runtime or driver api

After heavy simulation that crashes my GPU, terminating the program and rebooting my computer, I cannot call any cuda api that runs correctly before rebooting.
nvidia-smi works well.
In my Ubuntu 20.04 computer, the CUDA11.6 and nvidia-driver 510.47.03 are installed.
The minimum codes for getting error in my computer are followings,
Driver api version
#include "cuda.h"
int main() {
CUresult result;
result = cuInit(0);
const char* pStr;
cuGetErrorName(result, &pStr);
if(result != CUDA_SUCCESS){
std::cerr << pStr << std::endl;
}
}
The compile command is,
nvcc a.cu -lcuda
and I got CUDA_ERROR_UNKNOWN.
Runtime api version,
#include <iostream>
int main() {
int n;
cudaError_t error = cudaGetDeviceCount(&n);
if(error){
std::cerr << cudaGetErrorName(error) << std::endl;
}
}
The compile command is,
nvcc a.cu
and I got cudaUnknownError.
Why I got this error ? Is this a problem of driver ?
looks like you trashed something (driver or cuda runtime) and you are not able to call any function related to cuda.
in my humble experience, I usually get these errors when my kernels runs for too long on a Windows machine and the Windows Display Driver Manager reset my GPU while i'm running the kernel.
Maybe you are experiencing some similiar issues on linux.
To fix this, have you tried to reset your GPU using the following bash command line ?
nvidia-smi --gpu-reset
Please also note that all CUDA errors are not recoverable and if the previous command doesn't work, you may reset your computer to fix the issue (or simply unload/reload the cuda driver).

cudaMallocManaged() issues on Nvidia p100

I am trying to compile and run the following code on an Nvidia P100. I'm running CentOS 6.9, Driver version 396.37 and CUDA-9.2. It appears that these driver/cuda versions are compatible.
#include <stdio.h>
#include <cuda_runtime_api.h>
int main(int argc, char *argv[])
{
// Declare variables
int * dimA = NULL; //{2,3};
cudaMallocManaged(&dimA, 2 * sizeof(float));
dimA[0] = 2;
dimA[1] = 3;
cudaDeviceSynchronize();
printf("The End\n");
return 0;
}
It fails with a segmentation fault. When I compile with nvcc -g -G src/get_p100_to_work.cu and run the core file (cuda-gdb ./a.out core.277512), I get
Reading symbols from ./a.out...done.
[New LWP 277512]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./a.out'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000000000040317d in main (argc=1, argv=0x7fff585da548) at src/get_p100_to_work.cu:71
71 dimA[0] = 2;
(cuda-gdb) bt full
#0 0x000000000040317d in main (argc=1, argv=0x7fff585da548) at src/get_p100_to_work.cu:71
dimA = 0x0
(cuda-gdb)
When I run this code on an NVidia K40, the code runs without error.
QUESTION :
How do I get my code to run on the P100? It seems from this tutorial, this code should run.
Previously, I had cloned an image of a GPU node with a 2 K40's in it. I then put that image on a node with 2 - P100's in it. I suspect that when installing the driver on the K40 node, there is a configuration specific to the graphics cards on the machine (which is makes sense). This configuration was not compatible with the P100. Since the driver on the P100 machine was basically corrupted, this would explain why my code failed so cataclysmically.
Solution : I ended up having to reinstall the driver and now it works.

bits/string3.h:82: warning: memset used with constant zero length parameter

This is my MCVE using MySQL C API:
#include <my_global.h>
#include <mysql.h>
int main()
{
mysql_init( NULL );
}
Compiling with gcc 4.9.3 -O3 -I /usr/include/mysql produces this warning:
/usr/lib64/mysql/libmysqlclient.a(ssl.cpp.o): In function `memset':
/usr/include/bits/string3.h:82: warning: memset used with constant zero length parameter;
this could be due to transposed parameters
Environment:
Using MySQL 5.7.13 Server and C API 6.1.6 on SLES 12 SP1 VM on XenServer.
My question:
Should I report it as a bug to MySQL or does anybody know how to remove this warning?
Update:
Because a comment mentioned I should play with the arguments in mysql_library_init() I updated the question to a more compact/minimal working example.
Update:
This warning appears while the link process! The compilation works fine.

Cannot compile Cuda 7.0 sample

I installed CUDA 7.0 as described here on Ubuntu 14.04. I look at matrix mul example, if I start executable file matrixMul that runs, but if I try to compile it gives me error on libraries.
i.e
user#Mars:~/Documenti/Bello/NVIDIA_CUDA-7.0_Samples/0_Simple/matrixMul$ nvcc matrixMul.cu
matrixMul.cu:36:30: fatal error: helper_functions.h: File o directory non esistente
#include <helper_functions.h>
^
compilation terminated.
The problem was caused by trying to compile the sample using nvcc without the correct compiler options, rather than with the supplied makefile. Using the makefile allowed the compilation to work successfully.

Problem with MySQL driver for unixODBC on Debian Lenny

On OpenSuse 11.2, I successfully compiled, linked, and ran the following code which installs a data source for a MySQL database with unixODBC:
#include <iostream>
#include <sql.h>
#include <sqlext.h>
#include <odbcinst.h>
/* Add a data source for the following MySQL db: db=testdb, username=test, password = test. */
void inst()
{
BOOL ret = SQLConfigDataSource(NULL, ODBC_ADD_DSN, "MySQL driver",
"DSN=mysource\0UID=test\0PWD=test\0DATABASE=testdb\0\0");
if (!ret) {
DWORD errCode;
char errBuf[SQL_MAX_MESSAGE_LENGTH];
WORD msgLen;
SQLInstallerError(1, &errCode, errBuf, SQL_MAX_MESSAGE_LENGTH, &msgLen);
std::cerr << errBuf << std::endl;
}
}
int main()
{
inst();
return 0;
}
With the same code on Debian Lenny, I have had problems. First, I compiled this code the following way:
c++ -o main main.cc -lodbc -lodbcinst -L/usr/lib/odbc -lmyodbc
It went ok. But when I attempted to run the resulting binary, I got a linker error which in fact was confirmed by typing ldd main:
libmyodbc3_r-3.51.15.so => not found
Although I correctly installed unixODBC and the associated MySQL driver (myodbc) on my host (Debian Lenny) the simplest way (i.e. via aptitude), I could not find this shared library.
I wrongly thought, well, I will create a symlink on /usr/lib/odbc/libmyodbc.so. Anyway now my program returns the following message:
General installer error
So I feel the file libmyodbc3_r-3.51.15.so is really missing.
Note: on Debian Lenny, the version of unixODBC is 2.2.11, and the version of MySQL is 5.0.51a
Anyone ever ran into such a situation ? Any help would be appreciated.
The option
-L/usr/lib/odbc
tells the compiler where to find the library for linking.
But the system doesn't know where to find the library when you run the executable.
You need to either statically link against libmyodbc, or tell the system where to find the library.
The first can be done by changing
-lmyodbc
to
-static -lmyodbc
The second can be done by editing /etc/ld.so.conf (or adding to /etc/ld.so.conf.d) and re-running ldconfig or by setting the LD_LIBRARY_PATH environment variable to include /usr/lib/odbc