Prev: find vector
Next: fsolve problem
From: michael on 19 May 2010 10:36 for i=1:size(APLocation,1) point=APLocation(i,:); parfor j=1:length (RXpoint) rssi(i,j) = LOSS(point,RXpoint(:,j)'); %%rssi having the signal strength from all AP's end end when i'm running the following code, i get the same value for each element of rssi (serially i get different results) where is my problem?
From: Jeremy Greenwald on 19 May 2010 10:55 Creating some fake data and and implementing a simple LOSS function, I do not see a different between the serial and parallel execution. Does LOSS use any persistent or global variables? function [ rssi rssi2 ] = foo APLocation = rand(10); RXpoint = rand(10) * 5; for i=1:size(APLocation,1) point=APLocation(i,:); parfor j=1:length (RXpoint) rssi(i,j) = LOSS(point,RXpoint(:,j)'); end end for i=1:size(APLocation,1) point=APLocation(i,:); for j=1:length (RXpoint) rssi2(i,j) = LOSS(point,RXpoint(:,j)'); end end end function rv = LOSS( a,b ) rv = sum( a+b ); end "michael" <bezenchu(a)gmail.com> wrote in message news:ht0t0k$fce$1(a)fred.mathworks.com... > for i=1:size(APLocation,1) > point=APLocation(i,:); > parfor j=1:length (RXpoint) > rssi(i,j) = LOSS(point,RXpoint(:,j)'); %%rssi having the signal > strength from all AP's > end > end > > when i'm running the following code, i get the same value for each element > of rssi (serially i get different results) > > > where is my problem? >
From: michael on 19 May 2010 11:09 yes LOSS uses some global variables but they doesn't change in LOSS. they have constant value and i use them only to simplify my program. "Jeremy Greenwald" <jgreenwa(a)mathworks.com> wrote in message <ht0u4f$d5$1(a)fred.mathworks.com>... > Creating some fake data and and implementing a simple LOSS function, I do > not see a different between the serial and parallel execution. Does LOSS > use any persistent or global variables? > > > > function [ rssi rssi2 ] = foo > > > > APLocation = rand(10); > > RXpoint = rand(10) * 5; > > > > for i=1:size(APLocation,1) > > point=APLocation(i,:); > > parfor j=1:length (RXpoint) > > rssi(i,j) = LOSS(point,RXpoint(:,j)'); > > end > > end > > > > for i=1:size(APLocation,1) > > point=APLocation(i,:); > > for j=1:length (RXpoint) > > rssi2(i,j) = LOSS(point,RXpoint(:,j)'); > > end > > end > > > > end > > > > function rv = LOSS( a,b ) > > rv = sum( a+b ); > > end > > > "michael" <bezenchu(a)gmail.com> wrote in message > news:ht0t0k$fce$1(a)fred.mathworks.com... > > for i=1:size(APLocation,1) > > point=APLocation(i,:); > > parfor j=1:length (RXpoint) > > rssi(i,j) = LOSS(point,RXpoint(:,j)'); %%rssi having the signal > > strength from all AP's > > end > > end > > > > when i'm running the following code, i get the same value for each element > > of rssi (serially i get different results) > > > > > > where is my problem? > > >
From: Jeremy Greenwald on 19 May 2010 13:06 It may be that the global variables used by LOSS are not initialized on the workers. Can you verify that the values of the global variables are set on the workers? "michael" <bezenchu(a)gmail.com> wrote in message news:ht0uuh$p08$1(a)fred.mathworks.com... > yes > > LOSS uses some global variables but they doesn't change in LOSS. > they have constant value and i use them only to simplify my program. > > "Jeremy Greenwald" <jgreenwa(a)mathworks.com> wrote in message > <ht0u4f$d5$1(a)fred.mathworks.com>... >> Creating some fake data and and implementing a simple LOSS function, I do >> not see a different between the serial and parallel execution. Does LOSS >> use any persistent or global variables? >> >> >> >> function [ rssi rssi2 ] = foo >> >> >> >> APLocation = rand(10); >> >> RXpoint = rand(10) * 5; >> >> >> >> for i=1:size(APLocation,1) >> >> point=APLocation(i,:); >> >> parfor j=1:length (RXpoint) >> >> rssi(i,j) = LOSS(point,RXpoint(:,j)'); >> >> end >> >> end >> >> >> >> for i=1:size(APLocation,1) >> >> point=APLocation(i,:); >> >> for j=1:length (RXpoint) >> >> rssi2(i,j) = LOSS(point,RXpoint(:,j)'); >> >> end >> >> end >> >> >> >> end >> >> >> >> function rv = LOSS( a,b ) >> >> rv = sum( a+b ); >> >> end >> >> >> "michael" <bezenchu(a)gmail.com> wrote in message >> news:ht0t0k$fce$1(a)fred.mathworks.com... >> > for i=1:size(APLocation,1) >> > point=APLocation(i,:); >> > parfor j=1:length (RXpoint) >> > rssi(i,j) = LOSS(point,RXpoint(:,j)'); %%rssi having the signal >> > strength from all AP's >> > end >> > end >> > >> > when i'm running the following code, i get the same value for each >> > element of rssi (serially i get different results) >> > >> > >> > where is my problem? >> > >> >
|
Pages: 1 Prev: find vector Next: fsolve problem |