chart21 / hpmpc

High Performance Implementation of Secure Multiparty Computation protocols
https://c.harth-kitzerow.com/mkdocs-hpmpc/
MIT License
12 stars 3 forks source link

Compile error when performing matrix multiplication. #3

Open SJTUHGX opened 4 months ago

SJTUHGX commented 4 months ago

When I try to perform a matrix multiplication with 2500 rows and 1 column and 1 row and 4000 columns, the compilation reports an error. image I made this change to part of the code before compiling: image

chart21 commented 4 months ago

Hi, I will try out your config tomorrow. For now, using CUDA_GEMM 0/1/2/3 or PRE 0 when compiling might help. Did you compile the standalone executables in core/cuda?

SJTUHGX commented 4 months ago

Yes,I have already compile the standalone executables in core/cuda. I run this program in Locally way.

发自我的iPhone

------------------ Original ------------------ From: Christopher Harth-Kitzerow @.> Date: Thu,Jul 25,2024 4:15 AM To: chart21/hpmpc @.> Cc: SJTUHGX @.>, Author @.> Subject: Re: [chart21/hpmpc] Compile error when performing matrixmultiplication. (Issue #3)

Hi, I will try out your config tomorrow. For now, using CUDA_GEMM 0/1/2/3 or PRE 0 when compiling might help. Did you compile the standalone executables in core/cuda?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

chart21 commented 4 months ago

Thw code compiles fine for me without errors. Since you get an internal g++ error I suspect that your gcc installation might be too old. Can you check g++ -v? Versions 12 and higher should work. The following may get you started on Debian-based systems:

echo 'deb http://deb.debian.org/debian testing main' > /etc/apt/sources.list.d/testing.list
apt update -y
apt install -y gcc-12 g++-12

Then you can compile with make -j ... COMPILER=g++-12. If that doesn't help let me know if you can compile any program at all and if turning GPU acceleration off or reducing matrix dimensions helps.

SJTUHGX commented 3 months ago

Thw code compiles fine for me without errors. Since you get an internal g++ error I suspect that your gcc installation might be too old. Can you check g++ -v? Versions 12 and higher should work. The following may get you started on Debian-based systems:

echo 'deb http://deb.debian.org/debian testing main' > /etc/apt/sources.list.d/testing.list
apt update -y
apt install -y gcc-12 g++-12

Then you can compile with make -j ... COMPILER=g++-12. If that doesn't help let me know if you can compile any program at all and if turning GPU acceleration off or reducing matrix dimensions helps.

Okay, thank you. I encountered this compilation error when trying to run the 4PC protocol, and I used the Multiprocesssing.conf file for the test. image

chart21 commented 3 months ago

You are trying to run PROTOCOL=1 which is the Sharemind 3PC protocol so trying to compile for a fourth party will fail. If you want to test 4PC protocols you need to specify PROTOCOL=7,8,9,10,11,12 in your .conf file. You can see a mapping of protocol ids here: https://github.com/chart21/hpmpc#Protocols

I updated the Readme, so this should work depending if you want to run 3PC or 4PC on a distributed setup:

#Distributed Setup, 3PC
python3 measurements/run_config.py -p <party_id> -a <ip_address_party_0> -b <ip_address_party_1> -c <ip_address_party_2> -d <ip_address_party_3> measurements/configs/benchmarks/Multiprocesssing.conf --override NUM_INPUTS=1000000 DATTYPE=512 PROTOCOL=1,2,3,5,6

#Distributed Setup, 4PC
python3 measurements/run_config.py -p <party_id> -a <ip_address_party_0> -b <ip_address_party_1> -c <ip_address_party_2> -d <ip_address_party_3> measurements/configs/benchmarks/Multiprocesssing.conf --override NUM_INPUTS=1000000 DATTYPE=512 PROTOCOL=7,8,9,10,11,12
SJTUHGX commented 1 month ago

You are trying to run PROTOCOL=1 which is the Sharemind 3PC protocol so trying to compile for a fourth party will fail. If you want to test 4PC protocols you need to specify PROTOCOL=7,8,9,10,11,12 in your .conf file. You can see a mapping of protocol ids here: https://github.com/chart21/hpmpc#Protocols

I updated the Readme, so this should work depending if you want to run 3PC or 4PC on a distributed setup:

#Distributed Setup, 3PC
python3 measurements/run_config.py -p <party_id> -a <ip_address_party_0> -b <ip_address_party_1> -c <ip_address_party_2> -d <ip_address_party_3> measurements/configs/benchmarks/Multiprocesssing.conf --override NUM_INPUTS=1000000 DATTYPE=512 PROTOCOL=1,2,3,5,6

#Distributed Setup, 4PC
python3 measurements/run_config.py -p <party_id> -a <ip_address_party_0> -b <ip_address_party_1> -c <ip_address_party_2> -d <ip_address_party_3> measurements/configs/benchmarks/Multiprocesssing.conf --override NUM_INPUTS=1000000 DATTYPE=512 PROTOCOL=7,8,9,10,11,12

Thank you, I have solved the previous problem. Now I want to run your programme on a CPU with ARM architecture, but I find that it reports an error when compiled on a standalone machine, even if I add the parameter ARM=1. I don't know what modifications I need to make. image

chart21 commented 1 month ago

From your error trace it looks like you specified DATTYPE=128 in your config.h. You need to set it to 32/64 on ARM matching the set Bitlength