Can't compile Cuda samples on macbook pro 2010 [duplicate] - c++

I am trying to install CUDA on my Mac Pro (15-inch, Mid 2009 with GPU GeForce 9400M).
I have installed from https://developer.nvidia.com/cuda-downloads the toolkit.
nvcc --version returns: ... Cuda compilation tools, release 7.5, V7.5.19
I have installed directly the driver from the package, then from http://www.nvidia.com/object/mac-driver-archive.html. Then from System Preferences > CUDA Preferences, I can see CUDA Driver Version: 7.5.25 (though the update 6.5.51 is proposed (?)).
I can compile a sample (0_Simple/asyncAPI). When I launch it, I get:
[./asyncAPI] - Starting...
CUDA error at ../../common/inc/helper_cuda.h:1111
code=35(cudaErrorInsufficientDriver)
"cudaGetDeviceCount(&device_count)"
Why this error??

The CUDA 7 release cycle removed support for compute capability 1.x devices on all platforms. This includes your Geforce 9400M.
The last version with support of those devices was CUDA 6.5. You will need to work out what XCode version will work with that CUDA toolkit and your OS version and install that instead.
[This answer assembled from comments as a community wiki entry to get this question off the unanswered queue for the CUDA tag].

Related

Why does Abaqus not find my c++ compiler?

I need to use uMat and user subroutines in Abaqus.
I installed Abaqus 2020, Visual Studio 2019, Intel oneApi Base Toolkit and Intel oneApi HPC Toolkit (in this order). After successfully linking the Fortran Compiler (Intel Fortran Compiler 2021.4) with VS19 (setting all the path variables and editing the abaqus2020.bat and the abaqus_v6.env) I started Abaqus Command (as admin) and used the command abaqus verify -user .. it PASSED right away.
My main problem is: if I plug in "abaqus info=system" everything is fine except the C++ Compiler.
C++ Compiler: Unable to locate or determine the version of a C++ compiler on this
system. If a C++ compiler is installed on this system, please load vcvars64.bat
file before running Abaqus
I tried:
different versions of VS
different OS
different Processor
calling the vcvars64.bat in abaqus2020.bat
Installing third party c++ compilers (MinGW)
My current setup:
Processor: AMD Ryzen 5 3600
RAM: 32 GB DDR4 3200
Graphics: MSI NVidea Geforce GTX 1660 Ti
OS: Windows 11
Linker Version: Microsoft Incremental Linker Version 14.29.30137.0
Fortran Compiler: Intel Fortran Compiler 2021.4 MPI MS-MPI 9.0.12497.11
Error Message

Device memory allocation fails on WSL2

I am trying to run a simple c++ program, with Cuda Thrust functions, on WSL2. It seems that program fails in runtime to allocate device memory. I use Thrust with Microsoft visual studio all the time, and I don’t get any errors.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(proj LANGUAGES CXX CUDA)
add_executable(proj
proj.cu
)
proj.cu:
#include<thrust/host_vector.h>
#include<thrust/device_vector.h>
#include<thrust/fill.h>
int main()
{
//thrust::host_vector<int> h_vec(10);
//thrust::fill(h_vec.begin(), h_vec.end(), 1);
thrust::device_vector<int> d_vec(10);
//thrust::fill(d_vec.begin(), d_vec.end(), 1);
return 1;
}
output:
terminate called after throwing an instance of 'thrust::system::system_error'
what(): get_max_shared_memory_per_block :failed to cudaGetDevice: unknown error
Aborted (core dumped)
If I comment the device_vector line, and use the host vector instead, it runs with no errors.
Additional info:
GeForce GTX 950M
Windows 11 Home. build 22000.51.
WSL2: Ubuntu-18.04
Cuda compilation tools, release 9.1, V9.1.85
Before I post the question, I had already seen the instructions in here , and both downloaded and installed the CUDA driver for WSL, and joined the windows insider program and upgraded to windows 11 build. It did not work though.
But I also had Ubuntu 18.04 installed. I think it was installing Ubuntu 20.4 instead that made the program run without errors in the end!
So, this is what I did to solve this:
-installed Ubuntu 20.04 from Microsoft store (It asked me to download and run a WSL fix first, which I did)
-In powershell, I removed Ubuntu 18.04
wsl --unregister Ubuntu-18.04
Replace Ubuntu-18.04 with the name of your distribution. You can get its name in powershell by
wsl --list
-installed cmake and g++-9 (gcc-9 was already installed)
-downloaded the cuda toolkit using the instructions in here
Then
cmake -DCMAKE_CUDA_COMPILER=/usr/local/cuda-11.0/bin/nvcc ..
make
./proj

Getting OpenCL to work on Linux laptop with Optimus technology

I have an installation of Kubuntu 13.10 on my laptop which has an Nvidia GT555m with optimus technology. I am having some trouble getting my C++ code with OpenCL to compile.
The error I keep getting is Cannot find -lOpenCL. Doing a quick search with the GNU find utility gives me the following:
/usr/lib32/nvidia-319/libOpenCL.so.1
/usr/lib32/nvidia-319/libOpenCL.so
/usr/lib32/nvidia-319/libOpenCL.so.1.0
/usr/lib32/nvidia-319/libOpenCL.so.1.0.0
/usr/lib/x86_64-linux-gnu/libOpenCL.so
/usr/lib/nvidia-319/libOpenCL.so.1
/usr/lib/nvidia-319/libOpenCL.so
/usr/lib/nvidia-319/libOpenCL.so.1.0
/usr/lib/nvidia-319/libOpenCL.so.1.0.0
I have the following OpenCL development packages installed:
opencl-headers
nvidia-opencl-dev
I also tried the utility clinfo to see if I get any information, but I get the following error:
clinfo: error while loading shared libraries: libOpenCL.so.1: cannot open shared object file: No such file or directory
Does anyone have any experience setting up a Linux development environment with OpenCL on their optimus laptops?
I was under the impression that I do not need to do anything fancy to get this working.
EDIT: Ok it seems the reason I was not managing to compile was because I was mixing up headers and libraries. Using the following compiles my code well:
g++ -std=c++11 -I /usr/local/cuda-5.5/include vadd.cpp -L /usr/lib/nvidia-331 -lOpenCL
I am getting another error during runtime now (but at least I managed to compile!). The error is as follows:
ERROR: clGetPlatformIDs
-1001
From doing some research this means I probably do not have the ICD portion of nvidias toolkit installed? What I cannot understand is - where to find it!
You should install the Nvidia Cuda SDK. It contains OpenCL development libraries and includes.
You don't need development packages or libraries, (OpenCL is already there, and working, just giving you a runtime error, ICD is present). What you need is a platform ready to execute the OpenCL code, so a GPU + a driver.
You need to install the propietary driver of nVIDIA: Either by using the Ubuntu tools, or by installing the package nvidia-current.
Maybe you have to install bublebee. A library to use Cuda on Nvidia cards with optimus technology.
I do not use Kubuntu yet I got it working under Mageia release 6 Linux so I guess it should be pretty similar. In my case there were Intel and Nvidia (GeForce GTX 980M) graphic cards together in my laptop. My intention was to get running only OpenCL compiled code without any set up of Xorg graphical server.
So, as advised above by DarkZeros I did it by using only a proprietary nvidia driver (in my case downloaded from Nvidia page). Then under root user:
./NVIDIA-Linux-x86_64-375.39.run --no-opengl-files
It asked me if I wanted to modify my Xorg configuration - I said "NO". This delivered nvidia kernel modules. Next, I modified /etc/modules to let the Linux know that it should load them at start up of system (this might be different on Kubuntu)
[root#localhost ~]# cat /etc/modules
nvidia
nvidia-uvm
nvidia-drm
nvidia-modeset
and that was really it. Reboot your system and loading of modules should automatically also create correct nvidia device files under a /dev directory.
[root#localhost ~]# ls /dev/nvidia*
/dev/nvidia0 /dev/nvidiactl /dev/nvidia-uvm /dev/nvidia-uvm-tools
I've got an inspiration from [ftp://download.nvidia.com/XFree86/Linux-x86/295.59/README/optimus.html][1]

How to get OpenGL-3 headers(C/C++) in linux (with nvidia driver)

My SO is OpenSuse version 12.2 (x86_64) Mantis, with KDE desktop.
I have currently the NVidia driver (319) installed from the repository. 3D acceleration work and the driver seem to support OpenGL 4.3.
I am trying to programme a simple OpenGL sample (just a triangle in a glut windows), but I am unable because GL/gl.h is outdated: the current header is the mesa with openGL 1.3, which does nos support glCreateShader, glAttachShader...
I have tryed $ sudo find / -name gl3.h (openGL 3.1 and further should include this header) but it does not return any result, so I suppose Nvidia driver does not include library/headers.
My question is: Where can I get the GL/gl.h for the installed NVidia driver? Onyone has got this same problem and solve it?
P.S.
To install the NVidia driver, I just installed the driver from the NVidia repository for opensuse 12.2 (http://download.nvidia.com/opensuse/12.2/) (with Yast)
I have installed:
nvidia-computeG03 (NVIDIA driver for computing with GPGPU)
nvidia-gfxG03-kmp-desktop (NVIDIA graphics driver kernel module for GForce 8xxx and newer GPUs)
x11-video-nvidiaG03 (NVIDIA graphics driver for GeForce 8xxx and newer GPUx)
The correct way to access the newer features is via the GL extension mechanism. You are fine with mesa's GL.h. What you need is a current version of glext.h (which does come with the nivida drivers, iirc, but can also be found on the official opengl site). YOu then would have to query a function pointer for any function you plan to call, on your platform probably via glXGetProcAddress().
A more convenient way is to use an OpenGL loader library like glew, which will do all this for you.
Note that you could, in theory, #define GL_GLEXT_PROTOTYPES before including glext.h and directly call the functions. This is likely to work with the nvidia driver (and some others on your platform), but not guaranteed to work by any spec. And it is never going to work on other platforms, like Windows.

"Parse issue: Unknown type name" error after upgrading XCode

After I upgraded my Mac OS X to Mountain Lion (all the way from Snow Leopard) and XCode 5 (all the way from XCode 3.2) I can no longer build a C++ project that I used to build in XCode successfully. I get loads of errors now all saying "Parse issue: Unknown type name *" for different objects. I tried an older version of XCode (4.6) and set the SDK to Mac OS X 10.7. This problem was solved but not using the latest version of XCode caused other problems.
To be specific, the errors (at least the first ones) seem to be related to Carbon graphic library. I don't know if that matters. I know that Carbon is somehow outdated but an official release of the application I'm extending runs on Mac OS 10.8 so I wonder why I can't build the code on 10.8.
What can be the cause of this error? The code is big and is not written by me so changing it is not an option. I really need to build it on XCode 5 or else I should downgrade my OS!
Several things that have been long deprecated in Carbon were finally removed in the Mac OS X 10.7 SDK.
You will need the Mac OS X 10.6 SDK to build your project. Apple stopped automatically including older SDKs with newer versions of Xcode but you can download older Xcode versions (from Apple's Developer site) and one of them...maybe Xcode 4.3 or so...will have the 10.6 SDK.
In order to use an older SDK with a newer Xcode, you must install it manually. The correct location is:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
Also note, any upgrade to Xcode (such as an update downloaded from the App Store) will obliterate your manually-installed SDKs. I recommend archiving the ones you need somewhere else so you can replace them as needed.