add test to test mpi async send msg sended ok
This commit is contained in:
Родитель
03dc7f88ff
Коммит
4631bff84a
|
@ -72,8 +72,8 @@ void TestArray(int argc, char* argv[]) {
|
|||
|
||||
MultiversoInit(&argc, argv);
|
||||
|
||||
ArrayWorker<float>* shared_array = new ArrayWorker<float>(10);
|
||||
ArrayServer<float>* server_array = new ArrayServer<float>(10);
|
||||
ArrayWorker<float>* shared_array = new ArrayWorker<float>(1000000);
|
||||
ArrayServer<float>* server_array = new ArrayServer<float>(1000000);
|
||||
|
||||
MultiversoBarrier();
|
||||
Log::Info("Create tables OK\n");
|
||||
|
@ -85,17 +85,17 @@ void TestArray(int argc, char* argv[]) {
|
|||
// std::vector<float>& vec = shared_array->raw();
|
||||
|
||||
// shared_array->Get();
|
||||
float data[10];
|
||||
float* data = new float[1000000];
|
||||
|
||||
std::vector<float> delta(10);
|
||||
for (int i = 0; i < 10; ++i)
|
||||
std::vector<float> delta(1000000);
|
||||
for (int i = 0; i < 1000000; ++i)
|
||||
delta[i] = static_cast<float>(i);
|
||||
|
||||
shared_array->Add(delta.data(), 10);
|
||||
shared_array->Add(delta.data(), 1000000);
|
||||
|
||||
Log::Info("Rank %d Add OK\n", MultiversoRank());
|
||||
|
||||
shared_array->Get(data, 10);
|
||||
shared_array->Get(data, 1000000);
|
||||
Log::Info("Rank %d Get OK\n", MultiversoRank());
|
||||
for (int i = 0; i < 10; ++i)
|
||||
std::cout << data[i] << " "; std::cout << std::endl;
|
||||
|
@ -148,8 +148,8 @@ void TestMultipleThread(int argc, char* argv[])
|
|||
//Log::ResetLogLevel(LogLevel::Debug);
|
||||
MultiversoInit(&argc, argv);
|
||||
|
||||
ArrayWorker<float>* shared_array = new ArrayWorker<float>(10);
|
||||
ArrayServer<float>* server_array = new ArrayServer<float>(10);
|
||||
ArrayWorker<float>* shared_array = new ArrayWorker<float>(1000000);
|
||||
ArrayServer<float>* server_array = new ArrayServer<float>(1000000);
|
||||
std::thread* m_prefetchThread = nullptr;
|
||||
MultiversoBarrier();
|
||||
Log::Info("Create tables OK\n");
|
||||
|
@ -158,10 +158,11 @@ void TestMultipleThread(int argc, char* argv[])
|
|||
// std::vector<float>& vec = shared_array->raw();
|
||||
|
||||
// shared_array->Get();
|
||||
float data[10];
|
||||
float* data = new float[1000000];
|
||||
|
||||
std::vector<float> delta(10);
|
||||
for (int i = 0; i < 10; ++i)
|
||||
|
||||
std::vector<float> delta(1000000);
|
||||
for (int i = 0; i < 1000000; ++i)
|
||||
delta[i] = static_cast<float>(i);
|
||||
|
||||
if (m_prefetchThread != nullptr && m_prefetchThread->joinable())
|
||||
|
@ -173,7 +174,7 @@ void TestMultipleThread(int argc, char* argv[])
|
|||
std::mt19937_64 eng{ std::random_device{}() };
|
||||
std::uniform_int_distribution<> dist{ 50, 500 };
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{ dist(eng) });
|
||||
shared_array->Add(delta.data(), 10);
|
||||
shared_array->Add(delta.data(), 1000000);
|
||||
|
||||
Log::Info("Rank %d Add OK\n", MultiversoRank());
|
||||
m_prefetchThread = new std::thread([&](){
|
||||
|
@ -181,7 +182,7 @@ void TestMultipleThread(int argc, char* argv[])
|
|||
std::mt19937_64 eng{ std::random_device{}() };
|
||||
std::uniform_int_distribution<> dist{ 50, 500 };
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{ dist(eng) });
|
||||
shared_array->Get(data, 10);
|
||||
shared_array->Get(data, 1000000);
|
||||
Log::Info("Rank %d Get OK\n", MultiversoRank());
|
||||
for (int i = 0; i < 10; ++i)
|
||||
std::cout << data[i] << " "; std::cout << std::endl;
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
int flag;
|
||||
MPI_Testall(count, handles_.data(), &flag, status);
|
||||
delete[] status;
|
||||
return true;
|
||||
return flag;
|
||||
}
|
||||
private:
|
||||
std::vector<MPI_Request> handles_;
|
||||
|
|
Загрузка…
Ссылка в новой задаче