pls
This commit is contained in:
parent
577c793470
commit
059387bbd6
|
@ -69,11 +69,11 @@ public class Driver {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runTests() {
|
public static void runTests() {
|
||||||
for (int numServers = 2; numServers <= 8; numServers = (int) Math.pow(2, ++numServers)) {
|
for (int numServers = 1; numServers <= 8; numServers = numServers*2) {
|
||||||
for (int databaseSize = 2; databaseSize <= 32; databaseSize = (int) Math.pow(2, ++databaseSize)) {
|
for (int databaseSize = 2; databaseSize <= 4096; databaseSize = databaseSize*2) {
|
||||||
for (int blockSize = 1; blockSize <= Math.min(4, databaseSize); blockSize = (int) Math.pow(2, ++blockSize)) {
|
for (int blockSize = 1; blockSize <= Math.min(512, databaseSize); blockSize = blockSize*2) {
|
||||||
for (int latency = 0; latency <= 50; latency = latency + 10) {
|
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);
|
runTest(numServers, databaseSize, blockSize, latency, bandwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,20 +91,22 @@ public class Driver {
|
||||||
Database database = new MemoryDatabase(settings, x);
|
Database database = new MemoryDatabase(settings, x);
|
||||||
Profiler profiler = new Profiler(latency, bandwidth/10, bandwidth);
|
Profiler profiler = new Profiler(latency, bandwidth/10, bandwidth);
|
||||||
|
|
||||||
|
|
||||||
profiler.reset();
|
profiler.reset();
|
||||||
testEvenSimplerScheme(settings, database, profiler);
|
testEvenSimplerScheme(settings, database, profiler);
|
||||||
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "EvenSimplerScheme");
|
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "EvenSimplerScheme");
|
||||||
|
|
||||||
profiler.reset();
|
|
||||||
testSimpleScheme(settings, database, profiler);
|
|
||||||
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "SimpleScheme");
|
|
||||||
|
|
||||||
profiler.reset();
|
if (numServers == 2) {
|
||||||
testSimpleBlockScheme(settings, database, profiler);
|
profiler.reset();
|
||||||
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "SimpleBlockScheme");
|
testSimpleScheme(settings, database, profiler);
|
||||||
|
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "SimpleScheme");
|
||||||
|
|
||||||
if (settings.getS() != 0) {
|
profiler.reset();
|
||||||
|
testSimpleBlockScheme(settings, database, profiler);
|
||||||
|
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "SimpleBlockScheme");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.getS() != 0 && numServers != 1) {
|
||||||
profiler.reset();
|
profiler.reset();
|
||||||
testGeneralInterPolyScheme(settings, database, profiler);
|
testGeneralInterPolyScheme(settings, database, profiler);
|
||||||
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "GeneralInterPolyScheme");
|
reportResult(numServers, databaseSize, blockSize, latency, bandwidth, profiler, "GeneralInterPolyScheme");
|
||||||
|
|
|
@ -72,6 +72,13 @@ public class Profiler {
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FieldElement[][] clientSend(FieldElement[][] elements) {
|
||||||
|
for (FieldElement[] fe : elements) {
|
||||||
|
this.clientSend(fe);
|
||||||
|
}
|
||||||
|
return elements;
|
||||||
|
}
|
||||||
|
|
||||||
public int clientReceive(int number) {
|
public int clientReceive(int number) {
|
||||||
this.received += log2(number);
|
this.received += log2(number);
|
||||||
return number;
|
return number;
|
||||||
|
@ -89,6 +96,13 @@ public class Profiler {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FieldElement[] clientReceive(FieldElement[] elements) {
|
||||||
|
for (FieldElement fe : elements) {
|
||||||
|
clientReceive(fe);
|
||||||
|
}
|
||||||
|
return elements;
|
||||||
|
}
|
||||||
|
|
||||||
public int getSent() {
|
public int getSent() {
|
||||||
return this.sent;
|
return this.sent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class EvenSimplerClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int receiveBit(int index) {
|
public int receiveBit(int index) {
|
||||||
this.profiler.addNetworkDelay();
|
this.profiler.addNetworkDelay(2);
|
||||||
int[] data = this.profiler.clientReceive(this.servers[0].giveDatabase());
|
int[] data = this.profiler.clientReceive(this.servers[0].giveDatabase());
|
||||||
return data[index];
|
return data[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* 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++) {
|
for (int z = 0; z < this.servers.length; z++) {
|
||||||
FieldElement[][] Gs = new FieldElement[settings.getBlocksize()][this.s];
|
FieldElement[][] Gs = new FieldElement[settings.getBlocksize()][this.s];
|
||||||
for (int i = 0; i < settings.getBlocksize(); i++) {
|
for (int i = 0; i < settings.getBlocksize(); i++) {
|
||||||
Gs[i] = this.getGs(record*settings.getBlocksize() + i, z+1, randoms[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++) {
|
for (int i = 0; i < settings.getBlocksize(); i++) {
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class SimpleClient {
|
||||||
S2[index] = 1;
|
S2[index] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Hardcoded, should be a loop
|
|
||||||
this.profiler.addNetworkDelay(2);
|
this.profiler.addNetworkDelay(2);
|
||||||
int resBit1 = this.profiler.clientReceive(this.servers[0].computeBit(this.profiler.clientSend(S1)));
|
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)));
|
int resBit2 = this.profiler.clientReceive(this.servers[1].computeBit(this.profiler.clientSend(S2)));
|
||||||
|
|
|
@ -21,13 +21,9 @@ public class PIRSettings {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.s = calculateS(numServers, databaseSize);
|
this.s = calculateS(numServers, databaseSize);
|
||||||
// TODO: lol
|
this.sequences = ProtocolUtils.createSequences(s, numServers, databaseSize);
|
||||||
if (numServers > 1) {
|
|
||||||
this.sequences = ProtocolUtils.createSequences(s, numServers, databaseSize);
|
|
||||||
} else {
|
|
||||||
this.sequences = ProtocolUtils.createSequences(calculateS(2, databaseSize), 2, databaseSize);
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException error) {
|
} catch (IllegalArgumentException error) {
|
||||||
|
System.out.println("pls");
|
||||||
this.s = 0;
|
this.s = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user