Commit f0326c6a authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Merge branch '308-fix-opencl-clinvalidcommandqueueexception' into 'master'

Resolve "Fix OpenCL CLInvalidCommandQueueException"

See merge request grp-fidentis/analyst2!331
parents 54094c40 21cdc3ed
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@ inline struct DirectionInfo getDirection(Point3D lowerBound, Point3D upperBound,
__attribute__ ((reqd_work_group_size(WARP_GROUP_SIZE, 1, 1)))
kernel void calculateClosestIntersections(const int rayCount, const int maxLeafSize,
      const int smoothing, const int filter,
      global Point3D* origins, constant Vector3D* directions, // Ray direction
      global Point3D* origins, global Vector3D* directions, // Ray direction
      global MeshTriangle* triangles, // Mesh Triangles - triangle == 6 float3 values stored continuously
      constant Point3D* octreeBBox,
      global Point3D* octreeBBox,
      global int* indices, global unsigned int* triangleIndices, // Index mappings - nodes to octants and leaves to triangles
      global float8* closestIntersections){ // Results --> Everything is casted to floats in float8* type to avoid waste of space during alignment. There is a room for better representation

+0 −1
Original line number Diff line number Diff line
@@ -122,7 +122,6 @@ inline RayIntersection traverseOctree(const int rayCount, const int maxLeafSize,

    OctNode node = {t0, t1, 0};
    stack = put(stack, node);

    while(stack.head > STACK_CAP){
        node = peek(stack);
        stack = pop(stack);
+2 −2
Original line number Diff line number Diff line
@@ -15,9 +15,9 @@ import java.util.List;
 * @author Marek Horský
 */
public class PoissonReuseBenchmark {
    private static final int ITERATIONS = 20;
    private static final int ITERATIONS = 1000;
    private static final int ITERATION_OFFSET = 5; // First n iterations are ignored to account for power management OS scheduling
    private static final int SAMPLES_START = 5;
    private static final int SAMPLES_START = 400;
    private static final int SAMPLES_STEP = 0;
    private static final String PATH_MAIN = "C:\\Users\\marek\\Desktop\\FidentisFaces\\problem-scan\\00297_01_ECA.obj";

+4 −4
Original line number Diff line number Diff line
@@ -33,11 +33,11 @@ import java.util.stream.Stream;
 */
public class RayCastingBenchmark {
    private static final int COORDINATE_BOUND = 100;
    private static final int ITERATIONS = 50;
    private static final int RAY_COUNT = 100000;
    private static final int ITERATIONS = 1;
    private static final int RAY_COUNT = 400;
    private static final int ITERATION_OFFSET = 5; // First n iterations are ignored to account for power management OS scheduling
    private static final String PATH_MAIN = "C:\\Users\\marek\\Desktop\\FidentisFaces\\multi-scan\\average-boy-17-20\\average_boy_17-20.obj";
    private static final Random RANDOM = new Random();
    private static final String PATH_MAIN = "C:\\Users\\marek\\Desktop\\FidentisFaces\\problem-scan\\00297_01_ECA.obj";
    private static final Random RANDOM = new Random(0);
    private static final RayIntersectionOpenCLConfig CONFIG = new RayIntersectionOpenCLConfig(MeshTriangle.Smoothing.NONE, false);

    /**
+4 −3
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ public class PoissonDiskSubSamplingGPU extends PoissonDiskSubSampling {
        if (clContext == null) {
            initialize();
        }
        this.rayIntersectionOpenCLServices = new RayIntersectionOpenCLServices(clContext,
                new RayIntersectionOpenCLConfig(smoothing, false));
        long time = Instant.now().toEpochMilli();
        this.octree.build(facets);
        System.out.println(("Octree build: " + (Instant.now().toEpochMilli() - time)));
@@ -134,6 +136,7 @@ public class PoissonDiskSubSamplingGPU extends PoissonDiskSubSampling {
        } while (iterationCount <= MIN_PROJECTION_ITERATIONS || !validSamples.isEmpty());
        System.out.println("Ray casting time: " + time);
        setRealSamples(samples.size());
        rayIntersectionOpenCLServices.release();
        return new ArrayList<>(samples);
    }

@@ -149,7 +152,7 @@ public class PoissonDiskSubSamplingGPU extends PoissonDiskSubSampling {
        projectorBuffer.release();
        directionBuffer.release();
        octree.release();
        rayIntersectionOpenCLServices.release();
        //rayIntersectionOpenCLServices.release();
        queue.release();
        OpenCLServices.release(clContext);
    }
@@ -158,8 +161,6 @@ public class PoissonDiskSubSamplingGPU extends PoissonDiskSubSampling {
        this.clContext = OpenCLServices.createContext();
        this.queue = clContext.getMaxFlopsDevice().createCommandQueue();
        this.octree = OctreeOpenCL.create(clContext);
        this.rayIntersectionOpenCLServices = new RayIntersectionOpenCLServices(clContext,
                new RayIntersectionOpenCLConfig(smoothing, false));
        this.meshCentroidBuffer = BufferFactory.getVoxelPointBuffer(clContext);
        this.projectorBuffer = BufferFactory.getVoxelPointBuffer(clContext);
        this.directionBuffer = BufferFactory.getVoxelVectorBuffer(clContext);