Permalink
Browse files

fix bug with MPJ-Express and class paths

  • Loading branch information...
ddarriba committed Aug 14, 2016
1 parent 2ac9aee commit abe9b7cc6ed8d8a2d6edaa110f889720f4264728
@@ -24,6 +24,8 @@
import java.util.logging.Handler;
import java.util.logging.Level;
import static es.uvigo.darwin.prottest.global.ApplicationGlobals.APPLICATION_PROPERTIES;
import mpi.MPI;
import pal.misc.Identifier;
import pal.tree.Tree;
@@ -95,6 +97,26 @@ public static void main(String[] args) {
return;
}
// initializing MPJ environment (if available)
try {
String[] argsApp = MPI.Init(args);
MPJ_ME = MPI.COMM_WORLD.Rank();
MPJ_SIZE = MPI.COMM_WORLD.Size();
MPJ_RUN = true;
args = argsApp;
} catch (Exception e) {
MPJ_ME = 0;
MPJ_SIZE = 1;
MPJ_RUN = false;
}
// force static initialization
if (APPLICATION_PROPERTIES == null)
{
System.err.println("Error initialization ProtTest properties");
finalize(1);
}
try {
args = ProtTestFactory.initialize(args);
} catch (IllegalArgumentException e) {
@@ -108,19 +130,6 @@ public static void main(String[] args) {
{
finalize(1);
}
// initializing MPJ environment (if available)
try {
String[] argsApp = MPI.Init(args);
MPJ_ME = MPI.COMM_WORLD.Rank();
MPJ_SIZE = MPI.COMM_WORLD.Size();
MPJ_RUN = true;
args = argsApp;
} catch (Exception e) {
MPJ_ME = 0;
MPJ_SIZE = 1;
MPJ_RUN = false;
}
ProtTestLogger logger = ProtTestLogger.getDefaultLogger();
logger.setStdHandlerLevel(Level.INFO);
@@ -32,22 +32,36 @@
/** The application APPLICATION_PROPERTIES. */
public static final Properties APPLICATION_PROPERTIES;
public static final String JAR_PATH = ProtTest.class.getProtectionDomain().getCodeSource().getLocation().getFile()
.replace("%20", " ");
public static final String PATH = JAR_PATH.replaceFirst(new File(JAR_PATH).getName(),"");
public static final String ENV_PATH;
public static final String JAR_PATH = ProtTest.class.getProtectionDomain()
.getCodeSource()
.getLocation()
.getFile()
.replace("%20", " ");
public static final String PATH;
public static final String DEFAULT_SNAPSHOT_DIR = "snapshot/";
static {
APPLICATION_PROPERTIES = new Properties();
try {
FileInputStream prop = new FileInputStream(PATH + "prottest.properties");
APPLICATION_PROPERTIES.load(prop);
} catch (IOException e) {
System.err.println("Properties file (prottest.properties) cannot be resolved");
System.exit(EXIT_NO_PROPERTIES);
}
ENV_PATH = System.getenv("PROTTEST_PATH");
if (ENV_PATH != null)
PATH = ENV_PATH;
else {
if (ProtTest.MPJ_RUN)
PATH = System.getProperty("user.dir");
else
PATH = JAR_PATH.replaceFirst(new File(JAR_PATH).getName(), "");
}
APPLICATION_PROPERTIES = new Properties();
try {
FileInputStream prop = new FileInputStream(
PATH + File.separator + "prottest.properties");
APPLICATION_PROPERTIES.load(prop);
} catch (IOException e) {
System.err.println("Properties file (" + PATH + File.separator
+ "prottest.properties) cannot be resolved");
System.exit(EXIT_NO_PROPERTIES);
}
}
public static final String DEFAULT_SNAPSHOT_DIR = "snapshot/";
/**
* Gets the supported matrices.

0 comments on commit abe9b7c

Please sign in to comment.