LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-26-2004, 02:51 AM   #1
alisha
LQ Newbie
 
Registered: Mar 2004
Posts: 2

Rep: Reputation: 0
how to integrate c++ into mpich


hi ,

i need to make the following c++ code run by integrating it with mpich-1.2.5.2 can someone plzzzzz give me some tips on how to integrate it. i'm working on a 4 node cluster(using linux platform) implementing parallel computing but have no experience with mpich. The c++ code i want to run in mpich is:
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include <process.h>
void main(void)
{
clrscr();
float U[500],V[500],THALF,DX,DT;

int NP1;
//defining constants

float T=0.0;
const float TF=20.0;
const float LEN=10.0;
const int N=10;
const float K=0.53;
const float RATIO=0.25;
const float RHO=2.70;
const float C=0.226;
V[0]=0.0;
V[N-1]=100.0;
//read in the initial temperatures and write them out
NP1=N+1;
DX=LEN/N;
DT=(RATIO*C*RHO*DX*DX)/K;
cout<<"ENTER INITIAL VALUES "<<endl;
for (int I=0;I<NP1;I++)
{ //cin>>U[I];
U[I] = 20.0;
}
for (I=0;I<NP1;I++)
{cout<<U[I];
}
getche();
cout<<"POTENTIAL VALUES IN ONE DIMENSION BY EXPLICIT METHOD"<<endl;
cout<<"FOR X="<<T<<"TO X="<<TF;
cout<<"WITH DELTA X OF"<<DX<<endl;
cout<<"AT T="<<T<<endl;
for (I=1;I<N-1;I++)
{cout<<U[I]<<" ";
}

LABEL:
{
THALF=T+(DT/2.0);
U[0]=0.0;
U[N]=100.0;
for(I=1;I<N;I++)
{
V[I]=RATIO * ((U[I+1] +U[I-1]) + ((1.0 -(2.0 *RATIO)) * U[I]));
}
T=T+DT;
V[0]=0.0;
V[N-1]=100.0;

cout<<endl<<"VALUES AT= "<<T<<endl;
for(I=0;I<=N;I++)
{ cout<<V[I]<<" ";
}
if(T>TF)
{ exit(0);
}
//now doing second set of values
THALF=T+(DT/2.0);
V[0]=0.0;
V[N]=100.0;
I=2;
for(I=1;I<N;I++)
{
U[I]=RATIO * (V[I+1] +V[I-1]) + (1.0 -(2.0 *RATIO)) * V[I];
}
T=T+DT;
U[0]=0.0;
U[N]=100.0;
cout<<endl<<"VALUES AT"<<T<<endl;

for(I=0;I<NP1;I++)
{cout<<U[I]<<" ";
}
}
while(T<=TF)
goto LABEL;
getche();
}


thanx
Alisha
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mpich chui_yap Linux - General 1 03-20-2005 05:32 PM
MPICH installation on Redaht 9 haoscar Linux - Software 0 07-19-2004 08:42 PM
MPICH problem JJX Linux - General 0 03-19-2004 01:12 PM
problem met when installing mpich!!!!! annie Linux - Software 1 08-13-2003 03:59 AM
where can i get help on installing MPICH? srkherad Linux - General 4 11-04-2002 03:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration