hi,
it's concerning my senior project, and i have submit it in 2 days.
i've created a new project, then enabled the support of openMP from the property page->c/c++->languages->openMP support (Generate Parallel Code (/openmp, equiv. to /Qopenmp))
i have a core 2 duo intel centrino.
i'm using Microsoft visual studio 2008.
OS: windows 7 professional.
this is a simple test program just to understand the major stuff in the parallel studio:
#include
#include
#include
using namespace std;
int main()
{
omp_set_num_threads(2); //creat 2 threads.
LARGE_INTEGER frequency; // ticks per second //for the timer
LARGE_INTEGER t1, t2; // ticks // for the timer
double elapsedTime; //for the timer
QueryPerformanceFrequency(&frequency);
int A[1000],B[1000],z=1;
for(int i=0;i<1000;i++)
{
A[i]=B[i]=z;
z++;
}
//start timer
QueryPerformanceCounter(&t1);
#pragma omp parallel for
for(int i=0;i<1000;i++)
{
A[i]=B[i]+A[i];
z++;
}
QueryPerformanceCounter(&t2);
// compute and print the elapsed time in millisec
elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
cout << elapsedTime << " ms.\\n";
return 0;
}
-----------------------------------------------------------------------------------------------
then, right click on the solution->set startup solutions
then,right click on the solution->intel parallel composer->use intel C++...
this is the result of the program timer: 0.287799ms
this is the result of the parallel amplifier:
-Elapsed time:0.283s
-CPU time: 0.202s
-Unused CPU time: 0.274s
-core count: 2
-Threads Created: 2
when i run this program without parallelism, that means when i made these 2 lines as comment:
omp_set_num_threads(2);-> //omp_set_num_threads(2);
#pragma omp parallel for ->//#pragma omp parallel for
this is the result of the program timer: 0.0069175ms
this is the
result of the parallel amplifier:
-Elapsed time:0230.ms
-CPU time:
0.217s
-Unused CPU time: 0.243s
-core count: 2
-Threads
Created: 1
it's so weird... i guess i have to modify something in my compiler? plz help
i have another couple of questions:
1-can i parallelize a loop to read from a file?
for(int i=0,i<100,i++)
myfile>>A[i];
can i ?????
2-check the below image, this is a reading from my parallel amplifier.
when i double click on a function, it should take me to the line where it's spending the time written, but not.
the arrows are the result from double clicking every function. these results are nothing, it asks me for a location on my laptop... as for the remaining one, where no arrow is coming out, double clicking on it doesn't do anything.
what does all this means?
thank's in advance :)
sorry for bothering :)



