Skip to content

Commit

Permalink
grr18 optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Rindal committed Feb 22, 2018
1 parent f15009f commit abf70da
Show file tree
Hide file tree
Showing 38 changed files with 750 additions and 510 deletions.
2 changes: 1 addition & 1 deletion copySourceToLinux.ps1
Expand Up @@ -8,7 +8,7 @@ $RemoteWorkingDir='/scratch/repo/libPSI'
$FileMasks='**.cpp;**.c;**.h;*CMakeLists.txt;*.bin;*.S;thirdparty/linux/**.get'

# everything in these folders will be skipped
$ExcludeDirs='.git/;thirdparty/;Debug/;Release/;x64/;ipch/;.vs/'
$ExcludeDirs='.git/;thirdparty/;Debug/;Release/;x64/;ipch/;.vs/;frontend/My*/'

C:\tools\WinSCP.com /command `
"open $RemoteUserName@$RemoteHostName -privatekey=""$PrivateKey"""`
Expand Down
21 changes: 19 additions & 2 deletions frontend/CMakeLists.txt
Expand Up @@ -17,5 +17,22 @@ add_executable(frontend.exe ${SRC_FRONTEND})
#############################################
# Link our libraries #
#############################################
target_link_libraries(frontend.exe libPSI_Tests)
target_link_libraries(frontend.exe libPSI)



#############################################
# Link libOTe #
#############################################


find_library(
libOTe_Tests_LIB
NAMES libOTe_Tests
HINTS "${libOTe_Dirs}/lib/")

find_library(
cryptoTools_Tests_LIB
NAMES tests_cryptoTools
HINTS "${libOTe_Dirs}/lib/")

target_link_libraries(frontend.exe libPSI_Tests libPSI ${libOTe_Tests_LIB} ${cryptoTools_Tests_LIB})
49 changes: 32 additions & 17 deletions frontend/OtBinMain.cpp
Expand Up @@ -126,10 +126,10 @@ void rr17aRecv(
KkrtNcoOtSender otSend;
#endif
Rr17aMPsiReceiver recvPSIs;

recvPSIs.setTimer(_gTimer);

chls[0].recv(dummy, 1);
gTimer.reset();
_gTimer.reset();
chls[0].asyncSend(dummy, 1);


Expand Down Expand Up @@ -189,6 +189,7 @@ void rr17aSend_StandardModel(
Rr17NcoOtSender otSend;

Rr17aMPsiSender sendPSIs;
sendPSIs.setTimer(_gTimer);

sendChls[0].asyncSend(dummy, 1);
sendChls[0].recv(dummy, 1);
Expand Down Expand Up @@ -249,10 +250,11 @@ void rr17aRecv_StandardModel(
Rr17NcoOtSender otSend;

Rr17aMPsiReceiver recvPSIs;
recvPSIs.setTimer(_gTimer);


chls[0].recv(dummy, 1);
gTimer.reset();
_gTimer.reset();
chls[0].asyncSend(dummy, 1);


Expand Down Expand Up @@ -313,10 +315,11 @@ void rr17bSend(
OosNcoOtSender otSend;

Rr17bMPsiSender sendPSIs;
sendPSIs.setTimer(_gTimer);

sendChls[0].asyncSend(dummy, 1);
sendChls[0].recv(dummy, 1);
gTimer.reset();
_gTimer.reset();

sendPSIs.init(setSize, params.mStatSecParam, sendChls, otSend, prng.get<block>(), ss, params.mBitSize);

Expand All @@ -335,7 +338,7 @@ void rr17bSend(
sendChls[g].resetStats();


if (params.mVerbose > 1) std::cout << gTimer << std::endl;
if (params.mVerbose > 1) std::cout << _gTimer << std::endl;
}
}
}
Expand Down Expand Up @@ -378,10 +381,11 @@ void rr17bRecv(

OosNcoOtReceiver otRecv;// (code, 40);
Rr17bMPsiReceiver recvPSIs;
recvPSIs.setTimer(_gTimer);


chls[0].recv(dummy, 1);
gTimer.reset();
_gTimer.reset();
chls[0].asyncSend(dummy, 1);


Expand Down Expand Up @@ -442,6 +446,7 @@ void rr17bSend_StandardModel(
Rr17NcoOtSender otSend;

Rr17bMPsiSender sendPSIs;
sendPSIs.setTimer(_gTimer);

sendChls[0].asyncSend(dummy, 1);
sendChls[0].recv(dummy, 1);
Expand Down Expand Up @@ -503,10 +508,11 @@ void rr17bRecv_StandardModel(
Rr17NcoOtReceiver otRecv;

Rr17bMPsiReceiver recvPSIs;
recvPSIs.setTimer(_gTimer);


chls[0].recv(dummy, 1);
gTimer.reset();
_gTimer.reset();
chls[0].asyncSend(dummy, 1);


Expand Down Expand Up @@ -565,6 +571,7 @@ void kkrtSend(
KkrtNcoOtSender otSend;

KkrtPsiSender sendPSIs;
sendPSIs.setTimer(_gTimer);

sendChls[0].asyncSend(dummy, 1);
sendChls[0].recv(dummy, 1);
Expand Down Expand Up @@ -623,10 +630,11 @@ void kkrtRecv(
KkrtNcoOtReceiver otRecv;

KkrtPsiReceiver recvPSIs;
recvPSIs.setTimer(_gTimer);


chls[0].recv(dummy, 1);
gTimer.reset();
_gTimer.reset();
chls[0].asyncSend(dummy, 1);


Expand Down Expand Up @@ -663,8 +671,9 @@ void kkrtRecv(
void grr18Send(
LaunchParams& params)
{
setThreadName("CP_Test_Thread");
setThreadName("send_grr18");

_gTimer.setTimePoint("grr18Send()");

PRNG prng(_mm_set_epi32(4253465, 3434565, 234435, 23987045));

Expand All @@ -686,15 +695,17 @@ void grr18Send(
OosNcoOtSender otSend;

Grr18MPsiSender sendPSIs;
sendPSIs.setTimer(_gTimer);

sendPSIs.mEps = params.mCmd->get<double>("eps");

sendChls[0].asyncSend(dummy, 1);
sendChls[0].recv(dummy, 1);

sendPSIs.init(setSize, params.mStatSecParam, sendChls, otSend, otRecv, prng.get<block>(), ss, params.mBitSize);

sendChls[0].asyncSend(dummy, 1);
sendChls[0].recv(dummy, 1);
//sendChls[0].asyncSend(dummy, 1);
//sendChls[0].recv(dummy, 1);

sendPSIs.sendInput(set, sendChls);

Expand All @@ -715,9 +726,10 @@ void grr18Send(
void grr18Recv(
LaunchParams& params)
{
setThreadName("CP_Test_Thread");

setThreadName("recv_grr18");

_gTimer.setTimePoint("grr18Recv()");

PRNG prng(_mm_set_epi32(4253465, 3434565, 234435, 23987045));


Expand All @@ -734,7 +746,7 @@ void grr18Recv(
{
for (u64 jj = 0; jj < params.mTrials; jj++)
{
std::string tag("RR17a");
std::string tag("grr18");

std::vector<block> sendSet(setSize), recvSet(setSize);
for (u64 i = 0; i < setSize; ++i)
Expand All @@ -747,22 +759,25 @@ void grr18Recv(
OosNcoOtSender otSend;

Grr18MPsiReceiver recvPSIs;
recvPSIs.setTimer(_gTimer);

recvPSIs.mEps = params.mCmd->get<double>("eps");

chls[0].recv(dummy, 1);
gTimer.reset();

chls[0].asyncSend(dummy, 1);



Timer timer;

auto start = timer.setTimePoint("start");
_gTimer.setTimePoint("start");

recvPSIs.init(setSize, params.mStatSecParam, chls, otRecv, otSend, prng.get<block>(), ss, params.mBitSize);

chls[0].asyncSend(dummy, 1);
chls[0].recv(dummy, 1);
//chls[0].asyncSend(dummy, 1);
//chls[0].recv(dummy, 1);
auto mid = timer.setTimePoint("init");


Expand Down
2 changes: 0 additions & 2 deletions frontend/bloomFilterMain.cpp
Expand Up @@ -49,7 +49,6 @@ void bfSend(LaunchParams& params)

AknBfMPsiSender sendPSIs;

gTimer.reset();
sendPSIs.init(setSize, params.mStatSecParam, otSend, chls, prng.get<block>());


Expand Down Expand Up @@ -94,7 +93,6 @@ void bfRecv(LaunchParams& params)

AknBfMPsiReceiver recvPSIs;

gTimer.reset();

Timer timer;
auto start = timer.setTimePoint("start");
Expand Down
5 changes: 1 addition & 4 deletions frontend/dktMain.cpp
Expand Up @@ -35,8 +35,7 @@ void DktSend(LaunchParams& params)


DktMPsiSender sendPSIs;

gTimer.reset();

Timer timer;

sendPSIs.init(setSize, params.mStatSecParam, prng.get<block>());
Expand Down Expand Up @@ -68,8 +67,6 @@ void DktRecv(LaunchParams& params)

DktMPsiReceiver recvPSIs;

gTimer.reset();

Timer timer;
auto start = timer.setTimePoint("start");
recvPSIs.init(setSize, params.mStatSecParam, ZeroBlock);
Expand Down
4 changes: 2 additions & 2 deletions frontend/frontend.vcxproj
Expand Up @@ -60,7 +60,7 @@
</ClCompile>
<Link>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(SolutionDir)\thirdparty\win\boost\stage\lib;C:/libs/boost\stage\lib;$(OutDir);$(SolutionDir)thirdparty\win\;C:/libs/;$(libOTeDir)\x64\$(Configuration)</AdditionalLibraryDirectories>
<AdditionalDependencies>libOTe.lib;libPSI.lib;libPSI_Tests.lib;cryptoTools.lib;Miracl\x64\$(Configuration)\miracl.lib;</AdditionalDependencies>
<AdditionalDependencies>libOTe_Tests.lib;tests_cryptoTools.lib;libOTe.lib;libPSI.lib;libPSI_Tests.lib;cryptoTools.lib;Miracl\x64\$(Configuration)\miracl.lib;</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -80,7 +80,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(SolutionDir)\thirdparty\win\boost\stage\lib;C:/libs/boost\stage\lib;$(OutDir);$(SolutionDir)thirdparty\win\;C:/libs/;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(libOTeDir)\x64\$(Configuration)</AdditionalLibraryDirectories>
<AdditionalDependencies>libOTe.lib;libPSI.lib;libPSI_Tests.lib;cryptoTools.lib;Miracl\x64\$(Configuration)\miracl.lib;</AdditionalDependencies>
<AdditionalDependencies>libOTe_Tests.lib;tests_cryptoTools.lib;libOTe.lib;libPSI.lib;libPSI_Tests.lib;cryptoTools.lib;Miracl\x64\$(Configuration)\miracl.lib;</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down

0 comments on commit abf70da

Please sign in to comment.