Debug
The debug/ directory provides debugging utilities for cdough.
Contents:
cdough_debug.h– Compile-time assertions and run-time debugging helpers used throughout the library.
Defines
-
SPDZ2K
Numeric codes for each protocol.
-
FANTASTIC4
-
REPLICATED3
-
BEAVER2
-
PLAINTEXT1
-
DUMMY0
-
PROTOCOL_NUM
The default protocol.
-
MPI_COMMUNICATOR
-
NOCOPY_COMMUNICATOR
-
COMMUNICATOR_NUM
The default communicator.
-
MPC_USE_MPI_COMMUNICATOR
If SINGLE_EXECUTION is defined, don’t compile with a communicator. (Useful for debugging)
-
MPC_USE_RANDOM_GENERATOR_TRIPLES
-
SOCKET_COMMUNICATOR_RING_SIZE
-
SOCKET_COMMUNICATOR_BUFFER_SIZE
-
SOCKET_COMMUNICATOR_WAIT_MS
-
NOCOPY_COMMUNICATOR_RING_SIZE
Current communicaton API only uses 1 ring element, ring_size can be changed later if needed.
-
NOCOPY_COMMUNICATOR_THREADS
-
MPC_GENERATE_DATA
-
MPC_RANDOM_DATA_RANGE
-
MPC_USE_RANDOM_GENERATOR_DATA
-
MPC_EVALUATE_CORRECT_OUTPUT
-
MPC_CHECK_CORRECTNESS
-
USE_DIVISION_CORRECTION
-
DEBUG_VECTOR_SAME_AS
-
USE_SECURE_JOIN
-
USE_INDEX_MAPPED_VECTOR
If defined, Vectors use index mapping to track access patterns instead of VectorData.
-
PRINT_PROTOCOL_STATISTICS
Whether to use the original protocol of Dalskov et al., or our custom version.
Print usage statistics for an MPC protocol
-
FORCE_CONV2D_LEFT_VECTORIZATION_MATERIALIZATION
-
USE_BLAZE_LIBRARY_FOR_PLAINTEXT_MATMUL
-
BLAZE_USE_SHARED_MEMORY_PARALLELIZATION
-
USE_OPTIMIZED_BIT_DECOMPOSITION_FOR_RCA
-
USE_OPTIMIZED_A2B_SIGN_FOR_GTZE
-
SERVICE_NAMESPACE
Preprocessor defines to generate proper namespaces.
-
MPC_PROTOCOL_REPLICATED_THREE
-
COMPILED_MPC_PROTOCOL_NAMESPACE
-
single_cout(x)
Print
xon party zero, only, with a newline.
-
all_cout(x)
Print
xon all parties, prepending with party ID.
-
single_cout_nonl(x)
Print
xon party zero, only, without a newline.
-
VAR(x)
Pass a variable’s name and value to
std::cout. Use like:std::cout << VAR(x) << VAR(y) << "\n";
This will output something like
x = 3 y = 10
-
VECTOR_SPACING
-
TABLE_SPACING
-
DEBUG_PRINT(x)
-
_STRINGIFY(x)
-
STRINGIFY(x)
Functions
-
std::istream &operator>>(std::istream &in, __int128 &val)
Custom 128-bit handler for std::cin.
- Parameters:
in –
val –
- Returns:
std::istream&
-
std::ostream &operator<<(std::ostream &os, __int128 n)
Custom 128-bit handler for std::cout.
- Parameters:
os –
n –
- Returns:
std::ostream&
Variables
-
bool USE_GILBOA_CRT = false
-
bool CONFIDENTIAL_1PC = false
-
bool SPDZ2k_NPC_PROTOCOL = false
-
bool USE_STACKED_MULTIPLY_A = false
-
bool USE_STACKED_AND_B = true
-
namespace cdough
-
namespace debug
Functions
-
static void print_bin_(int num1, int num2, bool add_line, int party_num = 0)
Print numbers in binary.
- Parameters:
num1 –
num2 –
add_line –
party_num –
-
template<typename VectorType>
static void print(VectorType &&vec, int partyID = 0) Print a vector on a single party.
- Template Parameters:
VectorType –
- Parameters:
vec –
partyID – party to output, default P0
-
template<typename T>
static void print(std::string name, T &&vec) Print a vector, prepended with a label.
- Template Parameters:
T –
- Parameters:
name –
vec –
-
template<typename TableType>
static void print_table(const TableType &table, int partyID = 0) Print a plaintext table.
- Template Parameters:
TableType – can be any vector<vector> or similar
- Parameters:
table –
partyID –
-
template<typename TableType>
static void print_table(const std::pair<TableType, std::vector<std::string>> &table, int partyID = 0) Improved table output. Call with
print_table(T.open_with_schema()). (Once plaintext tables are implemented, they will replace the current hacky version.- Template Parameters:
TableType –
- Parameters:
table –
partyID –
-
template<typename T>
void print_binary(const T &s) Prints to stdout the binary representation of
s.- Template Parameters:
T – The data type of the input
s- Parameters:
s – The input whose binary representation we want to print.
-
template<typename VectorType>
void print_binary(const VectorType &v, int partyID) Prints to stdout the binary representation of the elements in
v.- Template Parameters:
VectorType – The vector type.
- Parameters:
v – The input vector.
partyID – The ID of the party that calls this function.
-
static void print_bin_(int num1, int num2, bool add_line, int party_num = 0)
-
namespace debug