Это мой код: < /p>
Код: Выделить всё
#include
#include
#include
#include
int main(int argc, char*argv[]) {
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
if (provided != MPI_THREAD_MULTIPLE) {
throw std::logic_error("Cannot provide threaded MPI\n");
}
try {
omp_set_num_threads(28);
int wr, ws;
MPI_Comm_rank(MPI_COMM_WORLD, &wr);
MPI_Comm_size(MPI_COMM_WORLD, &ws);
MPI_Barrier(MPI_COMM_WORLD);
double starttime = MPI_Wtime();
#pragma omp parallel
{
#pragma omp for
for (long long i = 0; i < 1400000000/ws; i++) {
}
}
double endtime = MPI_Wtime();
MPI_Barrier(MPI_COMM_WORLD);
if (wr == 0) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79440347/mpi-wtime-changes-when-using-openmp[/url]
Мобильная версия