GPU support

Forums: 

Sup OpenCASCADE,

I'm an inventor/researcher coming to OpenCASCADE for modelling and meshing, and I am looking for a tool that would be able to run 100% on GPU, or even TPUs (tensor processing unit). I'm building something that needs high performance(AI/ML), and that something shouldn't query CPU at all because querying CPU slows down the processing by 10-400 times due to request travel time.

The plan is to use python CadQuery (which would be by me optimized for high performance and GPU-only runtime), which under the hood queries OpenCASCADE. While I can optimize CadQuery, I don't know if OpenCASCADE would be so easy to optimize.

So, could OpenCASCADE work entirely on Nvidia's GPUs? If not, how much optimization is necessary to make OpenCASCADE work 100% GPU on modules that CadQuery takes (modelling, meshing, STEP export, basic render)?

Thanks everyone, MRiabov

gkv311 n's picture

The question is formulated in a confusing way. Could GPU run entirely OpenCASCADE without involving CPU? Or Blender application? Or entire Linux?

GPUs do not replace CPUs in modern computers - they solve different tasks. GPUs are good at massive parallel execution of relatively simple and small algorithms on large amounts of data, while CPUs are more efficient at general-purpose tasks. Where algorithm is too complex or should be executed on small amount of data - GPUs will not be loaded and will execute task with the same or even slower time.

CAD kernel performs quite complex algorithms and could barely benefit from modern GPUs architectures. Moreover, they demand high accuracy calculations, hence relay on floating point operations with double precision (and even this might not be enough!), while GPUs are more focused on single precision.

Only particular algorithms naturally benefit from GPU utilization - like rendering. Still, visualization is not only rendering, and it shares tasks between CPU and GPU. Even with theoretically beautiful, but unreachable Zero Driver Overhead tricks, real applications do not display just static scenes, they need more complex algorithms.

So, coming back to the question, one would need to suggest and implement some new algorithms in OCCT that could benefit from GPU architecture. And this should be local to specific algorithms rather than done to everything at once, as CAD kernel is a very huge beast. And when we talk about optimization - moving algorithms to GPU is only one way to get performance, and probably most difficult one. Optimizations of algorithms done on CPU might also give considerable speedup.

Maksym Riabov's picture

Thank you.
>Only particular algorithms naturally benefit from GPU utilization - like rendering.
But is it? Why would something like feature creation (i.e. extrude), meshing, or exporting to various file formats not be able to be executed on GPUs? Why would line creation not benefit from GPU? Why wouldn't faces and everything else be rendered via GPU?

There are novel libraries and languages like Mojo and Google JAX that have native accelerator-driven speedup. Essentially, all parts of the language (even more so in Jax), can be "vectorized" and put onto tensor accelerators.

I would need it either way, and it seems I would need an internal, at least a very simple CAD (kernel) which would support basic shape creation.

What parts of OCCT do I have to look into to replicate modelling with extrusions, holes, chamfers and filets, and export into STEP? If you could show me at least parts of the codebase that would be neat.

Thanks in advance.