source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/BlueCCal/MultiCamValidation/FindingPoints/im2pmultiproc.pl @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#! /usr/bin/perl -w
2
3# find projections of LEDs in images
4# it spreads the job to all specified processors/machines
5# It requires:
6# - matlab
7# - configdata.m
8# - expname
9#
10# script is useful if more machines or more processors
11# are available.
12# automatic ssh authentication is necessary, see
13# http://www.cs.umd.edu/~arun/misc/ssh.html
14# http://www.cvm.uiuc.edu/~ms-drake/linux/ssh_nopw.html
15
16# $Author: svoboda $
17# $Revision: 2.0 $
18# $Id: im2pmultiproc.pl,v 2.0 2003/06/19 12:07:11 svoboda Exp $
19# $State: Exp $
20
21use Env;
22# use XML::Simple;
23# use Data::Dumper;
24
25# name of the m-file template
26$mfile="im2imstat";
27$mvariable="CamsIds";
28$donefile=".done";
29
30# not yet ready
31# $config = XMLin('multiprocAtlantic.xml');
32# print Dumper($config);
33# @processes = @$config->
34
35# load the info about local machines and parallel processes
36use virooms;
37
38# just a debug cycle   
39foreach $process (@processes) {
40        print "$process->{'compname'} \n";
41        foreach $camId (@{$process->{'camIds'}}) {
42                print "$camId \n";
43        }
44}
45 
46# create temporary m-files with using the template m-file
47# store their names for delete at the very end
48# each process must have its own temporary m-file
49
50# compose the names and commands
51foreach $process (@processes) {
52        $idfile="";
53        $str4cmd="";
54        foreach $camId (@{$process->{'camIds'}}) {
55                $idfile = "$idfile$camId";
56                $str4cmd = "$str4cmd $camId";
57        }
58        $process->{'scriptName'} = "$ENV{'PWD'}/$mfile${idfile}.m";
59        $process->{'donefile'} = "$ENV{'PWD'}/${donefile}${idfile}";
60        $process->{'catcmd'} = "echo \"${mvariable} = [${str4cmd}]; donefile='$process->{'donefile'}'; addpath $ENV{'PWD'}; addpath $ENV{'PWD'}/../Cfg; \" | cat - ${mfile}.m > $process->{'scriptName'}";
61        $process->{'mcmd'} = "ssh $process->{'compname'} /pub/bin/matlab -nosplash -nojvm < $process->{'scriptName'} > $process->{'scriptName'}.out &";
62}
63
64print "*************************** \n";
65
66# create the auxiliary scripts
67foreach $process (@processes) {
68        system($process->{'catcmd'});
69}
70
71# run the parallel matlabs
72foreach $process (@processes) {
73        system($process->{'mcmd'});
74}
75
76# wait until all processing is done
77print "Image processing in progress. Plase be patient \n";
78do {
79        sleep 10;
80        @donefiles = glob("${donefile}*");
81} while (@donefiles < @processes);
82
83# copy the data files to a coomon disc space yet to be implemented
84
85# final cleaning of the auxiliary files
86foreach $process (@processes) {
87        system("rm -f $process->{'donefile'}");
88        system("rm -f $process->{'scriptName'}");
89        system("rm -f $process->{'scriptName'}.out");
90}
91# system("rm -f *.out");
92
Note: See TracBrowser for help on using the repository browser.