# Use GPU and not CPU for processing

**URL:** <https://discourse.processing.org/t/use-gpu-and-not-cpu-for-processing/40686>\
**Category:** Coding Questions\
**Created:** [January 23, 2023, 8:29am UTC](https://discourse.processing.org/t/use-gpu-and-not-cpu-for-processing/40686 "2023-01-23T08:29:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BBGiraffe](https://avatars.discourse-cdn.com/v4/letter/b/90db22/32.png) [@BBGiraffe](https://discourse.processing.org/u/BBGiraffe)\
**Post date:** [January 23, 2023, 8:29am UTC](https://discourse.processing.org/t/use-gpu-and-not-cpu-for-processing/40686/1 "2023-01-23T08:29:22Z")

</div>

I have a processing script that processes and plots millions of dots to picture, I’m creating many images at once and the script seems to drive the CPU to 100%. I have a separate, modern GPU that is sitting mostly idle. How can I get this script processed with GPU and not CPU as this seems like a more efficient way to process my script.

---

<div class="post-metadata">

**Author:** ![Mikey83](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mikey83/32/17956_2.png) [@Mikey83](https://discourse.processing.org/u/Mikey83)\
**Post date:** [January 23, 2023, 10:30am UTC](https://discourse.processing.org/t/use-gpu-and-not-cpu-for-processing/40686/2 "2023-01-23T10:30:30Z")

</div>

You’re going to want to look into GLSL, shading language, best you can do with processing and GPU is use P3D, if you can code shader language then you can run that in processing  
To use P3D use:

```auto
size(1000,1000,P3D);

```

as an example but it wont really help with millions of dots I dont think

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [January 23, 2023, 5:45pm UTC](https://discourse.processing.org/t/use-gpu-and-not-cpu-for-processing/40686/3 "2023-01-23T17:45:46Z")

</div>

Hi @BBGiraffe,

May I ask what algorithm is used to determine those dots. Are they just random?  
As @Mikey83 suggested you can possibly use a simple pixelshader for it an due to lack of a build-in random function you can use ie the gold noise algorithm …

Cheers  
— mnse
