Instructions for Using Multiple Chips with GENOUD and Genetic Matching
The following steps will show you how to use multiple chips in
your computer when using the R packages
R-GENetic Optimization Using Derivatives (by Walter R. Mebane, Jr. and Jasjeet
S. Sekhon ) and
Genetic Matching (by Jasjeet S. Sekhon ). A clone of this webpage
can be found at Jasjeet Sekhon's RGENOUD webpage .
The instructions vary according to your
computer's operating system. Instructions of OS X, Linux and other
Unix-like systems are provided in the next section, and the subsequent
section provides instructions for Microsoft Windows.
Instructions for OS X, Linux or any other Unix-like system
- In order to use multiple chips, you must install the R
package 'snow', which is available in the CRAN repositories. You
can install it using the 'R CMD INSTALL' command or by typing
'install.packages("snow", dependencies=TRUE)' in an R
session.
- Create a directory to store the needed files. We will assume that this directory is called 'test'.
- Copy the files AutoCluster3.R and a1dual.R to the 'test' directory you just
created. You can download these files from Jasjeet Sekhon's
website at http://sekhon.berkeley.edu/rgenoud/test.
- The file a1dual.R runs GenMatch() using all or some of
the chips available in your computer. Remember that in order to
use multiple chips, you must install and load the 'snow' library
(see step 1). The line 'cl <- NCPUS()' creates the cluster
object by calling the function 'NCPUS()', and this object is
then passed to 'GenMatch()' via the 'cluster' option.
The function 'NCPUS()' is in the file AutoCluster3.R, which you must source at
the beginning of the file. If the file is in your working
directory, you can source it by just typing
'source("AutoCluster3.R")'.
The 'NCPUS()' function can be called with or without
arguments. When the function 'NCPUS()' is executed with no
arguments, the number of chips available in the computer is
automatically detected and a cluster is created using as many
chips as there are available. Alternatively, the user can specify
the precise number of chips to be used by passing the number of
chips as an argument. For example, 'cl <- NCPUS(nchips=4)' would
create a cluster using exactly four chips in the computer
(assuming that the computer does have four chips). If your
computer had two chips and you wanted to create a cluster using
both chips, you would type 'cl <- NCPUS(nchips=2)'.
- Done. The file a1dual.R will run 'GenMatch()' using multiple
chips in your computer.
Instructions for Windows
- In order to use multiple chips, you must install a
*special* version of the R package 'snow' prepared by Jasjeet
Sekhon. In order to install this version, you can either
download the package from http://sekhon.berkeley.edu/rgenoud/test/snow_0.2-2999.zip
and use the 'R CMD INSTALL' command, or type
'install.packages("snow",repos="http://sekhon.berkeley.edu")' in
an R session with an internet connection.
- Create a directory to store the needed files. We will assume
that this directory is called 'test'.
- Copy the files AutoCluster3.R and a1dual.R to the 'test' directory you just
created. You can download these files from Jasjeet Sekhon's
website at http://sekhon.berkeley.edu/rgenoud/test.
- The file a1dual.R runs GenMatch() using all or some of
the chips available in your computer. Remember that in order to
use multiple chips, you must install and load the special
version of 'snow' (see step 1). The line 'cl <- NCPUS()' creates
the cluster object by calling the function 'NCPUS()', and this
object is then passed to 'GenMatch()' via the 'cluster' option.
The function 'NCPUS()' is in the file AutoCluster3.R, which you must source at
the beginning of the file. In order to source this file, you
can type 'source("C:/path_to_test/test/AutoCluster3.R")'
--note the *inverted* slashes-- or you can first type
'setwd("C:/path_to_test/test/AutoCluster3.R")' and then
'source("AutoCluster3.R")'.
In Windows, the 'NCPUS()' function must be called with an
argument. The user must specify the precise number of chips to
be included in the cluster by passing the number of chips as
an argument to the function. For example, 'cl <-
NCPUS(nchips=4)' would create a cluster using exactly four
chips in the computer (assuming that the computer does have
four chips). If your computer had two chips and you wanted to
create a cluster using both chips, you would type 'cl <-
NCPUS(nchips=2)'.
- Done. The file a1dual.R will run 'GenMatch()' using multiple
chips in your computer.