Message Passing Inte ..
229:225
07/12/29 00:39:48
こんな感じ。
#include <mpi.h>
#include <sched.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
int rank;
cpu_set_t mask;
double t;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
__CPU_ZERO(&mask);
__CPU_SET(rank, &mask);
if (sched_setaffinity(0, sizeof(mask), &mask) == -1) {
perror("Failed to set CPU affinity");
goto error;
}
t = MPI_Wtime();
while (MPI_Wtime() - t < 10 + rank * 5)
;
MPI_Finalize();
return 0;
error:
MPI_Finalize();
return -1;
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5208日前に更新/78 KB
担当:undef