1
0
Fork 0
This commit is contained in:
Alexander Munch-Hansen 2019-12-03 12:58:24 +01:00
parent 577c793470
commit 059387bbd6
6 changed files with 33 additions and 21 deletions

View file

@ -69,11 +69,11 @@ public class Driver {
}
public static void runTests() {
for (int numServers = 2; numServers <= 8; numServers = (int) Math.pow(2, ++numServers)) {
for (int databaseSize = 2; databaseSize <= 32; databaseSize = (int) Math.pow(2, ++databaseSize)) {
for (int blockSize = 1; blockSize <= Math.min(4, databaseSize); blockSize = (int) Math.pow(2, ++blockSize)) {
for (int numServers = 1; numServers <= 8; numServers = numServers*2) {
for (int databaseSize = 2; databaseSize <= 4096; databaseSize = databaseSize*2) {
for (int blockSize = 1; blockSize <= Math.min(512, databaseSize); blockSize = blockSize*2) {
for (int latency = 0; latency <= 50; latency = latency + 10) {
for (int bandwidth = 1024; bandwidth <= 2048; bandwidth = (int) Math.pow(2, ++bandwidth)) {
for (int bandwidth = 1024; bandwidth <= 2048; bandwidth = bandwidth*2) {
runTest(numServers, databaseSize, blockSize, latency, bandwidth);
}
}
@ -91,11 +91,12 @@ public class Driver {
Database database = new MemoryDatabase(settings, x);
Profiler profiler = new Profiler(latency, bandwidth/10, bandwidth);
profiler.reset();
testEvenSimplerScheme(settings, database, profiler);
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "EvenSimplerScheme");
if (numServers == 2) {
profiler.reset();
testSimpleScheme(settings, database, profiler);
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "SimpleScheme");
@ -103,8 +104,9 @@ public class Driver {
profiler.reset();
testSimpleBlockScheme(settings, database, profiler);
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "SimpleBlockScheme");
}
if (settings.getS() != 0) {
if (settings.getS() != 0 && numServers != 1) {
profiler.reset();
testGeneralInterPolyScheme(settings, database, profiler);
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "GeneralInterPolyScheme");

View file

@ -72,6 +72,13 @@ public class Profiler {
return elements;
}
public FieldElement[][] clientSend(FieldElement[][] elements) {
for (FieldElement[] fe : elements) {
this.clientSend(fe);
}
return elements;
}
public int clientReceive(int number) {
this.received += log2(number);
return number;
@ -89,6 +96,13 @@ public class Profiler {
return element;
}
public FieldElement[] clientReceive(FieldElement[] elements) {
for (FieldElement fe : elements) {
clientReceive(fe);
}
return elements;
}
public int getSent() {
return this.sent;
}

View file

@ -15,7 +15,7 @@ public class EvenSimplerClient {
}
public int receiveBit(int index) {
this.profiler.addNetworkDelay();
this.profiler.addNetworkDelay(2);
int[] data = this.profiler.clientReceive(this.servers[0].giveDatabase());
return data[index];
}

View file

@ -84,12 +84,13 @@ public class InterPolyClient {
/**
* 1) Compute all the Gs for each server, s.t. the first index should be the blocksize and it should contain all the Gs for the given index
*/
this.profiler.addNetworkDelay(2);
for (int z = 0; z < this.servers.length; z++) {
FieldElement[][] Gs = new FieldElement[settings.getBlocksize()][this.s];
for (int i = 0; i < settings.getBlocksize(); i++) {
Gs[i] = this.getGs(record*settings.getBlocksize() + i, z+1, randoms[i]);
}
Fs[z] = this.servers[z].FBlock(Gs);
Fs[z] = profiler.clientReceive(this.servers[z].FBlock(profiler.clientSend(Gs)));
}
for (int i = 0; i < settings.getBlocksize(); i++) {

View file

@ -36,7 +36,6 @@ public class SimpleClient {
S2[index] = 1;
}
// TODO: Hardcoded, should be a loop
this.profiler.addNetworkDelay(2);
int resBit1 = this.profiler.clientReceive(this.servers[0].computeBit(this.profiler.clientSend(S1)));
int resBit2 = this.profiler.clientReceive(this.servers[1].computeBit(this.profiler.clientSend(S2)));

View file

@ -21,13 +21,9 @@ public class PIRSettings {
try {
this.s = calculateS(numServers, databaseSize);
// TODO: lol
if (numServers > 1) {
this.sequences = ProtocolUtils.createSequences(s, numServers, databaseSize);
} else {
this.sequences = ProtocolUtils.createSequences(calculateS(2, databaseSize), 2, databaseSize);
}
} catch (IllegalArgumentException error) {
System.out.println("pls");
this.s = 0;
}