clGetPlatformIDs error -1001 when called in PostgreSQL UDF - postgresql

I'm trying to write an OpenCL function that would be executed inside PostgreSQL. To do this i create DLL from my OpenCL code and link it to postgres using User-Defined Function mechanism. Everything goes well until clGetPlatformIDs is called. Function returns error -1001, which I read that indicates problem with finding OpenCL drivers.
I've tried to compile the same code(i had to remove some postgres magic) to exe and runed it with success - all platforms were found correctly, so I assume that i have correctly set up SDK and drivers.
I am runing PostgreSQL 9.1 on windows 7 x64. I am also using Nvidia CUDA SDK 4.2 with Visual Studio 2010 and running my code on GeForce GTS 450.

It's MSFT's problem with Windows, Services, GPUs, Security and device drivers.
You can't run PostgreSQL as a service on Windows AND see any GPUs. You are hitting Session O Isolation which does NOT allow any 'graphics' device access from a Windows Service. You can start PostgreSQL as a process (not a service) or put the server on Linux.
See http://www.scribd.com/doc/58343489/Windows-Session-0-Isolation-Impact-on-GPU-as-Service
Also there are other important reasons to run on Linux, as Windows will want to reboot your GPU if the screen is not accessed before the timeout period. See
http://msdn.microsoft.com/en-us/library/windows/hardware/ff570088%28v=vs.85%29.aspx
NVida have a non-graphics GPU device driver for specific Tesla cards on Windows. These cards don't have any video output. So they aren't considered to be graphics device drivers.

Maybe the libraries try to locate the SDK using some environment-variables and the environment is not inherited inside the PostegreSQL context.
So try to dump the environment from your two codes and check if any OpenCL/Cuda variables is available in your standalone program and missing in your PostegreSQL UDF.

Related

Visual Studio Code on Windows server 2008

Can I install Visual Studio Code on Windows server 2008 ?
I am a developer but I sent the information to my administrators and they told me that the setup file crashes after launched
I get seput file from hee https://code.visualstudio.com/download
procesor: Intel(R) Xeon(R) Gold 6142 CPU # 2.60Ghz - 2.59 GHz
RAM: 8 GB
64-bit
virtual machine
1 CPU - 2 cores
Windows Server 2008
First time answering here so bare with my vintage reply formatting. (also pardon that i couldn't capture screen due to server is on a intranet that not accessible on this device causing a long reply)
Being a unfortunate fellow that need to work on legacy Systems and Application frequently, i happen to have a fresh 2008R2 server recently setup by my team's Server Admin with following specs:
processor: Intel(R) Xeon(R) Gold 5220 CPU # 2.20Ghz - 2.19 GHz ,
OS: Windows Server 2008R2 x64 ,
RAM: 8GB
The versions that is able to install was 1.70.3,which is the same version that is the last supporting versions for Windows 7 as well,if you happen to need to work on devices using that OS version.
although i'm uncertain whether it is a VM or not, i'd like to point out a few more things that your question did not cover but need to consider:
The installer version (System setup vs User Setup)
aside from the x64 |x86 | ARM installer differences, as you've not mentioned which versions of the build and which exact setup installer you sent to your admin, i've first replied which build version successfully installed on 2008R2, which as of writing the latest build was 1.73.0 and on run,it pop up a error message as follow regardless of System/User Setup:
This Program does not support the version of windows your computer is running.
in our current case that we want specific previous versions installer, VScode FAQ on previous versions have a URL lists that enables you to download a specific build version of your preferred setup. For my case (and also refer below to exactly why this one), i've go for System setup, and i know the aprox. supporting version was ~1.70.0, so i used the link as below and replace the {version} to start:
https://update.code.visualstudio.com/{version}/win32-x64/stable
Active Domain, Multiple user sessions etc.
Per VSCode requirements page stated,
VS Code does not support multiple simultaneous users using the software on the same machine, including shared virtual desktop
infrastructure machines or a pooled Windows/Linux Virtual Desktop host
pool.
as im not sure do you work solo or do have fellow colleagues to code on the server at the same time, you might need to reconsider to install using user or System setup.
if your intentions are to use exclusively on a specific AD account, then user setup should probably be good enough.
however, if the intentions was to setup say a shared Remote desktop connections on the VM that allows multiple RDC sessions simultaneously for coding,programming etc., so you intend to install a system setup to allow all users on said server to be able to use VScode, then you might run into the problem the VScode requirements stated it does not support.
in addition, as i was remote connected as administrator , when using a 1.70.2 user setup ,a different warning message as follow was thrown:
This user Installer is not meant to be run as Administrator. If you would like to install VS Code for all users in this system, download the system Installer instead.Are you sure you want to continue?
as the installer itself also checks with the operator on this matter, your admin may have skipped on the exact reasons why the install failed and just told you the installer crashed.
if you absolutely need VScode to run on the server but can't install for reasons, the last resort (aside from going for alternatives like notepad++) is to Setup a Portable Mode builds on your own workstation/devices first, then upload the package to the server and use it from there.
i wouldn't go into too much detail in that as this reply already span for a starwars trilogy length but keep in mind, version limitations still apply, and whatever add-ons you need, you need to download them first before bundle it into the package to upload and run on your server.
Anyone that is a System admin or infrastructure architects , do correct me on my novice understanding on Server settings etc. as although i'm primarily a programmer, i did end up touching a lot more things that i'm not specialized into over the few years of vendor career work so there bound to be incorrect/inaccurate concepts i spilled. cheers.

run a matlab script on a remote server

I have ssh access to a remote linux server and no admin rights. The server does not have matlab installed and I need to run a few matlab scripts. Are there any ways by which I can run these scripts on the server ? I read a few links saying to download the matlab compiler or runtime but they do not have detailed instructions on how to proceed and even less so pertaining to remote servers.
Generally there are three options
install MATLAB (it is available for Linux but you need to have admin rights..)
box your scripts as distributables with the Application Compiler (as #UnbearableLigthness already mentioned). You will need to install the MATLAB Runtime on your Linux server to run those applications. However, you can package the runtime in the application (bulletpoint 3).
create C code with the MATLAB Coder and compile it on your Linux server. This requires no installation but does not support all functions (e.g. most constrained optimization algorithms are not supported)

Deploying linux CUDA app

I've compiled a cu program on my laptop, using NVIDIA CUDA 5 toolkit. A very basic interface, using only terminal output. Then I went on to test how it runs on my desktop PC (both have Ubuntu 12.04 LTS installed).
On the desktop PC I get this error message:
error while loading shared libraries: libcudart.so.5.0: cannot open shared object file: No such file or directory
Ok, I get it, some libs are not installed. But do I really need to install CUDA toolkit on every PC where I'd want my compiled code to run?
To deploy a CUDA runtime API application on linux you only need to do two things:
Make sure that the machine in question has a CUDA compatible card and a minimum driver version which matches the CUDA Toolkit you used to build the application (you can find information regarding both of these in the release notes of the toolkit)
Distribute the runtime library (so cudart.so) that you built the application against with the executable. If you used any other libraries from the toolkit (like CUBLAS, CUFFT, CUSPARSE, etc) you need to inlcude those too. The CUDA runtime library is versioned and you have to have the libraries which match the toolkit you are building with. You may need to use the LD_LIBRARY_PATH environment variable to ensure that the correct versions of the libraries are found by the link loader. Often a simple shell script which acts the canonical application, settings LD_LIBRARY_PATH variable and running the built executable is the best way to do this.
If you get those two things right, it should just work.

How to debug CUDA using eclipse Nsight with only one GPU

I'm getting an error: "all cuda devices are used for display and cannot be used while debugging"
(Using Ubuntu)
Is there ANY way to use Nsight eclipse with only one GPU for debugging?
I have seen solutions like
"sudo service lightdm stop"
to kill X but that kills Nsight eclipse too so what's the point?
Update: Since it is not possible to debug with the same GPU that runs X, I have to ask: How does one go about using ANOTHER computer in his home network to "remotely" access Ubuntu in such a way that the X desktop rendering will be performed by the Guest computer while letting the host GPU run the debugger?
In general, it's not supported to debug on the same GPU that is hosting an X display. From the nsight getting started guide: "A GPU that is running X11 (on Linux) or Aqua (on Mac) cannot be used to debug a CUDA application and will be hidden from the application ran in the debugger. Such GPU can still be used for profiling GPU applications. "
I believe there is actually different behavior amongst different window managers, however. I have a laptop with Quadro1000M and RHEL 6.2 (with GNOME), with CUDA 5.0, and I am able to get into the debugger in nsight EE (Project...Build Project followed by Run...Debug). At that point I can step through and set breakpoints in host code. And if I run the code to completion I get proper output. However, you still can't debug device code. If you set a breakpoint in the device code (and hit that breakpoint), you will hang the X session.
EDIT: CUDA 5.5 and beyond now support the ability to debug on a single cc3.5 or higher GPU.
It seems that you can use CUDA 5.5 to debug CUDA programs in a machine with only one GPU.
See section 1.7.3.2. CUDA-GDB of CUDA_Toolkit_Release_Notes
Another approach which might work is to use the onboard video output for the display.
That way you use the onboard graphics for the display and the GPU for debugging.
For this you have to:
Go to BIOS and change the primary display adapter to "On-Board" (this varies from manufacturer to manufacturer)
Physically connect you display to the on-board display output feed
Restart and then run Nsight
If you are using a system with no on-board graphics, then you are out of luck!
This guy here has been able to get it up and running in Windows with Visual studio and Nsight plugin.
P.S. You would probably need to edit your xorg.conf to make X use onboard graphics instead of your Nvidia GPU.

Install device driver silently on Windows XP

Is there a way to programmatically install device driver silently without cat file and without connecting the device on Windows Xp?
I'm using DriverPackageInstall function from Windows Driver Kit. And I can install driver only if device is attached. In other case I get an error: ERROR_NO_SUCH_DEVINST. But that method works fine with Windows Vista.
Another problem is warning dialog that asks user to continue or stop installation because cat file is missing . It shows on both OSes.
Any ideas?
You're not going to get past the signing prompt, as this is baked pretty far into windows, but there is a tool in the DDK called devinst that works well for device installations.
There's Source Code included with it.
The only way to avoid any UI interaction caused by your driver being unsigned is to hackishly preinstall the driver by modifying the registry directly.
Yes, it can be done. You'd have to modify the ACLs on the HKLM\System\CurrentControlSet\Enum registry key run as SYSTEM (by installing yourself as a service or using Sysinternals psexec -s), and add all the registry keys which Windows device installation would usually add - on your own. This will only work if you can predict precisely what your device's Device Instance ID would be -- e.g. in case of a USB device, the precise port it'd be connected to etc.
This is hacky, but the result would be the device being essentially "preinstalled". It'll be a lot of work, and it'll break on Windows Vista.
Microsoft really wants you to go the WHQL way on Windows XP, sorry :(