The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 9587ac67 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

add simple javaCL test, which fails on os x and windows 10

parent 4892ea13
......@@ -8,7 +8,6 @@ import java.util.function.BiFunction;
import org.vadere.simulator.models.potential.timeCostFunction.loading.IPedestrianLoadingStrategy;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.scenario.Agent;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography;
/**
......
......@@ -14,6 +14,6 @@ public class JGaussianFilter extends GaussianFilter {
@Override
public void filterImage() {
outputMatrix = Convolution.convolve(inputMatrix, kernel, matrixWidth, matrixHeight, kernelWidth);
outputMatrix = Convolution.convolveSeperate(inputMatrix, kernel, kernel, matrixWidth, matrixHeight, kernelWidth);
}
}
......@@ -2,6 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.state.attributes.processor.AttributesPedestrianDensityGaussianProcessor;
import org.vadere.state.attributes.processor.AttributesProcessor;
/**
* @author Mario Teixeira Parente
......@@ -19,4 +20,13 @@ public class PedestrianDensityGaussianProcessor extends PedestrianDensityProcess
super.init(manager);
}
@Override
public AttributesProcessor getAttributes() {
if(super.getAttributes() == null) {
setAttributes(new AttributesPedestrianDensityGaussianProcessor());
}
return super.getAttributes();
}
}
......@@ -2,6 +2,8 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.models.density.IGaussianFilter;
import org.vadere.simulator.models.potential.timeCostFunction.loading.IPedestrianLoadingStrategy;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.geometry.shapes.VPoint;
/**
......@@ -35,37 +37,35 @@ public class PointDensityGaussianAlgorithm extends PointDensityAlgorithm {
@Override
public double getDensity(final VPoint pos, final SimulationState state) {
// if (state.getStep() > this.lastStep) {
// // obstacle will not change so we do it once.
// if (!this.filteredObstacles && this.isObstacleDensity) {
// this.obstacleFilter = IGaussianFilter.create(
// state.getTopography(),
// this.scale,
// this.standDev);
// this.obstacleFilter.filterImage();
// this.filteredObstacles = true;
// }
//
// this.pedestrianFilter = IGaussianFilter.create(
// state.getTopography().getBounds(),
// state.getTopography().getElements(Pedestrian.class),
// this.scale,
// this.standDev,
// state.getTopography().getAttributesPedestrian(),
// IPedestrianLoadingStrategy.create());
// this.pedestrianFilter.filterImage();
//
// this.lastStep = state.getStep();
// }
//
// double density = 0.0;
// if (this.isObstacleDensity)
// density = this.obstacleFilter.getFilteredValue(pos.x, pos.y);
//
// density += this.pedestrianFilter.getFilteredValue(pos.x, pos.y);
//
// return density;
return 0.0; // TODO: uncomment above but wait until Bene fixed the OpenCL bug
if (state.getStep() > this.lastStep) {
// obstacle will not change so we do it once.
if (!this.filteredObstacles && this.isObstacleDensity) {
this.obstacleFilter = IGaussianFilter.create(
state.getTopography(),
this.scale,
this.standDev);
this.obstacleFilter.filterImage();
this.filteredObstacles = true;
}
this.pedestrianFilter = IGaussianFilter.create(
state.getTopography().getBounds(),
state.getTopography().getElements(Pedestrian.class),
this.scale,
this.standDev,
state.getTopography().getAttributesPedestrian(),
IPedestrianLoadingStrategy.create());
this.pedestrianFilter.filterImage();
this.lastStep = state.getStep();
}
double density = 0.0;
if (this.isObstacleDensity)
density = this.obstacleFilter.getFilteredValue(pos.x, pos.y);
density += this.pedestrianFilter.getFilteredValue(pos.x, pos.y);
return density;
}
}
......@@ -92,7 +92,7 @@
<repositories>
<repository>
<id>nativelibs4java</id>
<id>nativelibs4java-repo</id>
<name>nativelibs4java Maven2 Repository</name>
<url>http://nativelibs4java.sourceforge.net/maven</url>
</repository>
......@@ -101,13 +101,15 @@
<dependencies>
<dependency>
<groupId>com.nativelibs4java</groupId>
<artifactId>libcl-bridj</artifactId>
<version>1.0-SNAPSHOT</version>
<artifactId>bridj</artifactId>
<version>0.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.nativelibs4java</groupId>
<artifactId>javacl</artifactId>
<version>1.0.0-RC4</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -14,7 +14,8 @@ public class CLConvolution {
private Convolve gaussianFilter;
public CLConvolution() throws IOException {
context = JavaCL.createBestContext(CLPlatform.DeviceFeature.GPU, CLPlatform.DeviceFeature.MaxComputeUnits);
//context = JavaCL.createBestContext(CLPlatform.DeviceFeature.CPU, CLPlatform.DeviceFeature.MaxComputeUnits);
context = JavaCL.createBestContext();
gaussianFilter = new Convolve(context);
}
......
......@@ -129,7 +129,7 @@ public class Convolution {
for (int yOut = 0; yOut < nHeight; yOut++) {
for (int xOut = 0; xOut < nWidth; xOut++) {
final int idxOut = yOut * nWidth + xOut;
outMatrix[idxOut] = convolveCol(tmpOutMatrix, rowVector, nWidth, nHeight, nFilterWidth, xOut, yOut);
outMatrix[idxOut] = convolveCol(tmpOutMatrix, colVector, nWidth, nHeight, nFilterWidth, xOut, yOut);
}
}
return outMatrix;
......
package org.vadere.util.opencl;
import com.nativelibs4java.opencl.CLContext;
import com.nativelibs4java.opencl.CLDevice;
import com.nativelibs4java.opencl.JavaCL;
import org.junit.Test;
/**
* @author Benedikt Zoennchen
*/
public class TestJavaCL {
@Test
public void testContext() {
CLDevice device = JavaCL.getBestDevice();
CLContext context = JavaCL.createContext(null, device);
/*for (int i = 0; i < devices.length; i++) {
System.err.println(i+": "+devices[i]);
}*/
System.err.println("Now GC'ing");
System.gc(); // crash here
System.err.println("GC'ed");
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment