Install AMD OpenCL CPU driver with an Nvidia graphic card - windows

I have seen this question many times but never found an answer for Windows.
I recently ported my CUDA code to OpenCL.
When testing with an ATI card, the Catalyst drivers contain a CPU OpenCL driver, hence I can run the OpenCL code on the CPU.
When testing with an NVIDIA card, there is no driver for the CPU.
Question is: how can I install (and deploy) a CPU driver when running with an Nvidia card?
Thanks a lot

To use OpenCL on CPU you don't need any driver, you only need OpenCL runtime that supports CPU, which (in case of AMD/ATI) is part of APP SDK. It could be installed no matter what GPU you have. Your end-users would also have to install the APP SDK: currently, there is no way to install OpenCL runtime only.
If you have Intel CPU, you better try Intel OpenCL SDK, which has separate installer. However, AMD APP SDK works on Intel CPUs quite well, but note vice versa.

Related

SyCL ComputeCpp: issues with the matrix_multiply SDK example

I just managed to install successfully the SyCL ComputeCpp + OpenCL (from CUDA) and running cmake to generate the samples VS2019 sln, successfully.
I've tried to run the matrix_multiply example ONLY, for now.
It ran successfully using the Intel FPGA emulator as a default device.
Changing the devices to the Device CPU worked well as well.
Choosing the host device, took ages without exiting.
When I tried to change the device to the nVidia, the GeForce GTX 1650 Ti.
I got this expection error from there ComputeCpp:RT0100, etc etc.
Googling a bit, I found I'd probably have to output the PTX instead of the SPIR.
So I regenerated the sln using -DCOMPUTECPP_BITCODE=ptx64
After doing that, the kernel ran successfully on the nVidia GPU.
My first question is: is that needed since nVidia does NOT support spir yet at the time of this writing, but only PTX?
However this broke the other devices, which are now reporting:
[ComputeCpp:RT0107] Failed to create program from binary
This happens now for all devices: Intel GPU, Device CPU, Device FPGA (While were formerly working)
Inspecting the .sycl I found now SYCL_matrix_multiply_cpp_bin_nvptx64[].
My question is: how to support nVidia with ptx and "normal" devices with spir altogether in the same exe? I did a menĂ¹ from which the user can choose to play with, but now it's working only for nVidia.
What am I doing wrong, please?
I would expect to be able to run the same .sycl code for all the devices despite it contains ptx or spir. How to manage for that?
EDIT: I just tried to retarget the bitcode to spirv64, since the computecpp_info told me all my devices are supposed to support it.
However, now no device is anymore working with that setting :-(

How to get 64-bit addressing, full RAM access using OpenCL with 2019 MacBook Pro 16" intel/amd

I have a 2019 MacBook Pro 16". It has an Intel Core i9, 8-core processor and an AMD Radeon Pro 5500M with 8 GB GPU RAM.
I have the laptop dual booting Mac OS 12.4 and Windows 11.
Running clinfo under Windows tells me essentially that the OpenCL support is version 2.0, and that the addressing is 64-bits, and the max allocatable memory is between 7-8 GB.
Running clinfo under Mac OS tells me that OpenCL support is version 1.2, that addressing is 32-bits little endian, and the max allocatable memory is about 2 GB.
I am guessing this means that any OpenCL code I run is then restricted to using 2GB because of the 32-bit addressing (I thought that limit was 4GB), but I am wondering a) is this true and b) if it is true, is there any way to enable OpenCL under Mac to use the full amount of GPU memory?
OpenCL support on macOS is not great and has not been updated/improved for almost a decade. It always maxes out at version 1.2 regardless of hardware.
I'm not sure how clinfo determines "max allocatable memory," but if this refers to CL_DEVICE_MAX_MEM_ALLOC_SIZE, this is not necessarily a hard limit and can be overly conservative at times. 32-bit addressing may introduce a hard limit though. I'd also experiment with allocating your memory as multiple buffers rather than one giant one.
For serious GPU programming on macOS, it's hard to recommend OpenCL these days - tooling and feature support on Apple's own Metal API is much better, but of course not source compatible with OpenCL and only available on Apple's own platforms. (OpenCL is now also explicitly deprecated on macOS.)

Using pytorch Cuda on MacBook Pro

I am using MacBook Pro (16-inch, 2019, macOS 10.15.5 (19F96))
GPU
AMD Radeon Pro 5300M
Intel UHD Graphics 630
I am trying to use Pytorch with Cuda on my mac.
All of the guides I saw assume that i have Nvidia graphic card.
I found this: https://github.com/pytorch/pytorch/issues/10657 issue, but it looks like I need to install ROCm, and according to their Supported Operating Systems, it only supports Linux.
Is it possible to run Pytorch on GPU using mac and AMD Graphic card?
No.
CUDA works only with supported NVidia GPUs, not with AMD GPUs.
There is an ongoing effort to support acceleration for AMD GPUs with PyTorch (via ROCm, which does not work on MacOS).
CUDA is a framework for GPU computing, that is developed by nVidia, for the nVidia GPUs. Also, the same goes for the CuDNN framework.
At the moment, you cannot use GPU acceleration with PyTorch with AMD GPU, i.e. without an nVidia GPU. The O.S. is not the problem, i.e. it doesn't matter that you have macOS. It is a matter of what GPU you have.
What you can do though, is that you can either purchase an external nVidia GPU or use some cluster. For example, Google Colab offers PyTorch compatibility.
PyTorch now supports training using Metal.
Announcement: https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/
To get started, install the latest nightly build of PyTorch: https://pytorch.org/get-started/locally/
Answer pre May 2022
Unfortunately, no GPU acceleration is available when using Pytorch on macOS. CUDA has not available on macOS for a while and it only runs on NVIDIA GPUs. AMDs equivalent library ROCm requires Linux.
If you are working with macOS 12.0 or later and would be willing to use TensorFlow instead, you can use the Mac optimized build of TensorFlow, which supports GPU training using Apple's own GPU acceleration library Metal.
Currently, you need Python 3.8 (<=3.7 and >=3.9 don't work) to run it. To install, run:
pip3 install tensorflow-macos
pip3 install tensorflow-metal
You may need to uninstall existing tensorflow distributions first or work in a virtual environment.
Then you can just
import tensorflow as tf
tf.test.is_gpu_available() # should return True
It will be possible in 4 months, around march 2022. See Soumith reply to this question on GitHub. https://github.com/pytorch/pytorch/issues/47702

Got Android Studio installation error

I am kinda new to Android Studio & stuff. So today, I was installing the Android Studio with the SDK Manager. All was going smooth until an error came up which says:
Unable to install Intel HAXM
Your CPU does not support required features (VT-x or SVM).
Unfortunately, your computer does not support hardware accelerated virtualization.
Here are some of your options:
Use a physical device for testing
Develop on a Windows/OSX computer with an Intel processor that
supports VT-x and NX
Develop on a Linux computer that supports VT-x or SVM
Use an Android Virtual Device based on an ARM system image (This
is 10x slower than hardware accelerated virtualization)
I've attached a pic of my system specs. Can someone please throw some light on this issue?
Thanks
It is because you had not intialize virtual technology in your device.You Need to go in BOOT Option before starting WINDOWS OS and enable VT-x from there>
The option of enabling Virtual technology is putted in different option depends on device manufacturer
Edit: Android Studio emulator won't run on Windows with an AMD processor. The error message is kind of misleading, as it suggests the problem is with your CPU. But it is within the troubleshoot message: "Windows/OSX computer with an Intel processor". Basicallly, that means it is not going to work properly in your current setup. Either try installing Linux and running Android Studio on that (which might come with its own issues), using a physical device for testing or use the slow ARM images.
You are using an AMD processor. SVM is AMD technology and VT-x is Intel technology. So you won't be able to get VT-x to run, but SVM might be possible.
As another poster had suggested, virtualization may have been disabled in the BIOS. There may be an option to enable virtualization. It does however seem to happen that virtualization is activated in the BIOS and Android-Studio does not recognize that. I have not figured out how to fix that either.
You could use the emulator with an ARM image, which will be very slow. Alternatively, you could use another emulator that is not integrated into Android-Studio.

Offline compilation for AMD and NVIDIA OpenCL Kernels without cards installed

I was trying to figure out a way to perform offline compilation of OpenCL kernels without installing Graphics cards. I have installed the SDK's.
Does anyone has any experience with compiling OpenCL Kernels without having the graphics cards installed for both any one of them NVIDIA or AMD.
I had asked a similar question on AMD forums
(http://devgurus.amd.com/message/1284379).
NVIDIA forums for long are in accessible so couldn't get any help from there.
Thanks
AMD has an OpenCL extension for compiling binaries for devices that are not present on the system. The extension is called cl_amd_offline_devices. Pass the property CL_CONTEXT_OFFLINE_DEVICES_AMD when creating a context and all of AMDs supported devices are reported and can be used to create binaries as if they were present on the system.
Check out their OpenCL programming guide at http://developer.amd.com/tools/hc/AMDAPPSDK/assets/AMD_Accelerated_Parallel_Processing_OpenCL_Programming_Guide.pdf for more info
No need to graphic card, you can compile OpenCL programs for CPU too. If you have Intel or AMD CPU this idea works. Download latest OpenCL SDK from corresponding manufacturer website and compile OpenCL program:
Intel OpenCL SDK
AMD APP

Resources