This repo demonstrates how to use the ParallelReduce job to reduce an array of values to a single element.
Some examples of a parallel reduce are:
- Finding the min and max points in mesh to compute the bounding box of the mesh
- Summing a set of values
- Comupting the sum of the products of a set of values
To use this project, just copy-paste the contents of the ParallelReduce.cs file into your project.
The ParallelReduce.cs script depends on the following packages:
Package | Version | URI |
---|---|---|
Burst | 1.7.0 | com.unity.burst |
Jobs | 0.50.0-preview.8† | com.unity.jobs |
Mathematics | 1.2.5 | com.unity.mathematics |
† See Known Issues
If you also want to run the performance tests, you will need the additional packages:
Package | Version | URI |
---|---|---|
Performance testing API | 2.8.0-preview | com.unity.test-framework.performance |
There is currently an issue with the Jobs (0.50.0-preview.8) package which results in the following error when using IJobParallelForBatch
:
System.InvalidOperationException : Reflection data was not set up by an Initialize() call
The current work-around is to use Jobs version 0.11.0-preview.6.