資源簡(jiǎn)介
運(yùn)用mpi實(shí)現(xiàn)奇偶排序,在不同的處理器之間通過(guò)消息傳遞完成奇偶index的數(shù)的交換,實(shí)現(xiàn)最終的數(shù)列排序
代碼片段和文件信息
//??4005?A1
//??main.cpp
//??student?name:?Yinxian?She
//??student?ID:?115010061
//??Created?by?佘胤嫻?on?2018/10/15.
//use?these?command?lines?to?compile?ane?exe?the?program:
//mpic++?4005a1.cpp?-o?4005a1.out
//mpiexec?--oversubscribe?-n?4?./4005a1.out
#include?
#include?
#include?
#include?//cannot?found??how?about?sys/malloc.h
#include?
#include?
#include?
//need?to?set?in?cpp?file?to?change?the?array?size
int?count?=?10;
int?data[10];
/*function:arraygener
?------------------------
?usage:?to?generate?the?array?with?size?of?[count];
????????all?the?elements?are?random?generated.
?why?put?it?here?
?*/
void?arraygener(){
????//srand((unsigned)?time?(NULL));
????for?(int?i?=0;?i ????????data[i]?=?(int)(rand()/
評(píng)論
共有 條評(píng)論