[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fork() on mosix cluster
From: |
willie |
Subject: |
fork() on mosix cluster |
Date: |
Tue, 6 May 2003 06:36:57 -0500 |
Hi there,
I want to evaluate a function f(X) for different inputs Xi in parallel,
i.e. find Yi=f(Xi) for all the Xi that I am interested in. I have access
to a mosix cluster, and want to use the fork() function to start the
different processes, but sometimes (not always) I get "panic:
Segmentation fault -- stopping myself..."
The simple code that I used to test the process is included. Can anyone
please tell me where is the problem in my code? The cluster has GNU
Octave, version 2.1.36 (i686-pc-linux-gnu) installed.
Thank you
Willie Smit
CODE:
w=rand(10,10);
for i=1:2
[file_ids,err,msg]=pipe();
[pid, msg]=fork()
pread(i)=nth(file_ids(1),1);
pwrite(i)=nth(file_ids(2),1);
if(pid>0)
pidc(i)=pid
'parent'
elseif(pid==0)
'child'
for m=1:size(w,1)
for n=1:size(w,2)
if(w(m,n)>0.95)
st=strcat(num2str(m),' ',num2str(n),'\n');
fputs(pwrite(i),st);
end
end
end
fputs(pwrite(i),'eof\n');
'child done'
exit
end
end
for i=1:2
data=fgets(pread(i))
while(strcmp(data,'eof\n')==0)
data=fgets(pread(i))
end
fclose(pwrite(i))
fclose(pread(i))
end
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- fork() on mosix cluster,
willie <=