I have to implement a scenario where I have 2 groups. Group 1 contains only process 0 and 1. Group 2 contains all the processes. Now the processes in Group 2 read some data and send it to Group 1(process 0 or 1, equal division). It should look like this:
Grp1 Grp2
Rank
(grp)
0 0 0
1 1 1
2 2
3 3
4 4 and so on..
Now to implement this, I have used the following code (All the variables and other things are taken care)
program mpi
use mpi
integer ierr,new_rank1,new_grp1,new_rank2,new_grp2,new_comm1,new_comm2
integer numtasks,rank,orig_grp,tag,sendbuf,recvbuf
integer ranks1(2),ranks2(8),stat(MPI_STATUS_SIZE)
data ranks1 /0,1/,ranks2 /0,1,2,3,4,5,6,7/
call mpi_init(ierr)
call mpi_comm_rank(mpi_comm_world,rank,ierr)
call mpi_comm_size(mpi_comm_world,numtasks,ierr)
call MPI_COMM_GROUP(MPI_COMM_WORLD,orig_grp,ierr)
tag = 342
call MPI_GROUP_INCL(orig_grp,8,ranks2,new_grp2,ierr)
call mpi_comm_create_group(mpi_comm_world,new_grp2,112,new_comm2,ierr)
call mpi_comm_rank(new_comm2,new_rank2,ierr)
if(new_rank2 == 4) then
call mpi_send(123,1,MPI_INT,0,tag,new_comm2,ierr) !send a msg from rank 4 of group 2 to rank 0 of group 1
end if
if(rank <2) then
call MPI_GROUP_INCL(orig_grp,2,ranks1,new_grp1,ierr)
call mpi_comm_create_group(mpi_comm_world,new_grp1,111,new_comm1,ierr)
call mpi_comm_rank(new_comm1,new_rank1,ierr)
if(new_rank1 == 0) then
call mpi_recv(recvbuf,1,MPI_INT,4,tag,new_comm2,stat,ierr)
print*,recvbuf
end if
end if
call mpi_finalize(ierr)
end
Facing errors in sending and receiving data. The other things work fine. And also if the whole concept is wrong, I am open to suggestions.
The keystroke on my script take around 5/7 seconds until going to the next step.
I didn't set any delay.
E.g :
-- Click 1
click pop up button 1 of group 2 of group 2 of group 1 of group 2 of group 6 of group 2 of group 1 of group 4 of UI element 1 of scroll area 1 of group 1 of splitter group 1 of window 1
keystroke "Edit"
keystroke return
-- Click 2
click pop up button 1 of group 2 of group 1 of group 1 of group 2 of group 2 of group 6 of group 2 of group 1 of group 4 of UI element 1 of scroll area 1 of group 1 of splitter group 1 of window 1
keystroke "Standard"
keystroke return
So basically, its clicking, show the Click Pop up button, wait 7 secondes, then continue the script.
Any idea?
Don't get your hopes up, but you can try to wrap problem lines in time out or ignoring application responses.
try
with timeout of x seconds
--
end timeout
end try
.
ignoring application responses
--
end ignoring
Hi I have two tables in DB.The first table is given below.
Table name-
t_hcsy_details
class name in model-
class THcsyDetails < ActiveRecord::Base
end
The values in side table is given below.
HCSY_Details_ID HCSY_ID HCSY_Fund_Type_ID Amount
1 2 1 1125
2 2 2 390
3 2 3 285
4 2 4 100
5 2 5 60
6 2 6 40
My second table is given below.
Table Name:
t_hcsy_fund_type_master
class in model:
class THcsyFundTypeMaster < ActiveRecord::Base
end
Table values are given below.
HCSY_Fund_Type_ID Fund_Type_Code Fund_Type_Name Amount
1 1 woods 1125
2 2 Burning 390
3 3 goods 285
4 4 brahmin 100
5 5 swd 60
6 6 Photo 40
I know only HCSY_ID value(i.e-2) of first table.But i need Fund_Type_Name and Amount from second table.As you can see one HCSY_ID has 6 different records.But i need all Fund_Type_Name and Amount of one HCSY_ID. Please help me to resolve this issue by creating object for both two classes shown above.Please help me.
You haven't specified any relationships setup, so it would be easier to split this in two queries:
# you already have hcsy_id
fund_type_ids = THcsyDetails.where(hcsy_id: hcsy_id).pluck(:hcsy_fund_type_id)
fund_types = THcsyFundTypeMaster.where(id: fund_type_ids)
fund_types.group(:fund_type_name).sum(:amount)
In case you had proper relationships setup, the above would've simplified to:
THcsyDetails.
joins(association_name). # THcsyFundTypeMaster
where(hcsy_id: hcsy_id).
group("#{t = THcsyFundTypeMaster.table_name}.fund_type_name").
sum("#{t}.amount")
Problem with my oozie co-ordinator application.
Case 1 :
For -
start = "2012-09-07 13:00Z" end="2012-09-07 16:00Z" frequency="coord:hour(1)"
No of actions : 1 (expected is 3)
Nominal Times -
1) 2012-09-07 13:00Z (Two more are expected. 2012-09-07 14:00Z,2012-09-07 15:00Z)
Case 2 :
For -
start = "2012-09-07 13:00Z" end="2012-09-07 16:00Z" frequency = "coord:minutes(10)"
No of actions : 6 (expected is 18)
Nominal Times :
1) 2012-09-07 13:00Z
2) 2012-09-07 13:10Z
3) 2012-09-07 13:20Z
4) 2012-09-07 13:30Z
5) 2012-09-07 13:40Z
6) 2012-09-07 13:50Z (12 more are expected. 2012-09-07 14:00Z,2012-09-07 14:10Z and so on..).
Generalization based on observation :
Any frequency from coord:minutes(1) to coord:minutes(59), the nominal times are perfectly calculated, but only till one hour.
Please suggest if I am missing anything here. Using oozie 2.0, trying with a basic co-ordinator app which is working fine for :
start = "2012-09-07 13:00Z" end = "2012-09-07 13:30Z" frequency = "coord:minutes(10)"
Do the 6 actions finish successfully? There are 3 conditions that Oozie Coordinator will check before invoke 1 new action: 1) data dependency 2) frequency 3) concurrency limit. Any of these 3 conditions may stop the action from being started. It will be helpful if you can show us the coordinator's xml file.
When i ran this piece of code
private void button1_Click(object sender, EventArgs e)
{
Start(sender, e);
}
private void Start(object sender, EventArgs e)
{
for (int i = 0; i < 5; i++)
{
System.Threading.Tasks.Task.Factory.StartNew(() => dosomething(i));
Debug.WriteLine("Called " + i);
}
Debug.WriteLine("Finished");
}
public void dosomething(int i)
{
Debug.WriteLine("Enters " + i);
lock (this)
{
Debug.WriteLine("Working " + i);
Thread.Sleep(100);
}
Debug.WriteLine("Done " + i);
}
output is different with .Net version 4.0 and 4.5. With 4.0 number 5 is repeated I can see the reason value of i is moved to 5 before some of the Tasks executed but same code with 4.5 shows different output.
(output ran with VS 2010 .Net 4.0)
Called 0
Called 1
Enters 1
Working 1
Called 2
Called 3
Called 4
Finished
Enters 0
Done 1
Enters 5
Working 0
Working 5
Done 0
**Enters 5
Working 5
Done 5
Enters 5
Done 5
Working 5
Done 5**
but when i ran with .Net 4.5 (VS 2011 beta) the result is,
(output ran with VS 2011 beta .Net 4.5)
Enters 0
Working 0
Called 0
Called 1
Enters 2
Called 2
Enters 2
Enters 3
Called 3
Called 4
Finished
Done 0
Working 2
Enters 5
Done 2
Working 3
Done 3
Working 5
Done 5
Working 2
Done 2
I couldn't see changes done with Task under CLR 4.5? Can anyone point me what are the changes with .Net 4.5 please.
Your code has a race condition. Let's say the loop finishes executing before any of the tasks gets started. This is entirely possible.
Then i will have a value of 5 in all tasks. This is the bug.
Solution: Copy i to a loop-local variable and use this local in the task's lambda.
Your code has a race condition. What that means is that it can behave in various way, depending on the exact order of operations.
And any small change may affect the order of operations, so it's not unexpected that your code will behave differently under different versions of the framework. Actually, I would expect it to behave differently when run multiple times for the same version of .net.