Hi,
when compiling a program of sorting (from thfe) using
docker run -it --rm -v $(pwd):/cingu cingulata:bfv
I get the following message :
[ 63%] Generating fhe_params.xml
TEST_NAME=bfv-wifsSort
MODE=static
The parameters with lwe-estimator commit fb7deba are not in CinguParam.
DESIRED_PARAMS=25_bkz_sieve_128_2
No parameter found with static mode. Automatically switch to interactive mode.
MODE=interactive
- Select a parameter set in CinguParam (using LWE-Estimator commit=3019847)
- Quit
Please enter your choice: 1
INTERACTIVE_CHOICE=
COMMIT_ID=3019847
Invalid choice. You can generate suitable parameter sets using CinguParam module.
And then the execution using bvf mode is very very slow (2 minutes for sorting 4 integers with 10 cores!)
Thanks
Frédéric Gava
The cxx file :
/* local includes */
//#include
//#include <bit_exec/decorator/attach.hxx>
//#include <bit_exec/decorator/depth.hxx>
//#include <bit_exec/decorator/stat.hxx>
#include <bit_exec/tracker.hxx>
#include <ci_context.hxx>
#include <ci_fncs.hxx>
#include <ci_int.hxx>
#include <int_op_gen/mult_depth.hxx>
/* namespaces */
using namespace std;
using namespace cingulata;
int main() {
CiContext::set_config(make_shared(),
make_shared());
vector a(list_size, CiInt::u8);
CiInt t{CiInt::u8};
CiBit swap;
for (int i = 0; i < list_size; ++i)
a[i].read("a_" + to_string(i));
for (int i = 0; i < list_size-1; ++i) {
for (int j = i+1; j < list_size; ++j) {
swap = a[i] > a[j];
t = select(swap, a[i], a[j]);
a[i] = select(swap, a[j], a[i]);
a[j] = t;
}
}
for (int i = 0; i < list_size; ++i)
a[i].write("r_" + to_string(i));
/* Export to file the "tracked" circuit */
CiContext::get_bit_exec_t()->export_blif(blif_name, "wifsSort");
}
and the Cmake file
cmake_minimum_required(VERSION 3.0)
set(TEST_NAME bfv-wifsSort)
set(SRCS wifsSort.cxx)
set(LIST_SIZE 4)
set(BLIF_NAME ${TEST_NAME}.blif)
set(BLOP_NAME ${TEST_NAME}-opt.blif)
add_compile_options(-Dlist_size=${LIST_SIZE} -Dblif_name="${BLIF_NAME}")
set(GEN_NAME ${TEST_NAME}-gen)
add_executable(${GEN_NAME} ${SRCS})
target_link_libraries(${GEN_NAME} common)
add_custom_command(OUTPUT ${BLIF_NAME}
COMMAND ./${GEN_NAME}
DEPENDS ${GEN_NAME})
add_custom_command(OUTPUT ${BLOP_NAME}
COMMAND python3 ${OPTIM_DIR}/abc_optimize.py -i ${BLIF_NAME} -o ${BLOP_NAME} -v
DEPENDS abc ${BLIF_NAME})
set(XML_PARAMS fhe_params.xml)
set(MUL_DEPTH_SCRIPT ${OPTIM_DIR}/graph_info.py)
add_custom_command(OUTPUT ${XML_PARAMS}
COMMAND bash ${SCRIPT_DIR}/selectParams.sh ${TEST_NAME} python3 ${MUL_DEPTH_SCRIPT} ${BLOP_NAME} --mult_depth_max
${MODEL} ${MIN_SECU} ${POLITIC}
DEPENDS ${BLOP_NAME})
add_custom_target(${TEST_NAME} ALL
DEPENDS ${XML_PARAMS} runtime)
set(APPS_DIR ${CMAKE_BINARY_DIR}/apps)
set(CIRCUIT ${BLOP_NAME})
configure_file("run.sh.in" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run.sh" @only)
file(COPY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run.sh" DESTINATION . FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
file(COPY "README.md" DESTINATION .)
file(COPY "data.txt" DESTINATION .)