Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ikhaber
Beginner
76 Views

Parallel programming with OpenMP

Hi,

Im developping a traffic training simulator for my Ph. D. thesis. I use VC++ 9.0 and some graphic libraries such as Open Scene Graph, Open Dynamics Engine and etc. My CPU is Intel Core i7 930 @ 2.8GHz and my graphics card is Nvidia Quadro FX 1800.

In simulation loop I control the behaviors of vehicles on traffic. But only one core running for this action. So I dont take performance enoughly. I try to use parallel programming with OpenMP (shown below), but it didnt worked.

int j;

#pragma omp parallel for private(j)

for (j=1;j<=totalAgentNumber;j++)

{

ControlTrafficLights(j);

aWidth=FindVehicleOccupancy(j);

ControlVehiclesPosition(j,aWidth);

mAgentCreator->FollowLane();

mAgentCreator->DriveAgent();

mAgentCreator->CheckInt();

mAgentCreator->ApplyAntiSwayBarForces();

mAgentCreator->UpdateCamera();

}

The Codes as shown above, I control the behaviors of vehicles while moving autonomously.Id like to divide to control vehicles to my core number (8). For example If the number of vehicles is 80, then every core controls 10 vehicles.

How can I do this process by using OpenMP?

Have a good study,

smail KURNAZ

Karabk University

0 Kudos
4 Replies
Ilnar
Beginner
76 Views

what "but it didnt worked" means? it crashes or there are only 1 core is working?
in case it crashes, you should make your source thread safe.
in case there are only 1 thread, it seems you forgot to enable OpenMP support in the project configuration (or /openmp in command line).
ikhaber
Beginner
76 Views

Hi,
Ive been already enable OpenMP. But Whent the program run, in task manager I only seeone core running.And the performance is very low.

Ilnar
Beginner
76 Views

2 assumptions:
- openmp threads num set to 1 -- check out usingomp_get_num_threads
- or process set affinity mask previously -- check using GetProcessAffinityMask
TimP
Black Belt
76 Views

The Intel libiomp5 works as a higher performance replacement for vcomp and supports affinity by the KMP_AFFINITY environment settings. First, of course, you must find out why there appears to be only 1 thread. 2 threads running on a single core might perform similar to a single thread, even with HyperThreading.
Insufficient RAM might also have an effect such as you report. Then there's the question of what is in those functions. If they use any resources which involve serialization (disk file, ......) you could be limited to 1 thread.
Reply