About OpenCl solver

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

About OpenCl solver

Postby Julio Jerez » Tue Mar 16, 2021 1:56 pm

after researching all possible High Performance Computing option, I conclude that teh only one that is cross plaform enough is OpenCL.

there is also thing liek Vulkan, DX12, Cuda, and whatever it is that AMD is doing, but the all have ton of string attached to them. I really liked microsf Amp but the discontinued. so the only option left seems to be OpenCL.

I downloaded the Headers from Chronos: https://github.com/KhronosGroup/OpenCL-Headers
but those are only headers. The say I nee to get teh runtime library and drive for eth Platform.

Since my system is an Intel, I am trying to install the Intel SDK for Open CL
https://registrationcenter.intel.com/en/products/postregistration/?sn=C9B3-SGC89V54&Sequence=2040316&encema=Wg/bUFJY2qspv9ef8QA1f43AFD2QFSTVhekjP+AIeKnjrTQISFFfZTgeFu+8+wHC16gFDLRptfmHkh4ae7N7qw==&dnld=t&pass=yes
right out of the Setup I get the first disappointment.
Untitled.png
Untitled.png (41.85 KiB) Viewed 10649 times

It seem opencl for Intel is no free. they required licensing a compiler and seem quiet expensive.
is ther a way people has try around this?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: About OpenCl solver

Postby Julio Jerez » Tue Mar 16, 2021 3:27 pm

and is does no stop there, if I try to make a VS project using the vs intagration with VS2019
I get this error.

1>Preprocessing: Template.cl
1>Ignoring -TARGETOS option - not supported for 64-bit version of this tool
1>
1>Using build options: -I "C:\tmp\openclTest\CPUOpenCLProject1\CPUOpenCLProject1"
1>C:\tmp\openclTest\CPUOpenCLProject1\CPUOpenCLProject1\Template.cl : error CL: Failed to get platform id...: 0 (CL_SUCCESS)
1>Build failed!


about four year ago I had the same problem and the Intel people at the forum said my CPU did not support it, I knew tha was all BS, because this erro come fore the OpenCl compiler.
nwo I has a different CPU and I still have the same problem and teh Intel people has keep saying the same thing.

there is an app named clinfo that provide info about the system, when I runnit I get this inforomation

Microsoft Windows [Version 10.0.18363.1440]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\julio>cd C:\Users\julio\Downloads

C:\Users\julio\Downloads>cinfo
'cinfo' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\julio\Downloads>clinfo
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (3110.7)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_khr_d3d10_sharing cl_khr_d3d11_sharing cl_khr_dx9_media_sharing cl_amd_event_callback cl_amd_offline_devices
Platform Extensions function suffix AMD
Platform Host timer resolution 100ns

Platform Name AMD Accelerated Parallel Processing
Number of devices 1
Device Name Ellesmere
Device Vendor Advanced Micro Devices, Inc.
Device Vendor ID 0x1002
Device Version OpenCL 2.0 AMD-APP (3110.7)
Driver Version 3110.7
Device OpenCL C Version OpenCL C 2.0
Device Type GPU
Device Board Name (AMD) Radeon (TM) RX 480 Graphics
Device PCI-e ID (AMD) 0x67df


I suppose the real problem is that I have an amd card, maybe I nee to get teh AMD opencl SDK.
if this BS is like this, then this is not cross platform
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: About OpenCl solver

Postby Enclave » Wed Mar 17, 2021 9:30 am

Julio Jerez wrote:It seem opencl for Intel is no free. they required licensing a compiler and seem quiet expensive.
is ther a way people has try around this?


You may need to search the internet for an available version with an activation key.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: About OpenCl solver

Postby Dave Gravel » Wed Mar 17, 2021 9:37 am

The key is only for the intel compiler, But you can install it without the key and use visual studio.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: About OpenCl solver

Postby JoeJ » Thu Mar 18, 2021 7:27 pm

Not sure if you even need a full SDK.
Did not work with OCL for years, but looking up my project i see it only links to OpenCL.lib and uses the headers from Khronos. I have not installed any SDK on my system.
So you only need to get that lib, maybe this would work:

https://github.com/intel/clGPU/blob/mas ... OpenCL.lib

Though, you probably want it only for your (AMD?) GPU, so maybe from here: https://github.com/GPUOpen-LibrariesAnd ... K/releases

I can not find this on AMD dev websites, so the above is all that remained, it seems.
Also, in my application the (Ryzen)CPU is no longer available as an OCL device. It only works on GPU.
AFAIK, AMD dropped support on OpneCL. Also the great profiling tool CodeXL is no longer maintained (be sure to grab the latest version anyway).

In short: NV and AMD give a * on OCL, only Intel is still interested as it's OneAPI is based on SYCL and so OpenCL.
Plus: OpenCL 3.0 is a step back from 2.0, probably to have wider compatibility. IDK.

Although there is no alternative, it does not look good for OpenCL. :(

I think it's still a good choice for you, for those reasons:
* Much easier to use than compute shaders from any gfx API.
* But very easy to port to one of them (if you stick at OCL1.2, which you will becasue NV still boycotts CL2.0 in consumer GPU drivers.)

Limitations, in comparison to Vulkan compute:
* No indirect dispatch on 1.2. Meaning any kernel launch becomes a cycle of: Wait on GPU to sync dependencies and download the work size for the next kernel, then dispatch next kernel of that work size from CPU. (This totally *, but can be easily fixed when moving to gfx API)
* Not sure about subgroup intrinsics. I think they are there in form of extensions, but if you want to go there, then maybe just move to VK/DX12 anyway.


Maybe the better choice, considering OCL seems no longer that future proof, is OpenGL compute shaders. Here you have indirect dispatch, subgroup stuff, and using them with Vulkan probably needs changes only on API side. There is no real difference between OpenCL 1.2 kernels and compute shaders.
Have you tried this?
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: About OpenCl solver

Postby Dave Gravel » Thu Mar 18, 2021 10:37 pm

(Ryzen)CPU is no longer available as an OCL device

Yes, I have see the same thing with my ryzen 2700x. :(

The Intel runtime look to work good with my ryzen cpu.
I'm not sure if it is a stable solution and if it can continue to work with future update.
It look to work good for now.

OpenCL is surely at the end of his time, But the current version can surely give some good experiences.
Vulkan look good but it is not simple, In my mind when you use vulkan for something like this it is better to use vulkan for rendering too.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: About OpenCl solver

Postby FSA » Thu Mar 18, 2021 11:30 pm

(Ryzen)CPU is no longer available as an OCL device

What? Does that mean, 1 year old hardware won't be supported by OpenCL? I'm sorry but that would be huge bullsh*t for OpenCL.
User avatar
FSA
 
Posts: 318
Joined: Wed Dec 21, 2011 9:47 am

Re: About OpenCl solver

Postby FSA » Thu Mar 18, 2021 11:41 pm

Oh wow I just googled a bit...
Apple deprecated OpenCL, Khronos itself stated, that OpenCL driver development from other vendors has basically silenced, and it takes years until a new OpenCL standard gets actually implemented.
Nvidia did also ditch OpenCL, because of CUDA. AMD is on the way to fully deprecate it, only Intel is left. And they have other troubles right now.
So yeah, it looks like it's dying.
User avatar
FSA
 
Posts: 318
Joined: Wed Dec 21, 2011 9:47 am

Re: About OpenCl solver

Postby JoeJ » Thu Mar 18, 2021 11:55 pm

Dave Gravel wrote:Vulkan look good but it is not simple, In my mind when you use vulkan for something like this it is better to use vulkan for rendering too.

Yeah, and because that's so much effort, i would leave it to the users to make it work with their preferred APIs. Ofc. we would need some transpiler to port shaders. Not sure if such thing exists as some open source project.
Personally i use a C preprocessor to use same source for both CL and VK, though that's a bit ugly.

However. It seems there is no more reason to wait until some 'proper' GPU development comes up. Situation became only worse over the years. Whatever you choose, you won't like it.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: About OpenCl solver

Postby Julio Jerez » Fri Mar 19, 2021 11:48 am

yes I seem that OpenCL is in a state of disarray and fighting for survival.
but is also look like for most vendors it peek at version 1.2
so I will settle for using that version.

I manage to make the crate the skeleton class of the solver and make so that teh cmake script can add optinaly. I try most combination of setting and the seem to work.

in the end app select GPU solves it will add these define and link to the library
the define for open cl are these.
add_definitions(-D_D_NEWTON_OPENCL)
add_definitions(-DCL_TARGET_OPENCL_VERSION=120)

so far is jut use the default solver, but It did find the AMD context in my system even when using teh intel run time.
it will be nice if any one cat try is any one can try and see if is works.

on the opencl SDK set up, I do undertand when you mean Joe, but that is not what I was talking about. is that right now the onle vender that has a self consisting environment for development high performance computing is nvidia.
all other are more liek the pass US government even one is by himself and let biggest bully win

for example with the Khronos you can get header but no libraries, you have to go and find runtime library somewhere else.

I was thinking to add an environment variable whe the teh engine look for header and libraries, but so far the only vendor with the with be intel.
but since teh state of affair is so shaky right now I went teh Frankenstein method, I copied the headers Khronos and the runtime library for linking from Intel.
like this any user do no have to go a chase for the those external dyeing SDK for any vendor.
If is work we will keep it until amd, or nvidia decide to drop driver level support.

after we get some working, I assume that it will be easies to migrate to whatever is the replacement.
what I certainly do no what to do is gone the Dx12, Opengl or Vulkan route. I try that and to me is is ridiculous that amount of extra work need to circumvent the graphic.

anyway I think I now have an initialization so let us see where it takes us using opencl 1.2
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: About OpenCl solver

Postby Dave Gravel » Fri Mar 19, 2021 12:45 pm

it will be nice if any one cat try is any one can try and see if is works.


The initialization look to work for me.
It is hard to really say because I don't see debug message to know what runtime it using.

I see this info in the ImGUI "opencl (in progress)" and the demo look to run normally.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: About OpenCl solver

Postby Julio Jerez » Fri Mar 19, 2021 12:56 pm

I just added more initalization, please try again

one weird thing in that in my work computer it reports "NVIDIA CUDA".
sI suspect that nvidia opencl in just a translator or from OpenCl to cuda using a parcel generator on the flight. This is good, because if true, them Opencl for nvidia may not be too far behind native cuda.
unless the cynic on me till me that nvidia may delivery slow opencl kernels to make cuda look better.


I have read that some dev company is doing the reverse, from CUDA to HIP or whatever amd is calling their stuff these days.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: About OpenCl solver

Postby JoeJ » Fri Mar 19, 2021 1:32 pm

Julio Jerez wrote:the cynic on me till me that nvidia may delivery slow opencl kernels to make cuda look better.

I can only say NV OpenCL was 2 x faster than OpenGL compute for me ten years ago. Also, more recent tests showed Vulkan is faster than CL for both NV and AMD, with a difference of factor 1-2, which is expected from the missing indirect dispatch.
So it seems NV never throttled CL in favor of Cuda. They are only to blame for restricting CL2.0 to Quadro GPUs only.
but is also look like for most vendors it peek at version 1.2

Not quite - both AMD and Intel do support 2.0, only NV does not.
2.0 is beyond even DX12/VK, because here the GPU can generate work for itself without needing CPU (and so expensive sync.)
But that's probably too different and could not be ported easily, and i doubt it maps well to any GPU HW. So using 1.2 makes most sense anyways.
It's fine IMO. With OCL you can focus on development - with gfx APIs you constantly get lost in annoying API details.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: About OpenCl solver

Postby Julio Jerez » Fri Mar 19, 2021 3:24 pm

JoeJ wrote:Not quite - both AMD and Intel do support 2.0, only NV does not.
2.0 is beyond even DX12/VK, because here the GPU can generate work for itself without needing CPU (and so expensive sync.)

I take that. :D

another thing I read is that, apparently 2.0 support memory map for GPU to cpu, so that you do not need to copy the data.
That seems a huge feature, and when I run the initialization it does say it is opencl 2.0

I am not going to worry about that for now, I will focus in a vanilla 1.2 which seem white powerful
the after that we see if we can add vendor specific enhancements.
so far seem very good. so I will continue.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: About OpenCl solver

Postby JoeJ » Sat Mar 20, 2021 3:38 am

Julio Jerez wrote:another thing I read is that, apparently 2.0 support memory map for GPU to cpu, so that you do not need to copy the data.

Oh, never paid attention to this because i have no big data to transfer, so IDK.
But i know AMDs GCN has a memory range of 256 MB which can be addressed quickly from both GPU and CPU, and Vulkan exposes this while DX12 does not. (DX12 seems simpler overall, with less details.)

Now recently we got that 'resizeable bar' stuff with RDNA2 and newer Ryzen, which expands this to the whole video or main memory? And NV has enabled the feature too on some Ampere GPU and CPU combinations. Surely very interesting. Probably no extra work needed to get faster transfers.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 31 guests