On May 16, 2012, at 8:08 AM, Rohan Deshpande wrote:
> I have following structure of MPI code -
>
> int main(){
>
> MPI_INIT.....
> //initialize MPI
> data = malloc(sizeof(int)*200);
> //initialize data
> /*--------Master---------*/
> if(taskid == 0){
>
> //send data to each slave
> MPI_SEND....
> }
>
> /*----Slaves-------*/
> if(taskid > 0){
>
> //accept data from master
> MPI_RECV....
> //do some calculations
> }
>
> MPI_Finalize()
> }
>
> I have few doubts about the code above.
> In above code, the data is allocated memory in the main program. If I run this program on cluster where
> node 1 is slave and node 0 is master, does node 1 actually shares the memory location of node 0 to perform the calculations?
>
> If I do not want to share the memory, how can i make task on node 1 work independently ?
>
> Thanks in advance.
>
>
>
>
> _______________________________________________