Difference: HowToGuides (15 vs. 16)

Revision 162011-04-07 - mavc

Line: 1 to 1
 

How-To Guides

Using R

Apr 6, 2011

Installing R and RServe

Installing R

Added:
>
>
see http://www.r-project.org/
 

Installing packages

  • Installing packages can be done from the R interpreter with the line > install.packages(c('perm','boot'))
  • Installed packages must be loaded using > library(boot)

Running RServe

see http://rosuda.org/Rserve/doc.shtml

  1. Command line: R CMD Rserve --RS-conf <config file>
    • config file must have the following line: remote enable

Running ExperimentRunner

Mar 28, 2011
  1. If you have access, clone the git repository located at ssh://[name]@okanagan.cs.ubc.ca/ubc/cs/project/arrow/git/smac.git - the experiment runner is currently only located in the [smac working copy] branch. The files are temporarily available from /ubc/cs/project/arrow/mavc/halspace/
  2. You will want to have a directory with the following directories or links:
    • algorithms/ containing algorithm executables/wrappers.
    • features/ containing .csv instance feature files.
    • instances/ containing instances.
    • scenarios/ containing JSON scenario files.
    • targetalgs/ containing target algorithm wrappers.
    • These are temporarily available from /ubc/cs/project/arrow/mavc/halspace
  3. Set the db name.
    • If you used a MySQL Database, you will need to get the MySQL plugin from the HAL Website ssh://[name]@okanagan.cs.ubc.ca/ubc/cs/project/arrow/git/mysql-hal.git
    1. Running locally: See Running Locally
    2. Running on Arrow: See Running on Arrow
    3. Running on Westgrid: See Running on Westgrid
  4. The Experiment Runner requires classes from HAL. You can grab HAL from ssh://[name]@okanagan.cs.ubc.ca/ubc/cs/project/arrow/git/hal.git
  5. Export jar to the directory structure, from right-click -> export -> Runnable Jar. This requires a Run Configuration, which you can create by running CmdLineExperimentRunner.java from Eclipse. Alternatively, run it from Eclipse with the appropriate Run Configuration.
  6. Run the .jar with the command java -jar .jar [options]. Running with no options provided will print a usage statement.

Running Locally

  • The MCR library must be on the java library path.
    • With bash: export LD_LIBRARY_PATH = /cs/local/lib/pkg/matlab-7.10/runtime/glnxa64/ (or the appropriate path for your installation).
    • With csh : setenv LD_LIBRARY_PATH /cs/local/lib/pkg/matlab-7.10/runtime/glnx86/
  • Note that the MCR is version-dependent. It will not work with alternate versions of matlab.

Running on Arrow

  • We don't support this directly. See Frank's script /ubc/cs/project/arrow/hutter/hal/runOnCluster.rb for an example of how to do this.

Running on Westgrid

  • There are some special considerations for running on Westgrid
    1. Installing ruby (for ParamILS and wrapper scripts)
    2. Installing MCR (for SMAC). The MCR installer can be located in the following locations:
      1. /cs/local/lib/pkg/matlab-7.10/toolbox/compiler/deploy/glnx86/MCRInstaller.bin
      2. /cs/local/lib/pkg/matlab-7.10/toolbox/compiler/deploy/glnxa64/MCRInstaller.bin
    3. Setting up Directory Structure - see above.
  • Mathworks recommends the following for linux:
			*		 setenv LD_LIBRARY_PATH  
								<MCR_ROOT>/bin/glnx86:
								<MCR_ROOT>/sys/os/glnx86:
								<MCR_ROOT>/sys/java/jre/glnx86/jre1.4.2/lib/i386/client:
								<MCR_ROOT>/sys/java/jre/glnx86/jre1.4.2/lib/i386:
								<MCR_ROOT>/sys/opengl/lib/glnx86:${LD_LIBRARY_PATH}

			*		 setenv XAPPLRESDIR <MCR_ROOT>/X11/app-defaults

Monitoring with Hal

  1. Start HAL with the command java -jar hal.jar. This will create a hal.json file.
  2. Modify the JSON file and change the database name if necessary.
  3. Add the necessary plugins to the plugins/ folder.
    1. MySQL:
    2. SMAC:
  4. After you start HAL with the right database, you can monitor your jobs through http://localhost:8080/hal/

Westgrid Quick Start

Getting a Westgrid account

Getting files onto Westrid

Submitting jobs to Westgrid

Matlab Builder JA Quick Start

See attached user guide

Hello World

A "Hello World" example is described below. We will describe how to call the following Matlab function from Java.

function hello
% Hello world example
% hello.m

fprintf(1, 'Hello World\n');

Exporting JAR

  1. MCR must be installed and its directory added to the system's path variable.
  2. Create a new deployment project by entering deploytool into the Matlab command window.
  3. In the Deployment Tool window, create the necessary classes by clicking [Add Class]. For each class, add the matlab function (*.m) files that belong to the class by selecting [Add files].Add classes and matlab functions
  4. Create the Java Package by selecting the build button. This will create src and distrib folders containing your [project].jar file. The name of the jar file may be specified from Settings.

Calling code from Eclipse

  1. Add [project].jar and javabuilder.jar to the build path. The javabuilder.jar should be located in /toolbox/javabuilder/jar/javabuilder.jar inside your Matlab folder.
  2. Any code that calls code from these java classes must also import com.mathworks.toolbox.javabuilder.*.
  3. Call the function like a normal Java method from an instance of the class. Conversion between Java and Matlab types may be handled either automatically or explicitly (see next section).

Data Types and Conversion

Data conversion classes are available in the following hierarchy:
  • MWArray
    • MWNumericArray
    • MWLogicalArray
    • MWCharArray
    • MWCellArray
    • MWStructArray

Matlab Builder will perform conversion from native types automatically, and constructors can be used with Java types and arrays.

Pass by reference is available with the MWJavaObjectRef wrapper, a subclass of MWArray.

Javadoc Location

  • Javadocs for JavaBuilder are located: here, after registering for a free account.
  • You can read Mathwork's DMCA notice that took down mirrors of the site here.

Turning off display.

  • Sometimes, you might see a message about the display. The matlab display can be turned off with the "-nodisplay" option: MWApplication.initializeApplication(MWMCROption.NODISPLAY);

HAL quick start guide

see http://hal.cs.ubc.ca/

META FILEATTACHMENT attr="" comment="Matlab Builder JA User Guide" date="1294351199" name="javabuilder.pdf" path="javabuilder.pdf" size="1436238" user="mavc" version="1.1"
META FILEATTACHMENT attr="h" comment="" date="1294354780" name="java_t1.png" path="java_t1.png" size="41903" user="mavc" version="1.1"
META FILEATTACHMENT attr="h" comment="Matlab Builder JA User Guide" date="1294355290" name="java_t2.png" path="java_t2.png" size="10105" user="mavc" version="1.1"
META TOPICMOVED by="mavc" date="1294956313" from="BETA.HALWebTutorial" to="BETA.HowToGuides"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback