Closed MMDHBZ closed 3 months ago
First of all, you clearly didn't put effort to format your code properly. It's hard to read. I stop reading after the Cmake
command.
Instead of posting the code and ask community to "hey, figure out my code", can you briefly explain what are the numbers you got? And the numbers from A are slower compare to B, and can you show the numbers in B as well?
Sorry, I'm just trying to figure out the performance of calling the dynamic library to test kyber, why multi-threaded and single-threaded performance is about the same, measured in Tps.
The following is a screenshot of a single-threaded test
Below is a screenshot of the 12-thread test
Mirroring @cothan 's comments the above is not concise enough to judge whether there is a problem with OQS or your code @MMDHBZ . In general, multi-threaded code is notoriously difficult to understand and debug, so best would be for you to dig deeper and analyze where (e.g., in which function) there is resource contention (as seems to be the case as you don't see any speedup). Also, please note that not everyone understands Chinese (comments).
Closing until further input received.
I wrote a multi-threaded test function myself, but when testing performance, the performance of multi-threading and single-threading are almost the same, and even multi-threading is slower than single-threading. I want to know why?
CPU:Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz OS:centos7
Compilation of liboqs is followed: mkdir build && cd build cmake -GNinja .. -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../install -DOQS_USE_PTHREADS=ON ninja ninja install
The function that calls liboqs.so for performance testing is as follows:
include "oqs/kem_kyber.h"
include
include
include
include
include
include
include
define SLEEP sleep(1)
unsigned int isContinue = 0; unsigned int g_unTotalTimes[100]; unsigned int loop = 0;
/*****TEST_KYBER****/ void PerformanceTestStatFunc_Kyber512_Keygen(void* argv) { // int _g_unTotalTimes; int i; int times; clock_t ctStart, ctEnd;
}
int myThread_Kyber512_Keygen(void* argv) { unsigned char public_key[OQS_KEM_kyber_512_length_public_key]; unsigned char secret_key[OQS_KEM_kyber_512_length_secret_key]; unsigned char ciphertext[OQS_KEM_kyber_512_length_ciphertext]; unsigned char shared_secreta[OQS_KEM_kyber_512_length_shared_secret]; unsigned char shared_secretb[OQS_KEM_kyber_512_length_shared_secret]; int ret = 5, i;
}
void PerformanceTestStatFunc_Kyber512_Enc(void* argv) { // int _g_unTotalTimes; int i; int times; clock_t ctStart, ctEnd;
}
int myThread_Kyber512_Enc(void* argv) {
}
void test_speed() {
ifndef WIN32
endif
ifdef WIN32
else
endif
ifdef WIN32
else
endif
}
void main() { test_speed(); }