Merge pull request #73 from pmediano/master

Minor updates to GPU tests and examples following v1.5 release.
This commit is contained in:
Joseph Lizier 2018-11-26 10:28:15 +11:00 committed by GitHub
commit 2ba27f30ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View File

@ -67,9 +67,10 @@ public class Example10GPUBenchmark {
miCalc.setProperty("k", "4");
miCalc.initialise(src[0].length, tgt[0].length);
miCalc.setObservations(src, tgt);
int nb_surrogates = 150;
double[] timeAndValue = new double[2];
long startTime = System.nanoTime();
timeAndValue[1] = miCalc.computeAverageLocalOfObservations();
timeAndValue[1] = miCalc.computeSignificance(nb_surrogates).actualValue;
timeAndValue[0] = (System.nanoTime() - startTime)/1000000.0;
return timeAndValue;
}

View File

@ -717,9 +717,10 @@ public abstract class MutualInfoCalculatorMultiVariateKraskov
System.load(gpuLibraryPath);
}
} catch (Throwable e) {
String errmsg = "GPU library not found. To compile GPU code set the enablegpu flag to true in build.xml";
String errmsg = "GPU library not found. To compile GPU code set the enablegpu flag to true in build.xml, or run `ant gpu jar`.";
errmsg += "\nFor more information see the JIDT GPU wiki page: https://github.com/jlizier/jidt/wiki/GPU";
if (gpuLibraryPath.length() > 0) {
errmsg += "\nGPU library was not found in the path provided. Provide full path including library file name.";
errmsg += "\n\nGPU library was not found in the path provided. Provide full path including library file name.";
errmsg += "\nExample: /home/johndoe/myfolder/libKraskov.so";
}
throw new Exception(errmsg);

View File

@ -86,14 +86,14 @@ public class GPUPerformanceTester extends TestCase {
startTime = Calendar.getInstance().getTimeInMillis();
miCalc.initialise(1,1);
miCalc.setObservations(source, dest);
cpu_val = miCalc.computeSignificance(nb_surrogates).getMeanOfDistribution();
cpu_val = miCalc.computeSignificance(nb_surrogates).actualValue;
cpu_duration = Calendar.getInstance().getTimeInMillis() - startTime;
miCalc.setProperty("USE_GPU", "true");
miCalc.initialise(1,1);
startTime = Calendar.getInstance().getTimeInMillis();
miCalc.setObservations(source, dest);
gpu_val = miCalc.computeSignificance(nb_surrogates).getMeanOfDistribution();
gpu_val = miCalc.computeSignificance(nb_surrogates).actualValue;
gpu_duration = Calendar.getInstance().getTimeInMillis() - startTime;
assertEquals(cpu_val, gpu_val, 0.0001);
@ -124,12 +124,12 @@ public class GPUPerformanceTester extends TestCase {
return;
}
int timeSteps = 10000;
int timeSteps = 1000;
RandomGenerator rg = new RandomGenerator();
double[] source = rg.generateNormalData(timeSteps, 0, 1);
double[] dest = rg.generateNormalData(timeSteps, 0, 1);
compareGPUPerformance(source, dest, "Random low-dimensional data");
compareGPUPerformanceSurrogates(source, dest, 150, "Random low-dimensional data");
return;
}