Re: [問題] linux指令下操控雲端運算

看板LinuxDev作者 (CEO)時間13年前 (2012/10/08 19:01), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串2/3 (看更多)
※ 引述《ntwu (CEO)》之銘言: : 假設今天我要將兩台以上雲端一起跑一個code : 這個做法聽說要做到跨節點運算,好像程式碼也要改成mpi架構 : 我現在已經將code加上Mpi架構,實際mpicc可以執行 : 但我要怎麼用指令 來做跨節點運算阿???? : 請雲端大大們,為小弟指點 #include <stdio.h> #include <time.h> main(){ int max = 100000; int i; time_t now; time(&now); for(i = 0; i < max;i++){ printf("%d\n",i); } time_t now2; time(&now2); printf("It's %s\n", ctime(&now)); printf("It's %s", ctime(&now2)); } 上面原code 下面改過的code #include <stdio.h> #include <mpi.h> #include <time.h> int main (argc, argv) int argc; char *argv[]; { int rank, size; MPI_Init (&argc, &argv); /* starts MPI */ MPI_Comm_rank (MPI_COMM_WORLD, &rank); /* get current process id */ MPI_Comm_size (MPI_COMM_WORLD, &size); /* get number of processes */ int max = 100000; int i; time_t now; time(&now); for(i = 0; i < max;i++){ printf("%d\n",i); } time_t now2; time(&now2); printf("It's %s\n", ctime(&now)); printf("It's %s", ctime(&now2)); printf( "Hello world from process %d of %d\n", rank, size ); MPI_Finalize(); return 0; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 120.96.170.167

10/19 20:39, , 1F
不是不想幫忙,只是年代久遠要pickup不知要花多少時間…
10/19 20:39, 1F
文章代碼(AID): #1GShAU2y (LinuxDev)
文章代碼(AID): #1GShAU2y (LinuxDev)