I'm a newbie in OpenCL.
From yesterday, I'm trying to use OpenCL for parallel programming instead of CUDA which is more familiar for me and experienced before.
Now I have NVIDIA GTX 580 GPU, Ubuntu Linux 12.04 OS and CUDA SDK 4.1 (already installed before because of CUDA programming).
In CUDA SDK folder, Some OpenCL header file and library are already included.
So I just downloaded OpenCL examples from NVIDIA's Developer zone.
(Here is the link! https://developer.nvidia.com/opencl)
And I'm tried to compile some example by myself, but I couldn't.
I make Makefile by using -I I added path of header file, but I don't know how to added library path and what is the name of OpenCL library.
I searched on Google but someone said file named libOpenCL.so, but I only have OpenCL.lib.
Is Someone can help me?
Install
The following steps have been tested on Ubuntu 12.04.
Download the Intel SDK for Linux.
Extract the RPM:
$ tar zxvf intel_sdk_for_ocl_applications_2012_x64.tgz
Convert to .deb and install:
$ fakeroot alien --to-deb intel_ocl_sdk_2012_x64.rpm
$ sudo dpkg -i intel-ocl-sdk_2.0-31361_amd64.deb
Ensure that libOpenCL.so has been installed to /usr/lib/.
$ sudo ln -s /usr/lib64/libOpenCL.so /usr/lib/libOpenCL.so
$ sudo ldconfig
Compile
Simply link to the OpenCL library during compilation:
$ g++ main.cpp -lOpenCL
$ ./a.out
Related
Having an issue on migrating a Qt project from RPi4 to NVIDIA Jetson Nano. We wanted to migrate our project to Jetson Nano to improve image processing performance.
The qt dependency of our project is >= 5.11. But Jetson Nano uses Ubuntu 18.04.4 and it has qt5-default package pre-installed in it (in my understanding some system files use it). And this qt5-default packages version is 5.9.5.
I tried to downgrade my qt dependency, but every change made lead to harder to fix issue.
I tried to upgrade default qt5 version but couldn't find any similar guidance. The guides/questions already exists are about x86 etc. environment. Couldn't find any ARM based solution. The qt downloads doesn't give any buildable for ARM env (or I can't find them). The official documents only talks about cross-compiling.
What should I do to overcome this issue? Thanks in advance.
Okay I finally was able to successfully compile QT 5.12.9 on the Nano itself (no cross compilation).
The steps I did:
git clone https://code.qt.io/qt/qt5.git
cd qt5
git checkout 5.12.9
Then
git submodule update --init --recursive
cd ~
mkdir qt5-build
cd qt5-build
Configure and build
../qt5/configure -nomake examples -nomake tests -skip qtwebengine
make
sudo make install
Make took like nearly a whole day to compile all sources. Also I had some compilation errors before. However after skipping webengine and not building the tests and examples in ./configure I was finally able to sucessfully make it.
I am getting an error while trying to install Rserve 1.8.6. I can successfully install 1.7.3 from CRAN. This is on Mac OS High Sierra.
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [forward] Error 1
make: *** [all] Error 2
ERROR: compilation failed for package ‘Rserve’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rserve’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rserve’
The downloaded source packages are in
‘/private/var/folders/v7/hyxrfmk94p1_03gdrm27fnxncy3vq1/T/RtmpFHKNMe/downloaded_packages’
This worked for me (MacOS):
In terminal:
brew install openssl
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
I'm running Mac OS 10.15 Catalina, I've spent 2 days trying to fix this same problem, scouring the internet for help. I finally managed it by cobbling together solutions from a few different sources.
The key thing I was missing was that Mac OS ships with its own version of openssl which it thinks is superior to anything else you can find. It is wrong. What you need to do is go and download the latest version of openssl, install that, then export THAT library to your library path variable. Here are the steps I took with openssl 1.1.1:
Get the version number for the latest version of openssl from the source (https://www.openssl.org/source/) and then manually install it directly where it's supposed to go:
cd /usr/local/src
If you're getting "No such file or directory", make it:
cd /usr/local && mkdir src && cd src
Download openssl using curl (shown) or using the link above to the source code (make sure you put the file in the directory you just made in the previous step):
curl --remote-name https://www.openssl.org/source/openssl-1.1.1f.tar.gz
Extract and cd in:
tar -xzvf openssl-1.1.1f.tar.gz
cd openssl-1.1.1f
Compile and install (these are the 64 bit Mac OS instructions. Refer to the openssl documentation for 32 bit and other OS instructions):
./Configure darwin64-x86_64-cc shared enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp --openssldir=/usr/local/ssl/macos-x86_64
make depend
sudo make install
This created a new openssl folder so when you export the library path you have to feed it the right openssl folder:
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl#1.1/lib/
Hope that helps you if you haven't figured it out yet, and anyone else in the future who is ready to chuck their computer across the room, like I was.
I am trying to compile Blochlibs-1.2 libraries on Ubuntu 15.04 (32 bit). Ihave successfully compiled fftw3 and mpi libraries which all ended up in /usr/local/lib and usr/local/include. mpicc is in the path and LD_LIBRARY_PATH is set correctly. when I run configure like this:
./configure --with-mpi=/usr/local --with-fftw=/usr/local
then i get this error:
checking for functioning MPI library ... configure: error: couldn't
find mpi library for --with-mpi
How does the configure file search for the libraries?
Thanks,
Z
I am having a really hard time getting OpenCL working in Trusty or Mint 17. Im using ppa:xorg-edgers, tried updates and even nvidia-340.
sudo apt-get install nvidia-331 nvidia-331-uvm nvidia-cuda-toolkit nvidia-cuda-dev opencl-headers nvidia-opencl-dev clinfo
Rebooting and then
babak#ASUS-G750JH:~$ clinfo
clinfo: /usr/lib/x86_64-linux-gnu/libOpenCL.so.1: no version information available (required by clinfo)
I: ICD loader reports no usable platforms
I have tried this on two Intel based systems with Nvidia GPU's a desktop with a GeForce 280, and a laptop with GeForce 780M with a physically disabled Optimus by the Asus, it only has the Nvidia GPU. A G750JH.
Has anyone done this successfully? Can I roll back and remove the PPA and use the default repo's, would that even make a difference?
For the xorg-edgers nvidia-346 packages, I get it working by installing also the nvidia-opencl-icd-346 package and its dependency ocl-icd-libopencl1.
Im not 100% sure what the issue was, but seems that the ppa:xorg-edgers, may have an issue. Whatever is broken the process below fixes the issue and results in both Cuda and OpenCL working with Nvidia and Ubuntu 14.04 x64
sudo apt-get install dkms linux-headers-generic fakeroot build-essential
sudo apt-get remove --purge nvidia-*
sudo apt-get purge nvidia*
sudo ./NVIDIA-Linux-x86_64-346.47.run
Downloaded from Nvidia, 340.xx supports legacy cards
Yes for all options
sudo reboot chmod +x cuda-repo-ubuntu1404_6.5-14_amd64.deb
dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
chmod +x cuda_6.5.14_linux_64.run sudo ./cuda_6.5.14_linux_64.run
Choose option to leave out the GPU Driver
sudo apt-get update
sudo apt-get install cuda
add to bottom of bashrc
export CUDA_HOME=/usr/local/cuda-6.5
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64
export GLPATH=/usr/lib/
PATH=${CUDA_HOME}/bin:${PATH}
export PATH
sudo reboot
./ocore_601_OpenCL_v20 --devices
Downloaded from http://stanford.edu/~yutongz/ocores/
Outputs:
OpenCL compatible devices:
name: GeForce GTX 780M | platformId: 0 deviceId: 0
cd ~/NVIDIA_CUDA-6.5_Samples/1_Utilities/deviceQuery
make
./deviceQuery
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 780M"
......
Truncated
I'm trying to configure my Qt for Embedded Linux with a virtual framebuffer according to these instructions. From the Qt for Embedded source folder, I'm trying:
./configure -embedded -opensource -confirm-license -verbose -qvfb
make
I get the following error which prevents me from doing make install:
.obj/release-shared-emb-x86/qtextcodec.o: In function `setup()':
qtextcodec.cpp:(.text+0x23cc): undefined reference to `QIconvCodec::QIconvCodec()'
collect2: ld returned 1 exit status
make[1]: *** [../../lib/libQtCore.so.4.8.4] Error 1
make[1]: Leaving directory `/home/cstjean/qt/src/corelib'
make: *** [sub-corelib-all-ordered] Error 2
If I do:
./configure -embedded -opensource -confirm-license -verbose -qvfb
make -no-iconv
sudo make install -no-iconv
...This works. But when I go into QtCreator, Tools > Options > Build & Run > Qt Versions, I try to select qmake for Qt Embedded (for me it's in /home/cstjean/qt/bin/qmake) and it tells me:
Qt version is not properly installed, please run make install
I've tried googling this like crazy. There are a lot of suggestions to download various libraries, which I've tried to no avail, but perhaps I'm missing something because this is a pretty fresh installation of Ubuntu I'm using.
Thanks.
I solved this problem by installing Gnome and starting over from scratch for my Qt Embedded for Linux installation.
I googled gnome for ubuntu 12.04 and found these instructions. You'll have to see which version of Ubuntu you have and search for that of course. You can see which version you have by typing into a command line:
lsb_release -a
Once I had gnome installed, I restarted my computer and signed in using Gnome.
Then I completely uninstalled and removed all traces of Qt Embedded:
cd yourQtEmbeddedDir
sudo make uninstall
cd ..
rm -r yourQtEmbeddedDir sourceFileTarYouHadDownloaded.tar.gz
I redownloaded the source file tar for Qt Embedded for Linux (from here) and proceeded to install according to these instructions after extracting the source files from the tar:
./configure -embedded -opensource -confirm-license -verbose -qvfb
make
sudo make install
Now, if you tell QtCreator about qmake from this installation, then QtCreator will no longer complain about a bad installation! Ta da!
Note: If you're attempting to the do the Virtual Framebuffer business too, then this is not the end of the road. You need to have Qt for X11 installed as well in order to compile qvfb.
Long story short: You need Gnome if you're trying to install Qt Embedded for Linux with a Virtual Framebuffer on Ubuntu!