Skip to content

Commit

Permalink
add compile time option for matrix output
Browse files Browse the repository at this point in the history
The parameter `-DABY_ENABLE_MATRIX=On` to cmake now enables output for
the MATRIX framework.  Also, the `write_log` method is not called
automatically anymore after the last task.
  • Loading branch information
lenerd committed Oct 12, 2018
1 parent e7b4f37 commit acae3bf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.10)
project(ABY LANGUAGES CXX)

option(ABY_BUILD_EXE "Build executables" OFF)
option(ABY_ENABLE_MATRIX "Enable logging for the MATRIX framework in examples applications" OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ applications, you use the `ABY_BUILD_EXE` option:
cmake .. -DABY_BUILD_EXE=On
```
If also `-DABY_ENABLE_MATRIX=On` is given, then the examples output data for
the [MATRIX framework](https://github.com/cryptobiu/MATRIX) (if available).
###### Build Options
You can choose the build type, e.g. `Release` or `Debug` using
Expand Down
6 changes: 0 additions & 6 deletions src/abycore/MATRIX/MatrixMeasurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ class MatrixMeasurement
{
auto taskIdx = getTaskIdx(taskName);
m_cpuEndTimes[taskIdx][currentIterationNumber] = get_ms_since_epoch();

// if this is the last task and last iteration write the data to file
if (taskIdx == m_tasksNames.size() - 1 && currentIterationNumber == m_cpuEndTimes[0].size() - 1)
{
write_log();
}
}

void write_log() const
Expand Down
3 changes: 3 additions & 0 deletions src/examples/innerproduct/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

add_executable(innerproduct_test innerproduct_test.cpp common/innerproduct.cpp)
target_link_libraries(innerproduct_test ABY::aby ENCRYPTO_utils::encrypto_utils)
if(ABY_ENABLE_MATRIX)
target_compile_definitions(innerproduct_test PRIVATE ABY_ENABLE_MATRIX)
endif()
4 changes: 4 additions & 0 deletions src/examples/innerproduct/common/innerproduct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ int32_t test_inner_product_circuit(e_role role, const std::string& address, uint
party->ExecCircuit();
log.endSubTask("ExecCircuit", 0);

#ifdef ABY_ENABLE_MATRIX
log.write_log();
#endif

/**
Step 10: Type caste the plaintext output to 16 bit unsigned integer.
*/
Expand Down

0 comments on commit acae3bf

Please sign in to comment.