- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Pentium 3.00, support Hyper-Threading technology,1G memory,
window xp sp2 operation system.
sum=ParallelFun(0,LL,LL,MM,NN);
and the parallel way :
#pragma omp parallel sections
{
#pragma omp section
sum1=ParallelFun(0,LL/2,LL,MM,NN);
#pragma omp section
sum2=ParallelFun(LL/2,LL,LL,MM,NN);
}
the ParallelFun is here:
{
double temp1,temp2,temp3;
double temp=0;
double t;
int i,j,k;
for(i=start;i
temp1=i*M*N;
temp2=j*N;
temp3=k*L;
t=sin(temp1)+cos(temp2)+tan(temp3+temp2+temp1);
temp+=t;
}
return temp;
}
for(i=0;i
first=(long)i*MNT+(long)j*NT+k;//***
if((int)Att[first]!=1 && (int)Att1[first]!=103)
if(Att[first]==Att[first+MNT])
Axr=cThermal.Htcf[Att[first]];
else
{
if(Att1[first+MNT]==103)
Axr=0;
else
Axr=2.0/(Htcf0[Att[first]]+Htcf0[Att[first+MNT]]+2.0/ (dFluidP.ST*cThermal.Fhm[Att[first]][Att[first+MNT]]));
}
call in a function :
{
#pragma omp section
ParallelTempC alOnly(0,LT/2,LT,MT,NT,Tn,Tt,Htcf0);
#pragma omp section
ParallelTempCalOnly(LT/2,LT,LT,MT,NT,Tn,Tt,Htcf0);
}
...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am very sorry to submit a question here,I never do it in future.
my small example isperform well on my computer,I am tell the truth,the full codes are here, I say that the accelerate rateis 1.4 or more,that is a graphical user interface program,I click a button and start to compute the following code,I compiled them in Visual studio 2003 integrated with intel c++9.0,it is a Debug Version,it's slower than the program compiled by the intel c++ with command line and without GUI support. if compile them by intel c++ command line,I am amazed by the result.
#include
#include
#include
#include "omp.h"
using namespace std;
#define LL 400
#define MM 400
#define NN 400
double sum=0;
double ParallelFun(int start,int end,int L,int M,int N);
int main(int argc, char* argv[])
{
DWORD t1=GetTickCount();
cout<<"Serial Program is running..."<
cout<<"Serial program is ended "<
cout<<"The total time is :"<
DWORD t3=GetTickCount();
cout<<"parallel Program is running..."<
double sum1,sum2;
#pragma omp parallel sections
{
#pragma omp section
sum1=ParallelFun(0,LL/2,LL,MM,NN);
#pragma omp section
sum2=ParallelFun(LL/2,LL,LL,MM,NN);
}
cout<<"sum1="<
cout<<"parallel program is ended "<
cout<<"The total time is :"<
double ParallelFun(int start,int end,int L,int M,int N)
{
double temp1,temp2,temp3;
double temp=0;
double t;
int i,j,k;
for(i=start;i
temp1=i*M*N;
temp2=j*N;
temp3=k*L;
t=sin(temp1)+cos(temp2)+tan(temp3+temp2+temp1);
temp+=t;
}
return temp;
}
D:2003 estsections>icl testsections.cpp /Qopenmp
Intel C++ Compiler for 32-bit applications, Version 9.0 Build 20051130Z Pa
ckage ID: W_CC_C_9.0.028
Copyright (C) 1985-2005 Intel Corporation. All rights reserved.
testsections.cpp
testsections.cpp(33) : (col. 1) remark: OpenMP DEFINED SECTION WAS PARALLELIZED.
Microsoft Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
-out:testsections.exe
-nodefaultlib:libguide_stats.lib
-nodefaultlib:libguide40_stats.lib
-defaultlib:libguide.lib
testsections.obj
D:2003 estsections>testsections.exe
Serial Program is running...
Serial program is ended
sum=:-1.49431e+007
The total time is :19266
parallel Program is running...
sum1=-2.01281e+007
sum2=5.18504e+006
parallel program is ended
sum=:-1.49431e+007
The total time is :6344
Accelerate rate is :3.03689
D:2003 estsections>testsections.exe
Serial Program is running...
Serial program is ended
sum=:-1.49431e+007
The total time is :19234
parallel Program is running...
sum1=-2.01281e+007
sum2=5.18504e+006
parallel program is ended
sum=:-1.49431e+007
The total time is :6344
Accelerate rate is :3.03184
I ama mazed that the accelerate rateislarger than 2 in theory,and I can not using /Qopenmp-report2 option,maybe is my install problem.
D:2003 estsections>icl testsections.cpp /Qopenmp-report2
Intel C++ Compiler for 32-bit applications, Version 9.0 Build 20051130Z Pa
ckage ID: W_CC_C_9.0.028
Copyright (C) 1985-2005 Intel Corporation. All rights reserved.
testsections.cpp
testsections.cpp(33): warning #161: unrecognized #pragma
#pragma omp parallel sections
^
testsections.cpp(35): warning #161: unrecognized #pragma
#pragma omp section
^
testsections.cpp(37): warning #161: unrecognized #pragma
#pragma omp section
^
Microsoft Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
-out:testsections.exe
testsections.obj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page