XGrid FAQ

From CSclasswiki
Jump to: navigation, search

Back to XGrid Programming


The Official Apple XGrid FAQ

How to call the Mathematica Kernel from the command line

--Thiebaut 11:01, 11 November 2008 (UTC)

Assuming Mathematica is installed on your Mac, the command line is

/Applications/Mathematica.app/Contents/MacOS/MathKernel

This will start the Mathematica kernel.

To test it out, create a file called test.m containing these 2 commands:

Print["Hello there!"]
Exit[]

Then make Mathematica execute this simple program with this comand:

/Applications/Mathematica.app/Contents/MacOS/MathKernel -noprompt -run "<<test.m"


How to use the Mathematica kernel to get the residues of a pdb file

Assume the following mathematica module:

 a=Import ["http://xgridmac.dyndns.org/~thiebaut/pdbfiles/pdb100d.ent",  {"Residues"}]
 Print[ a ]
 Exit[]

Run it as follows:

 /Applications/Mathematica.app/Contents/MacOS/MathKernel -noprompt -run "<<getResidues.m"

If we wanted to parameterize the name of the file, we would proceed as follows. Simply make the name of the pdb file in the script something unique, say, PDBPDBPDB:

 a=Import ["httþ://xgridmac.dyndns.org/~thiebaut/pdbfiles/PDBPDBPDB",  {"Residues"}]
 Print[ a ]
 Exit[]

Save the program in a file called getResidues2.m, for example. The PDBPDBPDB string can be easily replaced by a real file name using the perl command line. Assuming that the file we want to process is pdb100d.ent, we simply run:

 perl -i -p -e 's/PDBPDBPDB/pdb100d.ent/'  getResidues2.m 

and the file getResidues2.m now contains:

 a=Import ["httþ://xgridmac.dyndns.org/~thiebaut/pdbfiles/pdb100d.ent",  {"Residues"}]
 Print[ a ]
 Exit[]

The file getResidues2.pm can now be executed by the Mathematica kernel as illustrated above.

How to generate the PLIST version of a file

--Thiebaut 11:01, 11 November 2008 (UTC)

Assume you have a data file called targetFileName and you want to include it into a XGrid batch job, for example. You can get the format by using the hexdump utility, as follows:

hexdump  -v -e ' "" 4/1 "%02x" " "'  targetFileName > plistFileName

The output will be in plistFileName.

How do I find out the environment of a job on an XGrid node?

xgrid -job run machineinfo.pl

where machineinfo.pl is a perl script that gathers various information from the node.

#! /usr/bin/perl
# D. Thiebaut
# reports some basic environment-related information from the node where
# it runs

sub machine_info {
  return if $testing;
  print "----------------------------------------------------\n";
  print "The date is: ";
  system "/bin/date";
  print "----------------------------------------------------\n";
  print "My hostname is: ";
  system "/bin/hostname";
  print "----------------------------------------------------\n";
  print "This computer is:\n";
  system "/usr/sbin/system_profiler SPHardwareDataType";
  print "----------------------------------------------------\n";
  print "My arguments are: @ARGV\n";
  print "----------------------------------------------------\n";
  print "My executable path is: $0\n";
  print "----------------------------------------------------\n";
  print "Path =";
  system "/bin/echo $PATH";
  print "cwd =  ";
  system "/bin/pwd";
  #print "----------------------------------------------------\n";
  #print "This is all the perl processes running:\n";
  #system "/bin/ps -awwx | grep perl";
  print "----------------------------------------------------\n";
  print "This is the contents /var/vm:\n";
  system "/bin/ls -l /var/vm";
  print "----------------------------------------------------\n";
  print "This is the contents of all the sub folders where I am located:\n";
  system "/bin/ls -Rl";
  print "----------------------------------------------------\n";
  print "list of applications:\n";
  system "/bin/ls -l /";
  print "\n\n\n";
}

machine_info();

Answers to common troubleshooting questions

can be found in Chapter 5 of the XGrid Admin and High Performance Computing manual (pdf).