diff options
Diffstat (limited to 'rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse')
22 files changed, 0 insertions, 2538 deletions
diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2ApplicationAttributes.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2ApplicationAttributes.java deleted file mode 100644 index 27da4e621..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2ApplicationAttributes.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core; - -import org.eclipse.ptp.core.attributes.ArrayAttributeDefinition; -import org.eclipse.ptp.core.attributes.StringAttributeDefinition; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; - -/** - * - * @author Daniel Felix Ferber - * - */ -public class MPICH2ApplicationAttributes { - private static final String EFFECTIVE_MPICH2_ENV_ATTR_ID = "MPICH2_env"; //$NON-NLS-1$ - private static final String EFFECTIVE_MPICH2_PROG_ARGS_ATTR_ID = "MPICH2_progArgs"; //$NON-NLS-1$ - private static final String EFFECTIVE_MPICH2_WORKING_DIR_ATTR_ID = "MPICH2_workingDir"; //$NON-NLS-1$ - - private final static ArrayAttributeDefinition<String> effectiveMPICH2EnvAttrDef = - new ArrayAttributeDefinition<String>(EFFECTIVE_MPICH2_ENV_ATTR_ID, Messages.MPICH2ApplicationAttributes_effectiveMPICH2EnvAttrDef_title, - Messages.MPICH2ApplicationAttributes_effectiveMPICH2EnvAttrDef_description, true, null); - - private final static ArrayAttributeDefinition<String> effectiveMPICH2ProgArgsAttrDef = - new ArrayAttributeDefinition<String>(EFFECTIVE_MPICH2_PROG_ARGS_ATTR_ID, Messages.MPICH2ApplicationAttributes_effectiveMPICH2ProgArgsAttrDef_title, - Messages.MPICH2ApplicationAttributes_effectiveMPICH2ProgArgsAttrDef_description, true, null); - - private final static StringAttributeDefinition effectiveMPICH2WorkingDirAttrDef = - new StringAttributeDefinition(EFFECTIVE_MPICH2_WORKING_DIR_ATTR_ID, Messages.MPICH2ApplicationAttributes_effectiveMPICH2WorkingDirAttrDef_title, - Messages.MPICH2ApplicationAttributes_effectiveMPICH2WorkingDirAttrDef_description, true, ""); //$NON-NLS-1$ - - /** - * Environment variables that MPICH2 has passed to the processes. - */ - public static ArrayAttributeDefinition<String> getEffectiveMPICH2EnvAttributeDefinition() { - return effectiveMPICH2EnvAttrDef; - } - - /** - * Program arguments that MPICH2 has passed to the processes. - */ - public static ArrayAttributeDefinition<String> getEffectiveMPICH2ProgArgsAttributeDefinition() { - return effectiveMPICH2ProgArgsAttrDef; - } - - /** - * Working directory where MPICH2 has started the processes. - */ - public static StringAttributeDefinition getEffectiveMPICH2WorkingDirAttributeDefinition() { - return effectiveMPICH2WorkingDirAttrDef; - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2Defaults.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2Defaults.java deleted file mode 100644 index bab4b2d23..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2Defaults.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; -import org.osgi.framework.Bundle; - -/** - * - * @author Daniel Felix Ferber - * - */ -public class MPICH2Defaults { - - public static String LAUNCH_CMD = null; - public static String DEBUG_CMD = null; - public static String DISCOVER_CMD = null; - public static String PERIODIC_CMD = null; - public static int PERIODIC_TIME = 0; - public static String PATH = null; - public static boolean USE_DEFAULTS = false; - - private static String defaultsResourcePath = "/data/defaults.properties"; //$NON-NLS-1$ - - public static void loadDefaults() throws CoreException { - Path defaultsPropertiesPath = new Path(defaultsResourcePath); - Bundle bundle = MPICH2Plugin.getDefault().getBundle(); - Properties properties = read(defaultsPropertiesPath, bundle); - - LAUNCH_CMD = getString(bundle, properties, "LAUNCH_CMD"); //$NON-NLS-1$ - DEBUG_CMD = getString(bundle, properties, "DEBUG_CMD"); //$NON-NLS-1$ - DISCOVER_CMD = getString(bundle, properties, "DISCOVER_CMD"); //$NON-NLS-1$ - PERIODIC_CMD = getString(bundle, properties, "PERIODIC_CMD"); //$NON-NLS-1$ - PERIODIC_TIME = getInteger(bundle, properties, "PERIODIC_TIME"); //$NON-NLS-1$ - PATH = getString(bundle, properties, "PATH"); //$NON-NLS-1$ - USE_DEFAULTS = getBoolean(bundle, properties, "USE_DEFAULTS"); //$NON-NLS-1$ - - assert LAUNCH_CMD != null; - assert DEBUG_CMD != null; - assert DISCOVER_CMD != null; - assert PERIODIC_CMD != null; - assert PATH != null; - } - - public static Properties read(Path defaultsPropertiesPath, Bundle bundle) - throws CoreException { - InputStream inStream; - Properties properties = new Properties(); - try { - inStream = FileLocator.openStream(bundle, defaultsPropertiesPath, false); - properties.load(inStream); - - - } catch (IOException e) { - throw MPICH2Plugin.coreErrorException(Messages.MPICH2Defaults_Exception_FailedReadFile, e); - } - return properties; - } - - public static String getString(Bundle bundle, Properties properties, String key) throws CoreException { - String value = properties.getProperty(key); - if (value == null) { - throw new CoreException(new Status(IStatus.ERROR, bundle.getSymbolicName(), NLS.bind(Messages.MPICH2Defaults_MissingValue, key))); - } - - return value; - } - - public static int getInteger(Bundle bundle, Properties properties, String key) throws CoreException { - String value = getString(bundle, properties, key); - try { - return Integer.parseInt(value); - } catch (NumberFormatException e) { - throw new CoreException(new Status(IStatus.ERROR, bundle.getSymbolicName(), NLS.bind(Messages.MPICH2Defaults_FailedParseInteger, key))); - } - } - - public static boolean getBoolean(Bundle bundle, Properties properties, String key) throws CoreException { - String value = getString(bundle, properties, key); - return Boolean.parseBoolean(value); - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2JobAttributes.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2JobAttributes.java deleted file mode 100644 index d5110dfcc..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2JobAttributes.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core; -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -import org.eclipse.ptp.core.attributes.IAttributeDefinition; -import org.eclipse.ptp.core.attributes.StringAttributeDefinition; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; - - -/** - * Node attributes. - * @author Daniel Felix Ferber - * - */ -public class MPICH2JobAttributes { - - private static final String JOB_ID_ATTR_ID = "MPICH2_jobid"; //$NON-NLS-1$ - private static final String HOSTNAME_ATTR_ID = "MPICH2_hostname"; //$NON-NLS-1$ - - private final static StringAttributeDefinition jobIdAttrDef = - new StringAttributeDefinition(JOB_ID_ATTR_ID, Messages.MPICH2JobAttributes_mpiJobIdAttrDef_title, - Messages.MPICH2JobAttributes_mpiJobIdAttrDef_description, true, ""); //$NON-NLS-1$ - - private final static StringAttributeDefinition hostnameAttrDef = - new StringAttributeDefinition(HOSTNAME_ATTR_ID, Messages.MPICH2JobAttributes_hostnameAttrDef_title, - Messages.MPICH2JobAttributes_hostnameAttrDef_description, true, ""); //$NON-NLS-1$ - - /** - */ - public static StringAttributeDefinition getJobIdAttributeDefinition() { - return jobIdAttrDef; - } - - /** - */ - public static StringAttributeDefinition getHostnameAttributeDefinition() { - return hostnameAttrDef; - } - - public static IAttributeDefinition<?,?,?>[] getDefaultAttributeDefinitions() { - return new IAttributeDefinition[]{jobIdAttrDef, hostnameAttrDef}; - } - - -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2LaunchAttributes.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2LaunchAttributes.java deleted file mode 100644 index 3430da202..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2LaunchAttributes.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core; - -import org.eclipse.ptp.core.attributes.ArrayAttributeDefinition; -import org.eclipse.ptp.core.attributes.IAttributeDefinition; -import org.eclipse.ptp.core.attributes.StringAttributeDefinition; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; - - -/** - * OMPI-specific attributes - * - * @author Daniel Felix Ferber - */ -public class MPICH2LaunchAttributes { - private static final String LAUNCH_ARGS_ATTR_ID = "MPICH2_args"; //$NON-NLS-1$ - private static final String ENV_KEYS_ATTR_ID = "MPICH2_envKeys"; //$NON-NLS-1$ - private static final String ENV_ARGS_ATTR_ID = "MPICH2_env"; //$NON-NLS-1$ - - private final static StringAttributeDefinition launchArgsAttrDef = - new StringAttributeDefinition(LAUNCH_ARGS_ATTR_ID, Messages.MPICH2LaunchAttributes_launchArgsAttrDef_title, - Messages.MPICH2LaunchAttributes_launchArgsAttrDef_description, false, ""); //$NON-NLS-1$ - - private final static ArrayAttributeDefinition<String> environmentKeyAttrDef = new ArrayAttributeDefinition<String>( - ENV_KEYS_ATTR_ID, Messages.MPICH2LaunchAttributes_environmentKeyAttrDef_title, - Messages.MPICH2LaunchAttributes_environmentKeyAttrDef_description, false, - new String[0]); - - private final static StringAttributeDefinition environmentArgsAttrDef = new StringAttributeDefinition( - ENV_ARGS_ATTR_ID, Messages.MPICH2LaunchAttributes_environmentArgsAttrDef_title, Messages.MPICH2LaunchAttributes_environmentArgsAttrDef_description, false, - "${MPICH2_envKeys:: -x ::-x :}"); //$NON-NLS-1$ - - /** - * List of names of environment variables for the application. - */ - public static ArrayAttributeDefinition<String> getEnvironmentKeysAttributeDefinition() { - return environmentKeyAttrDef; - } - - /** - * Environment variables for the application, as expected by openmpi command line. - */ - public static StringAttributeDefinition getEnvironmentArgsAttributeDefinition() { - return environmentArgsAttrDef; - } - - /** - * Arguments for the application, as expected by openmpi command line. - */ - public static StringAttributeDefinition getLaunchArgumentsAttributeDefinition() { - return launchArgsAttrDef; - } - - public static IAttributeDefinition<?,?,?>[] getDefaultAttributeDefinitions() { - return new IAttributeDefinition[]{ - launchArgsAttrDef,environmentArgsAttrDef,environmentKeyAttrDef - }; - } - - -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2MachineAttributes.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2MachineAttributes.java deleted file mode 100644 index 248b51ba0..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2MachineAttributes.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core; -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -import org.eclipse.ptp.core.attributes.IAttributeDefinition; -import org.eclipse.ptp.core.attributes.StringAttributeDefinition; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; - - -/** - * Node attributes - * @author Daniel Felix Ferber - */ -public class MPICH2MachineAttributes { - - private static final String STATUS_MESSAGE = "MPICH2_statusMessage"; //$NON-NLS-1$ - - private final static StringAttributeDefinition statusMessageAttrDef = - new StringAttributeDefinition(STATUS_MESSAGE, Messages.MPICH2MachineAttributes_statusMessageAttrDef_title, - Messages.MPICH2MachineAttributes_statusMessageAttrDef_description, true, ""); //$NON-NLS-1$ - - /** - * Status message if it was not possible to discover the machine. - */ - public static StringAttributeDefinition getStatusMessageAttributeDefinition() { - return statusMessageAttrDef; - } - - public static IAttributeDefinition<?,?,?>[] getDefaultAttributeDefinitions() { - return new IAttributeDefinition[]{statusMessageAttrDef}; - } - -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2NodeAttributes.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2NodeAttributes.java deleted file mode 100644 index 8a21b96e1..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2NodeAttributes.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core; -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -import org.eclipse.ptp.core.attributes.BooleanAttributeDefinition; -import org.eclipse.ptp.core.attributes.IAttributeDefinition; -import org.eclipse.ptp.core.attributes.IntegerAttributeDefinition; -import org.eclipse.ptp.core.attributes.StringAttributeDefinition; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; - - -/** - * Node attributes - * @author Daniel Felix Ferber - */ -public class MPICH2NodeAttributes { - - private static final String NUM_NODES_ID = "MPICH2_numNodes"; //$NON-NLS-1$ - private static final String MAX_NUM_NODES_ID = "MPICH2_maxNumNodes"; //$NON-NLS-1$ - private static final String STATUS_MESSAGE = "MPICH2_statusMessage"; //$NON-NLS-1$ - private static final String OVERSUBSCRIBED = "MPICH2_oversubscribed"; //$NON-NLS-1$ - - private final static IntegerAttributeDefinition numNodesAttrDef = - new IntegerAttributeDefinition(NUM_NODES_ID, Messages.MPICH2NodeAttributes_numNodesAttrDef_title, - Messages.MPICH2NodeAttributes_numNodesAttrDef_description, true, new Integer(0)); - - private final static IntegerAttributeDefinition maxNumNodesAttrDef = - new IntegerAttributeDefinition(MAX_NUM_NODES_ID, Messages.MPICH2NodeAttributes_maxNumNodesAttrDef_title, - Messages.MPICH2NodeAttributes_maxNumNodesAttrDef_description, true, new Integer(0)); - - private final static StringAttributeDefinition statusMessageAttrDef = - new StringAttributeDefinition(STATUS_MESSAGE, Messages.MPICH2NodeAttributes_statusMessageAttrDef_title, - Messages.MPICH2NodeAttributes_statusMessageAttrDef_description, true, ""); //$NON-NLS-1$ - - private final static BooleanAttributeDefinition oversubscribedAttrDef = - new BooleanAttributeDefinition(OVERSUBSCRIBED, Messages.MPICH2NodeAttributes_oversubscribedAttrDef_title, - Messages.MPICH2NodeAttributes_oversubscribedAttrDef_description, true, new Boolean(false)); - - /** - * Number of slots suggested on the node. - */ - public static IntegerAttributeDefinition getNumberOfNodesAttributeDefinition() { - return numNodesAttrDef; - } - - /** - * Maximal number of slots on the node. Zero if not set. - */ - public static IntegerAttributeDefinition getMaximalNumberOfNodesAttributeDefinition() { - return maxNumNodesAttrDef; - } - - /** - * Status message if it was not possible to discover the node. - */ - public static StringAttributeDefinition getStatusMessageAttributeDefinition() { - return statusMessageAttrDef; - } - - /** - * If node is oversubscribed. - */ - public static BooleanAttributeDefinition getOversubscribedAttributeDefinition() { - return oversubscribedAttrDef; - } - - public static IAttributeDefinition<?,?,?>[] getDefaultAttributeDefinitions() { - return new IAttributeDefinition[]{numNodesAttrDef,maxNumNodesAttrDef,statusMessageAttrDef}; - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2Plugin.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2Plugin.java deleted file mode 100644 index 64d74b124..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2Plugin.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.ptp.rm.core.ToolsRMPlugin; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - * @author Daniel Felix Ferber - */ -public class MPICH2Plugin extends Plugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.ptp.rm.mpi.mpich2.core"; //$NON-NLS-1$ - - // The shared instance - private static MPICH2Plugin plugin; - - /** - * The constructor - */ - public MPICH2Plugin() { - // Nothing to do - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - MPICH2Defaults.loadDefaults(); - MPICH2PreferenceManager.initializePreferences(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static MPICH2Plugin getDefault() { - return plugin; - } - - /** - * Raise core exception. - * @param message - * @return - */ - public static CoreException coreErrorException(String message) { - return new CoreException(new Status(IStatus.ERROR, ToolsRMPlugin.getDefault().getBundle().getSymbolicName(), message)); - } - - /** - * Raise core exception. - * @param message - * @param t - * @return - */ - public static CoreException coreErrorException(String message, Throwable t) { - return new CoreException(new Status(IStatus.ERROR, ToolsRMPlugin.getDefault().getBundle().getSymbolicName(), message, t)); - } - - /** - * Create log entry from an IStatus - * - * @param status - */ - public static void log(IStatus status) { - getDefault().getLog().log(status); - } - - /** - * Create log entry from a string - * - * @param msg - */ - public static void log(String msg) { - log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, msg, null)); - } - - /** - * Create log entry from a Throwable - * - * @param e - */ - public static void log(Throwable e) { - log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, Messages.MPICH2Plugin_Exception_InternalError, e)); - } - - /** - * Generate a unique identifier - * - * @return unique identifier string - */ - public static String getUniqueIdentifier() { - if (getDefault() == null) - // If the default instance is not yet initialized, - // return a static identifier. This identifier must - // match the plugin id defined in plugin.xml - return PLUGIN_ID; - return getDefault().getBundle().getSymbolicName(); - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2PreferenceManager.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2PreferenceManager.java deleted file mode 100644 index 018ddb314..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/MPICH2PreferenceManager.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core; - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.ptp.rm.core.AbstractToolsPreferenceManager; - - -/** - * - * @author Daniel Felix Ferber - * - */ -public class MPICH2PreferenceManager extends AbstractToolsPreferenceManager { - public static final String PREFIX = "mpich2-"; //$NON-NLS-1$ - - public static Preferences getPreferences() { - return MPICH2Plugin.getDefault().getPluginPreferences(); - } - - public static void savePreferences() { - MPICH2Plugin.getDefault().savePluginPreferences(); - } - - public static void initializePreferences() { - Preferences preferences = MPICH2Plugin.getDefault().getPluginPreferences(); - preferences.setDefault(PREFIX + PREFS_LAUNCH_CMD, MPICH2Defaults.LAUNCH_CMD); - preferences.setDefault(PREFIX + PREFS_DEBUG_CMD, MPICH2Defaults.DEBUG_CMD); - preferences.setDefault(PREFIX + PREFS_DISCOVER_CMD, MPICH2Defaults.DISCOVER_CMD); - preferences.setDefault(PREFIX + PREFS_PERIODIC_MONITOR_CMD, MPICH2Defaults.PERIODIC_CMD); - preferences.setDefault(PREFIX + PREFS_PERIODIC_MONITOR_TIME, MPICH2Defaults.PERIODIC_TIME); - preferences.setDefault(PREFIX + PREFS_REMOTE_INSTALL_PATH, MPICH2Defaults.PATH); - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/messages/Messages.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/messages/Messages.java deleted file mode 100644 index 3ef6bfe14..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/messages/Messages.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.messages; - -import org.eclipse.osgi.util.NLS; - -/** - * - * @author Daniel Felix Ferber - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.ptp.rm.mpi.mpich2.core.messages.messages"; //$NON-NLS-1$ - public static String MPICH2Defaults_Exception_FailedReadFile; - public static String MPICH2Defaults_FailedParseInteger; - public static String MPICH2Defaults_MissingValue; - public static String MPICH2ApplicationAttributes_effectiveMPICH2EnvAttrDef_description; - public static String MPICH2ApplicationAttributes_effectiveMPICH2EnvAttrDef_title; - public static String MPICH2ApplicationAttributes_effectiveMPICH2ProgArgsAttrDef_description; - public static String MPICH2ApplicationAttributes_effectiveMPICH2ProgArgsAttrDef_title; - public static String MPICH2ApplicationAttributes_effectiveMPICH2WorkingDirAttrDef_description; - public static String MPICH2ApplicationAttributes_effectiveMPICH2WorkingDirAttrDef_title; - public static String MPICH2JobAttributes_hostnameAttrDef_description; - public static String MPICH2JobAttributes_hostnameAttrDef_title; - public static String MPICH2JobAttributes_mappingModeAttrDef_description; - public static String MPICH2JobAttributes_mappingModeAttrDef_title; - public static String MPICH2JobAttributes_mpiJobIdAttrDef_description; - public static String MPICH2JobAttributes_mpiJobIdAttrDef_title; - public static String MPICH2JobAttributes_vpidRangeAttrDef_description; - public static String MPICH2JobAttributes_vpidRangeAttrDef_title; - public static String MPICH2JobAttributes_vpidStartAttrDef_description; - public static String MPICH2JobAttributes_vpidStartAttrDef_title; - public static String MPICH2LaunchAttributes_environmentArgsAttrDef_description; - public static String MPICH2LaunchAttributes_environmentArgsAttrDef_title; - public static String MPICH2LaunchAttributes_environmentKeyAttrDef_description; - public static String MPICH2LaunchAttributes_environmentKeyAttrDef_title; - public static String MPICH2LaunchAttributes_launchArgsAttrDef_description; - public static String MPICH2LaunchAttributes_launchArgsAttrDef_title; - public static String MPICH2MachineAttributes_statusMessageAttrDef_description; - public static String MPICH2MachineAttributes_statusMessageAttrDef_title; - public static String MPICH2NodeAttributes_maxNumNodesAttrDef_description; - public static String MPICH2NodeAttributes_maxNumNodesAttrDef_title; - public static String MPICH2NodeAttributes_numNodesAttrDef_description; - public static String MPICH2NodeAttributes_numNodesAttrDef_title; - public static String MPICH2NodeAttributes_oversubscribedAttrDef_description; - public static String MPICH2NodeAttributes_oversubscribedAttrDef_title; - public static String MPICH2NodeAttributes_statusMessageAttrDef_description; - public static String MPICH2NodeAttributes_statusMessageAttrDef_title; - public static String MPICH2Plugin_Exception_InternalError; - - public static String MPICH2ResourceManagerConfiguration_defaultDescription; - public static String MPICH2ResourceManagerConfiguration_defaultName; - public static String MPICH2ResourceManagerFactory_ResourceManagerName; - - public static String MPICH2DiscoverJob_defaultQueueName; - public static String MPICH2DiscoverJob_Exception_DiscoverCommandFailed; - public static String MPICH2DiscoverJob_Exception_DiscoverCommandFailedParseHostFile; - public static String MPICH2DiscoverJob_Exception_DiscoverCommandFailedReadHostFile; - public static String MPICH2DiscoverJob_Exception_DiscoverCommandHostFileEmpty; - public static String MPICH2DiscoverJob_Exception_DiscoverCommandHostFileNotFound; - public static String MPICH2DiscoverJob_Exception_DiscoverCommandHostFilePathNotAbsolute; - public static String MPICH2DiscoverJob_Exception_DiscoverCommandInternalError; - public static String MPICH2DiscoverJob_Exception_DiscoverCommandMissingHostFilePath; - public static String MPICH2DiscoverJob_Exception_HostFileErrors; - public static String MPICH2DiscoverJob_Exception_HostFileParseError; - public static String MPICH2DiscoverJob_Exception_HostnameCommandFailed; - public static String MPICH2DiscoverJob_Exception_HostnameCommandFailedParse; - public static String MPICH2DiscoverJob_Exception_HostnameCommandFailedParseOutput; - public static String MPICH2DiscoverJob_Exception_HostnameCommandFailedWithCode; - public static String MPICH2DiscoverJob_Exception_IgnoredInvalidParameter; - public static String MPICH2DiscoverJob_Exception_InvalidMaxSlotsParameter; - public static String MPICH2DiscoverJob_Exception_InvalidSlotsParameter; - public static String MPICH2DiscoverJob_interruptedErrorMessage; - public static String MPICH2DiscoverJob_name; - public static String MPICH2DiscoverJob_parsingErrorMessage; - public static String MPICH2DiscoverJob_processErrorMessage; - - public static String MPICH2MonitorJob_interruptedErrorMessage; - public static String MPICH2MonitorJob_name; - public static String MPICH2MonitorJob_parsingErrorMessage; - public static String MPICH2MonitorJob_processErrorMessage; - public static String MPICH2MonitorJob_Exception_CommandFailed; - public static String MPICH2MonitorJob_Exception_InternalError; - - public static String MPICH2ProcessMapText12Parser_Exception_InvalidLine; - public static String MPICH2ProcessMapText12Parser_Exception_MissingDisplayMapInformation; - public static String MPICH2ProcessMapText12Parser_Exception_BrokenDisplayMapInformation; - - public static String MPICH2ProcessMapXml13Parser_Exception_AttributeNotInteger; - public static String MPICH2ProcessMapXml13Parser_Exception_MissingAttribute; - public static String MPICH2ProcessMapXml13Parser_Exception_UnknownAttribute; - public static String MPICH2ProcessMapXml13Parser_Exception_UnknownElement; - - public static String MPICH2RuntimeSystem_JobName; - public static String MPICH2RuntimeSystemJob_Exception_FailedParse; - public static String MPICH2RuntimeSystemJob_Exception_HostnamesDoNotMatch; - public static String MPICH2RuntimeSystemJob_ProcessName; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - // Prevent instances. - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/messages/messages.properties b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/messages/messages.properties deleted file mode 100644 index f8890844a..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/messages/messages.properties +++ /dev/null @@ -1,87 +0,0 @@ -MPICH2Defaults_Exception_FailedReadFile=Failed to read properties file with default preferences. -MPICH2Defaults_FailedParseInteger=Failed to parse integer default value for {0} -MPICH2Defaults_MissingValue=Missing default value for {0} -MPICH213Defaults_Exception_FailedReadFile=Failed to read properties file with default preferences. -MPICH213Defaults_FailedParseInteger=Failed to parse integer default value for {0} -MPICH213Defaults_MissingValue=Missing default value for {0} -MPICH2ApplicationAttributes_effectiveMPICH2EnvAttrDef_description=Effective environment supplied by MPICH2 to executable on launch -MPICH2ApplicationAttributes_effectiveMPICH2EnvAttrDef_title=Environment for MPICH2 processes -MPICH2ApplicationAttributes_effectiveMPICH2ProgArgsAttrDef_description=Effective command-line arguments by MPICH2 supplied to executable -MPICH2ApplicationAttributes_effectiveMPICH2ProgArgsAttrDef_title=Program Arguments for MPICH2 processes -MPICH2ApplicationAttributes_effectiveMPICH2WorkingDirAttrDef_description=Effective working directory where MPICH2 launched the processes -MPICH2ApplicationAttributes_effectiveMPICH2WorkingDirAttrDef_title=Working Directory for MPICH2 processes -MPICH2JobAttributes_hostnameAttrDef_description=MPICH2 job hostname -MPICH2JobAttributes_hostnameAttrDef_title=MPICH2 hostname -MPICH2JobAttributes_mappingModeAttrDef_description=MPICH2 mapping mode -MPICH2JobAttributes_mappingModeAttrDef_title=MPICH2 mapping mode -MPICH2JobAttributes_mpiJobIdAttrDef_description=MPICH2 job id -MPICH2JobAttributes_mpiJobIdAttrDef_title=MPICH2 job id -MPICH2JobAttributes_vpidRangeAttrDef_description=MPICH2 vpid range -MPICH2JobAttributes_vpidRangeAttrDef_title=MPICH2 vpid range -MPICH2JobAttributes_vpidStartAttrDef_description=MPICH2 vpid start -MPICH2JobAttributes_vpidStartAttrDef_title=MPICH2 vpid start -MPICH2LaunchAttributes_environmentArgsAttrDef_description=Command line arguments to set environment variables for each MPICH2 processes -MPICH2LaunchAttributes_environmentArgsAttrDef_title=MPICH2 Environment arguments -MPICH2LaunchAttributes_environmentKeyAttrDef_description=Name of environment variables supplied to the each MPICH2 processes -MPICH2LaunchAttributes_environmentKeyAttrDef_title=MPICH2 environment variables -MPICH2LaunchAttributes_launchArgsAttrDef_description=Command line arguments for MPICH2 -MPICH2LaunchAttributes_launchArgsAttrDef_title=MPICH2 arguments -MPICH2MachineAttributes_statusMessageAttrDef_description=MPICH2 status message -MPICH2MachineAttributes_statusMessageAttrDef_title=MPICH2 status message -MPICH2NodeAttributes_maxNumNodesAttrDef_description=MPICH2 maximal number of nodes on the host -MPICH2NodeAttributes_maxNumNodesAttrDef_title=MPICH2 maximal number of nodes -MPICH2NodeAttributes_numNodesAttrDef_description=MPICH2 number of nodes on the host -MPICH2NodeAttributes_numNodesAttrDef_title=MPICH2 number of nodes -MPICH2NodeAttributes_oversubscribedAttrDef_description=MPICH2 oversubscribed node (more processes than available) -MPICH2NodeAttributes_oversubscribedAttrDef_title=MPICH2 oversubscribed -MPICH2NodeAttributes_statusMessageAttrDef_description=MPICH2 status message -MPICH2NodeAttributes_statusMessageAttrDef_title=MPICH2 status message -MPICH2Plugin_Exception_InternalError=Internal error - -MPICH2ResourceManagerConfiguration_defaultDescription=MPICH2 Resource Manager -MPICH2ResourceManagerConfiguration_defaultName=MPICH2 -MPICH2ResourceManagerFactory_ResourceManagerName=MPICH2 (new) - -MPICH2DiscoverJob_defaultQueueName=default -MPICH2DiscoverJob_Exception_DiscoverCommandFailed=Error while running discover command: {0}. -MPICH2DiscoverJob_Exception_DiscoverCommandFailedParseHostFile=Failed to parse hostfile ({0}). -MPICH2DiscoverJob_Exception_DiscoverCommandFailedReadHostFile=Failed read hostfile ({0}). -MPICH2DiscoverJob_Exception_DiscoverCommandHostFileEmpty=Empty hostfile is not allowed ({0}). -MPICH2DiscoverJob_Exception_DiscoverCommandHostFileNotFound=Failed find hostfile ({0}). -MPICH2DiscoverJob_Exception_DiscoverCommandHostFilePathNotAbsolute=Discover command informed a path to hostfile that is not an absolute path ({0}). -MPICH2DiscoverJob_Exception_DiscoverCommandInternalError=Internal error while running discover command: {0} -MPICH2DiscoverJob_Exception_DiscoverCommandMissingHostFilePath=Discover command did not inform path to default hostfile. If necessary, set MCA parameters to define default hostfile path. -MPICH2DiscoverJob_Exception_HostFileErrors=There are errors in the hostfile. -MPICH2DiscoverJob_Exception_HostFileParseError=Parse error(s) in hostfile. -MPICH2DiscoverJob_Exception_HostnameCommandFailed=Failed to run command to get hostname. -MPICH2DiscoverJob_Exception_HostnameCommandFailedParse=Failed to parse command for hostname. -MPICH2DiscoverJob_Exception_HostnameCommandFailedParseOutput=Failed to parse output of discover command. -MPICH2DiscoverJob_Exception_HostnameCommandFailedWithCode=Command to get hostname failed with exit code {0} -MPICH2DiscoverJob_Exception_IgnoredInvalidParameter=Invalid parameter was ignored for this host. -MPICH2DiscoverJob_Exception_InvalidMaxSlotsParameter=Invalid 'max-slots' parameter was ignored for this host. -MPICH2DiscoverJob_Exception_InvalidSlotsParameter=Invalid 'slots/cpus/count' parameter was ignored for this host. -MPICH2DiscoverJob_interruptedErrorMessage=Interrupted while running MPICH2 discover command. -MPICH2DiscoverJob_name=Discover MPICH2 on {0} -MPICH2DiscoverJob_parsingErrorMessage=Failed to parse output of MPICH2 discover command. -MPICH2DiscoverJob_processErrorMessage=Failed to create remote process for MPICH2 discover command. - -MPICH2ProcessMapText12Parser_Exception_InvalidLine=Invalid output from MPICH2: {0} -MPICH2ProcessMapText12Parser_Exception_MissingDisplayMapInformation=Output from MPICH2 has no information about processes and nodes. -MPICH2ProcessMapText12Parser_Exception_BrokenDisplayMapInformation=Incomplete output from MPICH2. - -MPICH2ProcessMapXml13Parser_Exception_AttributeNotInteger=Attribute {0} is not an valid integer ({1}) -MPICH2ProcessMapXml13Parser_Exception_MissingAttribute=Missing XML attribute: {0} -MPICH2ProcessMapXml13Parser_Exception_UnknownAttribute=Unknown XML attribute: {0} -MPICH2ProcessMapXml13Parser_Exception_UnknownElement=Unknown XML element: {0} - -MPICH2RuntimeSystem_JobName=MPICH2 Job -MPICH2RuntimeSystemJob_Exception_FailedParse=Failed to parse MPICH2 run command output. -MPICH2RuntimeSystemJob_Exception_HostnamesDoNotMatch=Hostnames from MPICH2 output do not match expected hostname. -MPICH2RuntimeSystemJob_ProcessName=MPICH2 run - -MPICH2MonitorJob_interruptedErrorMessage=Interrupted while running MPICH2 monitor command. -MPICH2MonitorJob_name=Monitor MPICH2 on {0} -MPICH2MonitorJob_parsingErrorMessage=Failed to parse output of MPICH2 monitor command. -MPICH2MonitorJob_processErrorMessage=Failed to create remote process for MPICH2 monitor command. -MPICH2MonitorJob_Exception_CommandFailed=Error while running command: {0}. -MPICH2MonitorJob_Exception_InternalError=Internal error while running command: {0} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/EffectiveMPICH2ResourceManagerConfiguration.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/EffectiveMPICH2ResourceManagerConfiguration.java deleted file mode 100644 index 367ea8f9e..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/EffectiveMPICH2ResourceManagerConfiguration.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.ptp.rm.mpi.mpich2.core.rmsystem; - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.ptp.rm.core.rmsystem.AbstractEffectiveToolRMConfiguration; -import org.eclipse.ptp.rm.core.rmsystem.AbstractToolRMConfiguration; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2PreferenceManager; - -public class EffectiveMPICH2ResourceManagerConfiguration extends -AbstractEffectiveToolRMConfiguration { - - public EffectiveMPICH2ResourceManagerConfiguration( - AbstractToolRMConfiguration configuration) { - super(configuration); - MPICH2ResourceManagerConfiguration MPICH2configuration = (MPICH2ResourceManagerConfiguration)configuration; - String launchCmd = null; - String debugCmd = null; - String discoverCmd = null; - String periodicCmd = null; - int periodicTime = 0; - String remoteInstallPath = null; - if (MPICH2configuration.useToolDefaults()) { - Preferences preferences = MPICH2PreferenceManager.getPreferences(); - launchCmd = preferences.getString(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_LAUNCH_CMD); - debugCmd = preferences.getString(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_DEBUG_CMD); - discoverCmd = preferences.getString(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_DISCOVER_CMD); - periodicCmd = preferences.getString(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_PERIODIC_MONITOR_CMD); - periodicTime = preferences.getInt(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_PERIODIC_MONITOR_TIME); - } else { - launchCmd = MPICH2configuration.getLaunchCmd(); - debugCmd = MPICH2configuration.getDebugCmd(); - discoverCmd = MPICH2configuration.getDiscoverCmd(); - periodicCmd = MPICH2configuration.getPeriodicMonitorCmd(); - periodicTime = MPICH2configuration.getPeriodicMonitorTime(); - } - remoteInstallPath = MPICH2configuration.getRemoteInstallPath(); - applyValues(launchCmd, debugCmd, discoverCmd, periodicCmd, periodicTime, null, remoteInstallPath); - } - -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/MPICH2ResourceManager.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/MPICH2ResourceManager.java deleted file mode 100755 index 6d459e8b2..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/MPICH2ResourceManager.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rmsystem; - - -import org.eclipse.ptp.core.attributes.AttributeDefinitionManager; -import org.eclipse.ptp.core.elementcontrols.IPUniverseControl; -import org.eclipse.ptp.rm.core.AbstractToolsAttributes; -import org.eclipse.ptp.rm.core.rmsystem.AbstractToolResourceManager; -import org.eclipse.ptp.rm.mpi.mpich2.core.rtsystem.MPICH2RuntimeSystem; -import org.eclipse.ptp.rmsystem.IResourceManagerConfiguration; -import org.eclipse.ptp.rtsystem.IRuntimeSystem; - -/** - * - * @author Daniel Felix Ferber - * - */ -public class MPICH2ResourceManager extends AbstractToolResourceManager { - - private Integer MPICH2_RMID; - private MPICH2RuntimeSystem rts = null; - - public MPICH2ResourceManager(Integer id, IPUniverseControl universe, IResourceManagerConfiguration config) { - super(id.toString(), universe, config); - MPICH2_RMID = id; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ptp.rmsystem.AbstractRuntimeResourceManager#doCreateRuntimeSystem() - */ - @Override - protected IRuntimeSystem doCreateRuntimeSystem() { - MPICH2ResourceManagerConfiguration config = (MPICH2ResourceManagerConfiguration) getConfiguration(); - AttributeDefinitionManager attrDefMgr = getAttributeDefinitionManager(); - attrDefMgr.setAttributeDefinitions(AbstractToolsAttributes.getDefaultAttributeDefinitions()); - rts = new MPICH2RuntimeSystem(MPICH2_RMID, config, attrDefMgr); - return rts; - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/MPICH2ResourceManagerConfiguration.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/MPICH2ResourceManagerConfiguration.java deleted file mode 100755 index b5570af33..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/MPICH2ResourceManagerConfiguration.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -/** - * - */ -package org.eclipse.ptp.rm.mpi.mpich2.core.rmsystem; - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.ptp.rm.core.rmsystem.AbstractToolRMConfiguration; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2PreferenceManager; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; -import org.eclipse.ptp.rmsystem.IResourceManagerFactory; -import org.eclipse.ui.IMemento; - -/** - * - * @author Daniel Felix Ferber - * - */ -public class MPICH2ResourceManagerConfiguration extends -AbstractToolRMConfiguration implements Cloneable { - - public static int MPICH2_CAPABILITIES = CAP_LAUNCH | CAP_DISCOVER | CAP_PERIODIC_MONITOR | CAP_REMOTE_INSTALL_PATH; - - private static final String TAG_VERSION_ID = "versionId"; //$NON-NLS-1$ - - /** - * Static class to hold openmpi configuration information - * - * @author dfferber - */ - static public class MPICH2Config { - - private ToolsConfig toolsConfig; - private String versionId; - - public MPICH2Config() { - this(new ToolsConfig(), null); - } - - public MPICH2Config(ToolsConfig toolsConfig, String versionId) { - super(); - this.toolsConfig = toolsConfig; - this.versionId = versionId; - } - - public ToolsConfig getToolsConfig() { - return toolsConfig; - } - - public void setToolsConfig(ToolsConfig toolsConfig) { - this.toolsConfig = toolsConfig; - } - - public String getVersionId() { - return versionId; - } - - public void setVersionId(String versionId) { - this.versionId = versionId; - } - } - - private String versionId; - - public static MPICH2Config loadOpenMpiConfig(IResourceManagerFactory factory, - IMemento memento) { - ToolsConfig toolsConfig = loadTool(factory, memento); - - String versionId = memento.getString(TAG_VERSION_ID); - - MPICH2Config config = new MPICH2Config(toolsConfig, versionId); - return config; - } - - public static MPICH2ResourceManagerConfiguration load( - MPICH2ResourceManagerFactory factory, IMemento memento) { - MPICH2Config mpich2Config = loadOpenMpiConfig(factory, memento); - MPICH2ResourceManagerConfiguration config = new MPICH2ResourceManagerConfiguration(factory, mpich2Config); - return config; - } - - public MPICH2ResourceManagerConfiguration(MPICH2ResourceManagerFactory factory) { - super(MPICH2_CAPABILITIES, new ToolsConfig(), factory); - - Preferences prefs = MPICH2PreferenceManager.getPreferences(); - setLaunchCmd(prefs.getString(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_LAUNCH_CMD)); - setDebugCmd(prefs.getString(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_DEBUG_CMD)); - setDiscoverCmd(prefs.getString(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_DISCOVER_CMD)); - setPeriodicMonitorCmd(prefs.getString(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_PERIODIC_MONITOR_CMD)); - setPeriodicMonitorTime(prefs.getInt(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_PERIODIC_MONITOR_TIME)); - setRemoteInstallPath(prefs.getString(MPICH2PreferenceManager.PREFIX + MPICH2PreferenceManager.PREFS_REMOTE_INSTALL_PATH)); - // setUseToolDefaults(prefs.getBoolean(MPICH213PreferenceManager.PREFIX + MPICH213PreferenceManager.PREFS_USE_DEFAULTS)); - } - - public MPICH2ResourceManagerConfiguration(MPICH2ResourceManagerFactory factory, - MPICH2Config config) { - super(MPICH2_CAPABILITIES, config.getToolsConfig(), factory); - } - - @Override - public Object clone() { - CommonConfig commonConf = new CommonConfig(getName(), - getDescription(), getUniqueName()); - RemoteConfig remoteConf = new RemoteConfig(commonConf, - getRemoteServicesId(), getConnectionName(), - getProxyServerPath(), getLocalAddress(), - getInvocationOptionsStr(), getOptions()); - ToolsConfig toolsConfig = new ToolsConfig( - remoteConf, - getLaunchCmd(), - getDebugCmd(), - getDiscoverCmd(), - getPeriodicMonitorCmd(), - getPeriodicMonitorTime(), - getContinuousMonitorCmd(), - getRemoteInstallPath(), - useToolDefaults()); - MPICH2Config openMpiConfig = new MPICH2Config(toolsConfig, getVersionId()); - - return new MPICH2ResourceManagerConfiguration( - (MPICH2ResourceManagerFactory) getFactory(), openMpiConfig); - } - - @Override - public void save(IMemento memento) { - super.save(memento); - memento.putString(TAG_VERSION_ID, versionId); - } - - @Override - public void setDefaultNameAndDesc() { - String name = Messages.MPICH2ResourceManagerConfiguration_defaultName; - String conn = getConnectionName(); - if (conn != null && !conn.equals(EMPTY_STRING)) { - name += "@" + conn; //$NON-NLS-1$ - } - setName(name); - setDescription(Messages.MPICH2ResourceManagerConfiguration_defaultDescription); - } - - public String getVersionId() { - return versionId; - } - - public void setVersionId(String versionId) { - this.versionId = versionId; - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/MPICH2ResourceManagerFactory.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/MPICH2ResourceManagerFactory.java deleted file mode 100755 index a37b95bd0..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rmsystem/MPICH2ResourceManagerFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rmsystem; - -import org.eclipse.ptp.core.PTPCorePlugin; -import org.eclipse.ptp.core.elementcontrols.IPUniverseControl; -import org.eclipse.ptp.core.elementcontrols.IResourceManagerControl; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; -import org.eclipse.ptp.rmsystem.AbstractResourceManagerFactory; -import org.eclipse.ptp.rmsystem.IResourceManagerConfiguration; -import org.eclipse.ui.IMemento; - -/** - * - * @author Daniel Felix Ferber - * - */ -public class MPICH2ResourceManagerFactory extends AbstractResourceManagerFactory { - - public MPICH2ResourceManagerFactory() { - // QUESTION: Wouldnt it be better to take name from extension point? - // Extension point already has a name. - super(Messages.MPICH2ResourceManagerFactory_ResourceManagerName); - } - - protected MPICH2ResourceManagerFactory(String name) { - super(name); - } - - public IResourceManagerConfiguration copyConfiguration( - IResourceManagerConfiguration configuration) { - return (IResourceManagerConfiguration)configuration.clone(); - } - - @Override - public IResourceManagerControl create(IResourceManagerConfiguration confIn) { - MPICH2ResourceManagerConfiguration configuration = (MPICH2ResourceManagerConfiguration) confIn; - PTPCorePlugin plugin = PTPCorePlugin.getDefault(); - IPUniverseControl universe = (IPUniverseControl) plugin.getUniverse(); - return new MPICH2ResourceManager(universe.getNextResourceManagerId(), universe, configuration); - } - - public IResourceManagerConfiguration createConfiguration() { - MPICH2ResourceManagerConfiguration conf = new MPICH2ResourceManagerConfiguration(this); - - return conf; - } - - public IResourceManagerConfiguration loadConfiguration(IMemento memento) { - return MPICH2ResourceManagerConfiguration.load(this, memento); - } - -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2DiscoverJob.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2DiscoverJob.java deleted file mode 100644 index 6e7c409fd..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2DiscoverJob.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rtsystem; - -import java.io.BufferedReader; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ptp.core.PTPCorePlugin; -import org.eclipse.ptp.core.attributes.AttributeManager; -import org.eclipse.ptp.core.attributes.IllegalValueException; -import org.eclipse.ptp.core.elements.IPMachine; -import org.eclipse.ptp.core.elements.IResourceManager; -import org.eclipse.ptp.core.elements.attributes.MachineAttributes; -import org.eclipse.ptp.rm.core.rtsystem.AbstractRemoteCommandJob; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2MachineAttributes; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2NodeAttributes; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2Plugin; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; - -/** - * - * @author Greg Watson - * - */ -public class MPICH2DiscoverJob extends AbstractRemoteCommandJob { - MPICH2RuntimeSystem rts; - - public MPICH2DiscoverJob(MPICH2RuntimeSystem rts) { - super(rts, - NLS.bind(Messages.MPICH2DiscoverJob_name, rts.getRmConfiguration().getName()), - rts.retrieveEffectiveToolRmConfiguration().getDiscoverCmd(), - Messages.MPICH2DiscoverJob_interruptedErrorMessage, - Messages.MPICH2DiscoverJob_processErrorMessage, - Messages.MPICH2DiscoverJob_parsingErrorMessage); - this.rts = rts; - } - - @Override - protected void parse(BufferedReader output) throws CoreException { - /* - * MPI resource manager have only one machine and one queue. - * There they are implicitly "discovered". - */ - IResourceManager rm = PTPCorePlugin.getDefault().getUniverse().getResourceManager(rts.getRmID()); - String machineID = rts.createMachine(rm.getName()); - rts.setMachineID(machineID); - String queueID = rts.createQueue(Messages.MPICH2DiscoverJob_defaultQueueName); - rts.setQueueID(queueID); - - IPMachine machine = rm.getMachineById(machineID); - assert machine != null; - - /* - * Any exception from now on is caught in order to add the error message as an attribute to the machine. - * Then, the exception is re-thrown. - */ - try { - /* - * Parse output of trace command that describes the system configuration. - */ - MPICH2TraceParser parser = new MPICH2TraceParser(); - MPICH2HostMap hostMap = parser.parse(output); - if (hostMap == null) { - machine.addAttribute(MachineAttributes.getStateAttributeDefinition().create(MachineAttributes.State.ERROR)); - machine.addAttribute(MPICH2MachineAttributes.getStatusMessageAttributeDefinition().create(Messages.MPICH2DiscoverJob_Exception_HostFileParseError)); - throw new CoreException(new Status(IStatus.ERROR, MPICH2Plugin.getDefault().getBundle().getSymbolicName(), parser.getErrorMessage())); - } - - /* - * Create model according to data from discover. - */ - int nodeCounter = 0; - - for (MPICH2HostMap.Host host : hostMap.getHosts()) { - - // Add node to model - String nodeId = rts.createNode(machineID, host.getName(), nodeCounter++); - - // Add processor information to node. - AttributeManager attrManager = new AttributeManager(); - if (host.getNumProcessors() != 0) { - try { - attrManager.addAttribute(MPICH2NodeAttributes.getNumberOfNodesAttributeDefinition().create(host.getNumProcessors())); - } catch (IllegalValueException e) { - // This situation is not possible since host.getNumProcessors() is always valid. - assert false; - } - } - rts.changeNode(nodeId, attrManager); - rts.setNodeIDForName(host.getName(), nodeId); - } - } catch (CoreException e) { - /* - * Show message of core exception and change machine status to error. - */ - if (e.getStatus().getSeverity() == IStatus.ERROR) { - AttributeManager attrManager = new AttributeManager(); - attrManager.addAttribute(MachineAttributes.getStateAttributeDefinition().create(MachineAttributes.State.ERROR)); - attrManager.addAttribute(MPICH2MachineAttributes.getStatusMessageAttributeDefinition().create(NLS.bind(Messages.MPICH2DiscoverJob_Exception_DiscoverCommandFailed, e.getMessage()))); - rts.changeMachine(machineID, attrManager); - } - throw e; - } catch (Exception e) { - /* - * Show message of all other exceptions and change machine status to error. - */ - AttributeManager attrManager = new AttributeManager(); - attrManager.addAttribute(MachineAttributes.getStateAttributeDefinition().create(MachineAttributes.State.ERROR)); - attrManager.addAttribute(MPICH2MachineAttributes.getStatusMessageAttributeDefinition().create(NLS.bind(Messages.MPICH2DiscoverJob_Exception_DiscoverCommandInternalError, e.getMessage()))); - rts.changeMachine(machineID, attrManager); - } - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2HostMap.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2HostMap.java deleted file mode 100644 index 554d64c7f..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2HostMap.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rtsystem; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** - * - * @author Daniel Felix Ferber - * - */ -public class MPICH2HostMap { - public static class Host { - public final static int NO_ERRORS = 0; - public final static int ERR_NUM_SLOTS = 1 << 1; - public final static int ERR_MAX_NUM_SLOTS = 1 << 2; - public final static int ERR_UNKNOWN_ATTR = 1 << 3; - - private String name = null; - private String addr = null; - private String port = null; - private int numProcessors = 0; - private int maxNumProcessors = 0; - private int errors = NO_ERRORS; - - public Host(String hostname, String address, String port) { - this.name = hostname; - this.addr = address; - this.port = port; - } - - public int getNumProcessors() { - return numProcessors; - } - - public int getMaxNumProcessors() { - return maxNumProcessors; - } - - public String getName() { - return name; - } - - public String getAddress() { - return addr; - } - - public String getPort() { - return port; - } - - public int getErrors() { - return errors; - } - - public void setNumProcessors(int numProcessors) { - this.numProcessors = numProcessors; - } - - public void setMaxNumProcessors(int maxNumProcessors) { - this.maxNumProcessors = maxNumProcessors; - } - - public void addErrors(int errors) { - this.errors |= errors; - } - } - - List<Host> hosts = new ArrayList<Host>(); - Map<String, Host> hostNameToHost = new HashMap<String, Host>(); - public boolean hasErrors = false; - - protected void addHost(Host host) { - hosts.add(host); - hostNameToHost.put(host.getName(), host); - } - - public Host[] getHosts() { - return hosts.toArray(new Host[hosts.size()]); - } - - public Iterator<Host> getHostIterator() { - return hosts.listIterator(); - } - - public Host getHostByName(String name) { - return hostNameToHost.get(name); - } - - public void addHost(String name, String address, String port) { - MPICH2HostMap.Host host = new MPICH2HostMap.Host(name, address, port); - addHost(host); - } - - public int count() { - return hosts.size(); - } - - public boolean hasParseErrors() { - return hasErrors; - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2JobMap.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2JobMap.java deleted file mode 100644 index 642fd7670..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2JobMap.java +++ /dev/null @@ -1,242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rtsystem; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * - * @author Greg Watson - * - */ -public class MPICH2JobMap { - - /** - * An MPICH2 job. - */ - public class Job { - private static final int JOBID = 1 << 0; - private static final int JOBALIAS = 1 << 1; - private static final int USERNAME = 1 << 2; - private static final int HOST = 1 << 3; - private static final int PID = 1 << 4; - private static final int SID = 1 << 5; - private static final int RANK = 1 << 6; - private static final int PGM = 1 << 7; - - private String jobID = null; - private String jobAlias = null; - private String username = null; - private String host = null; - private int pid = 0; - private int sid = 0; - private int rank = 0; - private String pgm = null; - private int complete; - - public Job() { - this.complete = 0; - } - - /** - * @return the host - */ - public String getHost() { - return host; - } - - /** - * @return the jobID - */ - public String getJobID() { - return jobID; - } - - /** - * @return the jobAlias - */ - public String getJobAlias() { - return jobAlias; - } - - /** - * @return the pgm - */ - public String getPgm() { - return pgm; - } - - /** - * @return the pid - */ - public int getPid() { - return pid; - } - - /** - * @return the rank - */ - public int getRank() { - return rank; - } - - /** - * @return the sid - */ - public int getSid() { - return sid; - } - - /** - * @return the username - */ - public String getUsername() { - return username; - } - - /** - * @return the complete - */ - public boolean isComplete() { - return complete == (JOBID | JOBALIAS | USERNAME | HOST | PID | SID | RANK | PGM); - } - - /** - * @param host the host to set - */ - public void setHost(String host) { - this.host = host; - this.complete |= HOST; - } - - /** - * @param jobID the jobID to set - */ - public void setJobID(String jobID) { - this.jobID = jobID; - this.complete |= JOBID; - } - - /** - * @param jobAlias the jobAlias to set - */ - public void setJobAlias(String jobAlias) { - this.jobAlias = jobAlias; - this.complete |= JOBALIAS; - } - - /** - * @param pgm the pgm to set - */ - public void setPgm(String pgm) { - this.pgm = pgm; - this.complete |= PGM; - } - - /** - * @param pid the pid to set - */ - public void setPid(int pid) { - this.pid = pid; - this.complete |= PID; - } - - /** - * @param rank the rank to set - */ - public void setRank(int rank) { - this.rank = rank; - this.complete |= RANK; - } - - /** - * @param sid the sid to set - */ - public void setSid(int sid) { - this.sid = sid; - this.complete |= SID; - } - /** - * @param username the username to set - */ - public void setUsername(String username) { - this.username = username; - this.complete |= USERNAME; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - String str = "Job "; //$NON-NLS-1$ - if (!isComplete()) { - str += "(incomplete) ["; //$NON-NLS-1$ - } else { - str += "]"; //$NON-NLS-1$ - } - if ((complete & JOBID) == JOBID) { - str += " id: " + jobID; //$NON-NLS-1$ - } - if ((complete & JOBALIAS) == JOBALIAS) { - str += " alias: " + jobAlias; //$NON-NLS-1$ - } - if ((complete & USERNAME) == USERNAME) { - str += " username:" + username; //$NON-NLS-1$ - } - if ((complete & HOST) == HOST) { - str += " host:" + host; //$NON-NLS-1$ - } - if ((complete & PID) == PID) { - str += " pid:" + pid; //$NON-NLS-1$ - } - if ((complete & SID) == SID) { - str += " sid:" + sid; //$NON-NLS-1$ - } - if ((complete & RANK) == RANK) { - str += " rank:" + rank; //$NON-NLS-1$ - } - if ((complete & PGM) == PGM) { - str += " pgm:" + pgm; //$NON-NLS-1$ - } - return str + "]"; //$NON-NLS-1$ - } - - } - - private final Map<String, List<Job>> jobsByID = new HashMap<String, List<Job>>(); - public boolean hasErrors = false; - - public MPICH2JobMap() { - // Nothing. - } - - public void addJob(Job job) { - List<Job> jobs = jobsByID.get(job.getJobID()); - if (jobs == null) { - jobs = new ArrayList<Job>(); - jobsByID.put(job.getJobID(), jobs); - } - jobs.add(job); - } - - public List<Job> getJob(String jobID) { - return jobsByID.get(jobID); - } - - public Collection<List<Job>> getJobs() { - return jobsByID.values(); - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2ListJobsParser.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2ListJobsParser.java deleted file mode 100644 index db25f9238..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2ListJobsParser.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rtsystem; - -import java.io.BufferedReader; -import java.io.IOException; - -import org.eclipse.ptp.rm.core.utils.DebugUtil; - -/** - * - * @author Greg Watson - * - */ -public class MPICH2ListJobsParser { - public enum JobListState {JOBLIST_INIT, JOBLIST_START, JOBLIST_END, JOBLIST_COMPLETE, JOBLIST_ERROR} - - private JobListState state; - private MPICH2JobMap map = new MPICH2JobMap(); - private String errorMsg; - - /** - * @param parser - * @param line - * @param job - */ - private void processJobInfo(String line, MPICH2JobMap.Job job) { - String[] parts = line.split("="); //$NON-NLS-1$ - String key; - String value; - - if (parts.length == 1) { - key = parts[0].trim(); - value = ""; //$NON-NLS-1$ - } else if (parts.length == 2) { - key = parts[0].trim(); - value = parts[1].trim(); - } else { - state = JobListState.JOBLIST_ERROR; - errorMsg = line; - return; - } - - if ("jobid".equals(key)) { //$NON-NLS-1$ - job.setJobID(value); - } else if ("jobalias".equals(key)) { //$NON-NLS-1$ - job.setJobAlias(value); - } else if ("username".equals(key)) { //$NON-NLS-1$ - job.setUsername(value); - } else if ("host".equals(key)) { //$NON-NLS-1$ - job.setHost(value); - } else if ("pid".equals(key)) { //$NON-NLS-1$ - job.setPid(Integer.parseInt(value)); - } else if ("sid".equals(key)) { //$NON-NLS-1$ - job.setSid(Integer.parseInt(value)); - } else if ("rank".equals(key)) { //$NON-NLS-1$ - job.setRank(Integer.parseInt(value)); - } else if ("pgm".equals(key)) { //$NON-NLS-1$ - job.setPgm(value); - } else { - state = JobListState.JOBLIST_ERROR; - errorMsg = line; - return; - } - - if (job.isComplete()) { - state = JobListState.JOBLIST_END; - } - } - - /** - * @param reader - * @return - * @throws IOException - */ - public MPICH2JobMap parse(BufferedReader reader) throws IOException { - String line = null; - MPICH2JobMap.Job job = null; - - state = JobListState.JOBLIST_INIT; - - while (state != JobListState.JOBLIST_COMPLETE) { - switch (state) { - case JOBLIST_INIT: - if ((line = reader.readLine()) == null) { - state = JobListState.JOBLIST_COMPLETE; - break; - } - - line = line.trim(); - - if (line.length() == 0) { - // Ignore empty line - break; - } - - state = JobListState.JOBLIST_START; - - job = map.new Job(); - processJobInfo(line, job); - break; - - case JOBLIST_START: - if ((line = reader.readLine()) == null) { - state = JobListState.JOBLIST_END; - break; - } - - line = line.trim(); - - if (line.length() == 0) { - state = JobListState.JOBLIST_END; - break; - } - - processJobInfo(line, job); - break; - - case JOBLIST_END: - if (job != null) { - if (job.isComplete()) { - map.addJob(job); - } else { - DebugUtil.trace(DebugUtil.RTS_DISCOVER_TRACING, "job is incomplete, skipping" + job.toString()); //$NON-NLS-1$ - } - } - - if (line == null) { - state = JobListState.JOBLIST_COMPLETE; - } else { - state = JobListState.JOBLIST_INIT; - } - DebugUtil.trace(DebugUtil.RTS_DISCOVER_TRACING, "found job " + job.toString()); //$NON-NLS-1$ - break; - - case JOBLIST_COMPLETE: - break; - - case JOBLIST_ERROR: - while ((line = reader.readLine()) != null) { - errorMsg += "\n" + line; //$NON-NLS-1$ - } - return null; - } - } - - return map; - } - - /** - * @return - */ - public String getErrorMessage() { - return errorMsg; - } -} - diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2PeriodicJob.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2PeriodicJob.java deleted file mode 100644 index e63278c31..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2PeriodicJob.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rtsystem; - -import java.io.BufferedReader; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ptp.core.PTPCorePlugin; -import org.eclipse.ptp.core.attributes.AttributeManager; -import org.eclipse.ptp.core.elementcontrols.IPNodeControl; -import org.eclipse.ptp.core.elementcontrols.IPProcessControl; -import org.eclipse.ptp.core.elements.IPJob; -import org.eclipse.ptp.core.elements.IPMachine; -import org.eclipse.ptp.core.elements.IPNode; -import org.eclipse.ptp.core.elements.IPQueue; -import org.eclipse.ptp.core.elements.IResourceManager; -import org.eclipse.ptp.core.elements.attributes.MachineAttributes; -import org.eclipse.ptp.core.elements.attributes.ProcessAttributes; -import org.eclipse.ptp.rm.core.ToolsRMPlugin; -import org.eclipse.ptp.rm.core.rtsystem.AbstractRemoteCommandJob; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2MachineAttributes; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2Plugin; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; - -/** - * - * @author Greg Watson - * - */ -public class MPICH2PeriodicJob extends AbstractRemoteCommandJob { - MPICH2RuntimeSystem rts; - - public MPICH2PeriodicJob(MPICH2RuntimeSystem rts) { - super(rts, - NLS.bind(Messages.MPICH2MonitorJob_name, rts.getRmConfiguration().getName()), - rts.retrieveEffectiveToolRmConfiguration().getPeriodicMonitorCmd(), - Messages.MPICH2MonitorJob_interruptedErrorMessage, - Messages.MPICH2MonitorJob_processErrorMessage, - Messages.MPICH2MonitorJob_parsingErrorMessage, - rts.retrieveEffectiveToolRmConfiguration().getPeriodicMonitorTime()); - this.rts = rts; - } - - @Override - protected void parse(BufferedReader output) throws CoreException { - /* - * MPI resource manager have only one machine and one queue. - * There they are implicitly "discovered". - */ - IResourceManager rm = PTPCorePlugin.getDefault().getUniverse().getResourceManager(rts.getRmID()); - IPMachine machine = rm.getMachineById(rts.getMachineID()); - IPQueue queue = rm.getQueueById(rts.getQueueID()); - - /* - * We may be called before the model has been set up properly. Do nothing - * if this is the case. - */ - if (machine == null || queue == null) { - return; - } - - /* - * Any exception from now on is caught in order to add the error message as an attribute to the machine. - * Then, the exception is re-thrown. - */ - try { - /* - * Parse output of mpdlistjobs command. - */ - MPICH2ListJobsParser parser = new MPICH2ListJobsParser(); - MPICH2JobMap jobMap = parser.parse(output); - if (jobMap == null) { - throw new CoreException(new Status(IStatus.ERROR, MPICH2Plugin.getDefault().getBundle().getSymbolicName(), parser.getErrorMessage())); - } - - /* - * Update model according to data. First create any new jobs. - */ - for (List<MPICH2JobMap.Job> jobs : jobMap.getJobs()) { - for (MPICH2JobMap.Job job : jobs) { - IPJob pJob = queue.getJobById(job.getJobAlias()); - if (pJob == null) { - // Not one of our jobs - continue; - } - IPProcessControl process = (IPProcessControl)pJob.getProcessByIndex(job.getRank()); - if (process != null) { - // process already exists, don't need to do anything - continue; - } - String nodeID = rts.getNodeIDforName(job.getHost()); - if (nodeID == null) { - throw new CoreException(new Status(IStatus.ERROR, ToolsRMPlugin.getDefault().getBundle().getSymbolicName(), Messages.MPICH2RuntimeSystemJob_Exception_HostnamesDoNotMatch, null)); - } - - String processName = Integer.toString(job.getRank()); - String processID = rts.createProcess(job.getJobAlias(), processName, job.getRank()); - process = (IPProcessControl)pJob.getProcessById(processID); - - IPNode node = machine.getNodeById(nodeID); - - /* - * Although one could call processControl.addNode(node) to assign the process to the node, this does not work. - * It is necessary to call nodeControl.addProcesses(processControl) instead. - */ - IPNodeControl nodeControl = (IPNodeControl) node; - nodeControl.addProcesses(Arrays.asList(new IPProcessControl[] {process})); - - process.setState(ProcessAttributes.State.RUNNING); - } - } - } catch (CoreException e) { - /* - * Show message of core exception and change machine status to error. - */ - if (e.getStatus().getSeverity() == IStatus.ERROR) { - AttributeManager attrManager = new AttributeManager(); - attrManager.addAttribute(MachineAttributes.getStateAttributeDefinition().create(MachineAttributes.State.ERROR)); - attrManager.addAttribute(MPICH2MachineAttributes.getStatusMessageAttributeDefinition().create(NLS.bind(Messages.MPICH2MonitorJob_Exception_CommandFailed, e.getMessage()))); - rts.changeMachine(machine.getID(), attrManager); - } - throw e; - } catch (Exception e) { - /* - * Show message of all other exceptions and change machine status to error. - */ - AttributeManager attrManager = new AttributeManager(); - attrManager.addAttribute(MachineAttributes.getStateAttributeDefinition().create(MachineAttributes.State.ERROR)); - attrManager.addAttribute(MPICH2MachineAttributes.getStatusMessageAttributeDefinition().create(NLS.bind(Messages.MPICH2MonitorJob_Exception_InternalError, e.getMessage()))); - rts.changeMachine(machine.getID(), attrManager); - } - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2RuntimeSystem.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2RuntimeSystem.java deleted file mode 100644 index b9316dc78..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2RuntimeSystem.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rtsystem; - - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.ptp.core.attributes.AttributeDefinitionManager; -import org.eclipse.ptp.core.attributes.AttributeManager; -import org.eclipse.ptp.rm.core.rmsystem.AbstractEffectiveToolRMConfiguration; -import org.eclipse.ptp.rm.core.rtsystem.AbstractToolRuntimeSystem; -import org.eclipse.ptp.rm.mpi.mpich2.core.messages.Messages; -import org.eclipse.ptp.rm.mpi.mpich2.core.rmsystem.EffectiveMPICH2ResourceManagerConfiguration; -import org.eclipse.ptp.rm.mpi.mpich2.core.rmsystem.MPICH2ResourceManagerConfiguration; - -/** - * - * @author Daniel Felix Ferber - * - */ -public class MPICH2RuntimeSystem extends AbstractToolRuntimeSystem { - - /** The machine where open mpi is running on. */ - private String machineID; - /** The queue that dispatches jobs to mpi. */ - private String queueID; - /** Mapping of discovered hosts and their ID for IPNode elements. */ - private Map<String,String> nodeNameToIDMap = new HashMap<String, String>(); - - public MPICH2RuntimeSystem(Integer rmid, - MPICH2ResourceManagerConfiguration config, - AttributeDefinitionManager attrDefMgr) { - super(rmid, config, attrDefMgr); - } - - protected void setMachineID(String machineID) { - this.machineID = machineID; - } - - protected void setQueueID(String queueID) { - this.queueID = queueID; - } - - public String getMachineID() { - return machineID; - } - - public String getQueueID() { - return queueID; - } - - public String getNodeIDforName(String hostname) { - return nodeNameToIDMap.get(hostname); - } - - public void setNodeIDForName(String hostname, String nodeID) { - nodeNameToIDMap.put(hostname, nodeID); - } - - /* - * (non-Javadoc) - * @see org.eclipse.ptp.rm.core.rtsystem.AbstractToolRuntimeSystem#doShutdown(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - protected void doShutdown(IProgressMonitor monitor) throws CoreException { - // Nothing to do - } - - /* - * (non-Javadoc) - * @see org.eclipse.ptp.rm.core.rtsystem.AbstractToolRuntimeSystem#doStartEvents() - */ - @Override - protected void doStartEvents() throws CoreException { - // Nothing to do - } - - /* - * (non-Javadoc) - * @see org.eclipse.ptp.rm.core.rtsystem.AbstractToolRuntimeSystem#doStartup(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - protected void doStartup(IProgressMonitor monitor) throws CoreException { - // Nothing to do - } - - /* - * (non-Javadoc) - * @see org.eclipse.ptp.rm.core.rtsystem.AbstractToolRuntimeSystem#doStopEvents() - */ - @Override - protected void doStopEvents() throws CoreException { - // Nothing to do - } - - @Override - protected Job createDiscoverJob() { - if (!rmConfiguration.hasDiscoverCmd()) { - return null; - } - Job job = new MPICH2DiscoverJob(this); - job.setPriority(Job.INTERACTIVE); - job.setSystem(false); - job.setUser(false); - return job; - } - - @Override - protected Job createPeriodicMonitorJob() { - if (!rmConfiguration.hasPeriodicMonitorCmd()) { - return null; - } - Job job = new MPICH2PeriodicJob(this); - job.setPriority(Job.INTERACTIVE); - job.setSystem(false); - job.setUser(false); - return job; - } - - @Override - protected Job createContinuousMonitorJob() { - return null; - } - - @Override - public Job createRuntimeSystemJob(String jobID, String queueID, AttributeManager attrMgr) { - return new MPICH2RuntimeSystemJob(jobID, queueID, Messages.MPICH2RuntimeSystem_JobName, this, attrMgr); - } - - - @Override - public AbstractEffectiveToolRMConfiguration retrieveEffectiveToolRmConfiguration() { - return new EffectiveMPICH2ResourceManagerConfiguration(getRmConfiguration()); - } -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2RuntimeSystemJob.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2RuntimeSystemJob.java deleted file mode 100644 index e56a8d76c..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2RuntimeSystemJob.java +++ /dev/null @@ -1,411 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rtsystem; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.ptp.core.PTPCorePlugin; -import org.eclipse.ptp.core.attributes.AttributeManager; -import org.eclipse.ptp.core.attributes.IAttribute; -import org.eclipse.ptp.core.attributes.IntegerAttribute; -import org.eclipse.ptp.core.elements.IPJob; -import org.eclipse.ptp.core.elements.IPProcess; -import org.eclipse.ptp.core.elements.attributes.JobAttributes; -import org.eclipse.ptp.core.elements.attributes.ProcessAttributes; -import org.eclipse.ptp.core.elements.attributes.ProcessAttributes.State; -import org.eclipse.ptp.core.elements.events.IChangedProcessEvent; -import org.eclipse.ptp.core.elements.events.INewProcessEvent; -import org.eclipse.ptp.core.elements.events.IProcessChangeEvent; -import org.eclipse.ptp.core.elements.events.IRemoveProcessEvent; -import org.eclipse.ptp.core.elements.listeners.IJobChildListener; -import org.eclipse.ptp.core.elements.listeners.IProcessListener; -import org.eclipse.ptp.rm.core.rtsystem.AbstractToolRuntimeSystem; -import org.eclipse.ptp.rm.core.rtsystem.AbstractToolRuntimeSystemJob; -import org.eclipse.ptp.rm.core.utils.DebugUtil; -import org.eclipse.ptp.rm.core.utils.InputStreamListenerToOutputStream; -import org.eclipse.ptp.rm.core.utils.InputStreamObserver; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2JobAttributes; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2LaunchAttributes; -import org.eclipse.ptp.rm.mpi.mpich2.core.MPICH2Plugin; - -/** - * - * @author Daniel Felix Ferber - * @author Greg Watson - * - */ -public class MPICH2RuntimeSystemJob extends AbstractToolRuntimeSystemJob { - - private Object lock1 = new Object(); - private InputStreamObserver stderrObserver; - private InputStreamObserver stdoutObserver; - - protected final ReentrantLock procsLock = new ReentrantLock(); - protected final Condition procsCondition = procsLock.newCondition(); - protected int numRunningProcs = 0; - - protected IProcessListener processListener = new IProcessListener() { - /* (non-Javadoc) - * @see org.eclipse.ptp.core.elements.listeners.IProcessListener#handleEvent(org.eclipse.ptp.core.elements.events.IProcessChangeEvent) - */ - public void handleEvent(IProcessChangeEvent e) { - if (e.getAttributes().getAttribute(ProcessAttributes.getStateAttributeDefinition()) != null - && e.getSource().getState() == ProcessAttributes.State.RUNNING) { - procsLock.lock(); - try { - numRunningProcs++; - procsCondition.signalAll(); - } finally { - procsLock.unlock(); - } - } - } - }; - - protected IJobChildListener jobChildListener = new IJobChildListener() { - /* (non-Javadoc) - * @see org.eclipse.ptp.core.elements.listeners.IJobChildListener#handleEvent(org.eclipse.ptp.core.elements.events.IChangedProcessEvent) - */ - public void handleEvent(IChangedProcessEvent e) { - // ignore - } - - /* (non-Javadoc) - * @see org.eclipse.ptp.core.elements.listeners.IJobChildListener#handleEvent(org.eclipse.ptp.core.elements.events.INewProcessEvent) - */ - public void handleEvent(INewProcessEvent e) { - for (IPProcess process : e.getProcesses()) { - process.addElementListener(processListener); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ptp.core.elements.listeners.IJobChildListener#handleEvent(org.eclipse.ptp.core.elements.events.IRemoveProcessEvent) - */ - public void handleEvent(IRemoveProcessEvent e) { - for (IPProcess process : e.getProcesses()) { - process.removeElementListener(processListener); - } - } - }; - - public MPICH2RuntimeSystemJob(String jobID, String queueID, String name, AbstractToolRuntimeSystem rtSystem, AttributeManager attrMgr) { - super(jobID, queueID, name, rtSystem, attrMgr); - } - - private void changeAllProcessesStatus(State newState) { - final MPICH2RuntimeSystem rtSystem = (MPICH2RuntimeSystem) getRtSystem(); - final IPJob ipJob = PTPCorePlugin.getDefault().getUniverse().getResourceManager(rtSystem.getRmID()).getQueueById(getQueueID()).getJobById(getJobID()); - - /* - * Mark all running and starting processes as finished. - */ - List<String> ids = new ArrayList<String>(); - for (IPProcess ipProcess : ipJob.getProcesses()) { - switch (ipProcess.getState()) { - case EXITED: - case ERROR: - case EXITED_SIGNALLED: - break; - case RUNNING: - case STARTING: - case SUSPENDED: - case UNKNOWN: - ids.add(ipProcess.getID()); - break; - } - } - - AttributeManager attrMrg = new AttributeManager(); - attrMrg.addAttribute(ProcessAttributes.getStateAttributeDefinition().create(newState)); - for (String processId : ids) { - rtSystem.changeProcess(processId, attrMrg); - } - } - - @Override - protected void doBeforeExecution(IProgressMonitor monitor) throws CoreException { - final MPICH2RuntimeSystem rtSystem = (MPICH2RuntimeSystem) getRtSystem(); - final IPJob ipJob = PTPCorePlugin.getDefault().getUniverse().getResourceManager(rtSystem.getRmID()).getQueueById(getQueueID()).getJobById(getJobID()); - ipJob.addChildListener(jobChildListener); - } - - @Override - protected void doExecutionCleanUp(IProgressMonitor monitor) { - if (process != null) { - process.destroy(); - } - if (stderrObserver != null) { - stderrObserver.kill(); - stderrObserver = null; - } - if (stdoutObserver != null) { - stdoutObserver.kill(); - stdoutObserver = null; - } - // TODO: more cleanup? - changeAllProcessesStatus(ProcessAttributes.State.EXITED); - } - - @Override - protected void doExecutionFinished(IProgressMonitor monitor) throws CoreException { - changeAllProcessesStatus(ProcessAttributes.State.EXITED); - } - - @Override - protected void doExecutionStarted(IProgressMonitor monitor) throws CoreException { - final MPICH2RuntimeSystem rtSystem = (MPICH2RuntimeSystem) getRtSystem(); - final IPJob ipJob = PTPCorePlugin.getDefault().getUniverse().getResourceManager(rtSystem.getRmID()).getQueueById(getQueueID()).getJobById(getJobID()); - - /* - * Listener that saves stdout. - */ - final PipedOutputStream stdoutOutputStream = new PipedOutputStream(); - final PipedInputStream stdoutInputStream = new PipedInputStream(); - try { - stdoutInputStream.connect(stdoutOutputStream); - } catch (IOException e) { - assert false; // This exception is not possible - } - final InputStreamListenerToOutputStream stdoutPipedStreamListener = new InputStreamListenerToOutputStream(stdoutOutputStream); - - Thread stdoutThread = new Thread() { - @Override - public void run() { - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: stdout thread: started", getJobID()); //$NON-NLS-1$ - BufferedReader stdoutBufferedReader = new BufferedReader(new InputStreamReader(stdoutInputStream)); - try { - String line = stdoutBufferedReader.readLine(); - while (line != null) { - int index = 0; - int pos = line.indexOf(": "); //$NON-NLS-1$ - if (pos > 0) { - try { - index = Integer.parseInt(line.substring(0, pos)); - line = line.substring(pos+1); - } catch (NumberFormatException e) { - // ignore - } - } - synchronized (lock1) { - IPProcess ipProc = ipJob.getProcessByIndex(index); - if (ipProc != null) { - ipProc.addAttribute(ProcessAttributes.getStdoutAttributeDefinition().create(line)); - } - DebugUtil.trace(DebugUtil.RTS_JOB_OUTPUT_TRACING, "RTS job #{0}:> {1}", jobID, line); //$NON-NLS-1$ - } - line = stdoutBufferedReader.readLine(); - } - } catch (IOException e) { - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: stdout thread: {0}", e); //$NON-NLS-1$ - MPICH2Plugin.log(e); - } finally { - stdoutPipedStreamListener.disable(); - } - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: stdout thread: finished", jobID); //$NON-NLS-1$ - } - }; - - /* - * Listener that saves stderr. - */ - final PipedOutputStream stderrOutputStream = new PipedOutputStream(); - final PipedInputStream stderrInputStream = new PipedInputStream(); - try { - stderrInputStream.connect(stderrOutputStream); - } catch (IOException e) { - assert false; // This exception is not possible - } - final InputStreamListenerToOutputStream stderrPipedStreamListener = new InputStreamListenerToOutputStream(stderrOutputStream); - Thread stderrThread = new Thread() { - @Override - public void run() { - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: stderr thread: started", getJobID()); //$NON-NLS-1$ - final BufferedReader stderrBufferedReader = new BufferedReader(new InputStreamReader(stderrInputStream)); - try { - String line = stderrBufferedReader.readLine(); - while (line != null) { - int index = 0; - int pos = line.indexOf(": "); //$NON-NLS-1$ - if (pos > 0) { - try { - index = Integer.parseInt(line.substring(0, pos)); - line = line.substring(pos+1); - } catch (NumberFormatException e) { - // ignore - } - } - synchronized (lock1) { - IPProcess ipProc = ipJob.getProcessByIndex(index); - if (ipProc != null) { - ipProc.addAttribute(ProcessAttributes.getStderrAttributeDefinition().create(line)); - } - DebugUtil.error(DebugUtil.RTS_JOB_OUTPUT_TRACING, "RTS job #{0}:> {1}", getJobID(), line); //$NON-NLS-1$ - } - line = stderrBufferedReader.readLine(); - } - } catch (IOException e) { - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: stderr thread: {1}", getJobID(), e); //$NON-NLS-1$ - MPICH2Plugin.log(e); - } finally { - stderrPipedStreamListener.disable(); - } - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: stderr thread: finished", getJobID()); //$NON-NLS-1$ - } - }; - - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: starting all threads", getJobID()); //$NON-NLS-1$ - /* - * Create and start listeners. - */ - stdoutThread.start(); - stderrThread.start(); - - stderrObserver = new InputStreamObserver(process.getErrorStream()); - stdoutObserver = new InputStreamObserver(process.getInputStream()); - - stdoutObserver.addListener(stdoutPipedStreamListener); - stderrObserver.addListener(stderrPipedStreamListener); - - stderrObserver.start(); - stdoutObserver.start(); - - /* - * At this point we need to pause until all processes have started. This is because - * the model semantics are such that the job state must not be set to RUNNING until - * all the job's processes (if there are any) have been created and also set to RUNNING. - */ - - /* - * We know that a MPICH2 job has a number of processes attribute - */ - int numProcs = 1; - IntegerAttribute numProcsAttr = attrMgr.getAttribute(JobAttributes.getNumberOfProcessesAttributeDefinition()); - if (numProcsAttr != null) { - numProcs = numProcsAttr.getValue().intValue(); - } - - procsLock.lock(); - try { - while (!monitor.isCanceled() && numRunningProcs < numProcs) { - try { - procsCondition.await(500, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - // ignore - } - } - } finally { - procsLock.unlock(); - } - } - - @Override - protected void doPrepareExecution(IProgressMonitor monitor) throws CoreException { - // Nothing to do - } - - @Override - protected IAttribute<?, ?, ?>[] doRetrieveToolBaseSubstitutionAttributes() throws CoreException { - // TODO make macros available for environment variables and work directory. - return null; - } - - @Override - protected IAttribute<?, ?, ?>[] doRetrieveToolCommandSubstitutionAttributes( - AttributeManager baseSubstitutionAttributeManager, - String directory, Map<String, String> environment) { - - List<IAttribute<?, ?, ?>> newAttributes = new ArrayList<IAttribute<?,?,?>>(); - - /* - * An MPICH2 specific attribute. - * Attribute that contains a list of names of environment variables. - */ - int p = 0; - String keys[] = new String[environment.size()]; - for (String key : environment.keySet()) { - keys[p++] = key; - } - newAttributes.add(MPICH2LaunchAttributes.getEnvironmentKeysAttributeDefinition().create(keys)); - - /* - * An MPICH2 specific attribute. - * A shortcut that generates arguments for the MPICH2 run command. - */ - newAttributes.add(MPICH2LaunchAttributes.getEnvironmentArgsAttributeDefinition().create()); - - /* - * The jobid is used to alias the MPICH2 job so that it can be matched later. - */ - newAttributes.add(MPICH2JobAttributes.getJobIdAttributeDefinition().create(jobID)); - - return newAttributes.toArray(new IAttribute<?, ?, ?>[newAttributes.size()]); - } - - @Override - protected HashMap<String, String> doRetrieveToolEnvironment() - throws CoreException { - // No extra environment variables needs to be set for MPICH2. - return null; - } - - @Override - protected void doTerminateJob() { - // Empty implementation. - } - - @Override - protected void doWaitExecution(IProgressMonitor monitor) throws CoreException { - /* - * Wait until both stdout and stderr stop because stream are closed. - * This means that the process has finished. - */ - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: waiting stderr thread to finish", jobID); //$NON-NLS-1$ - try { - stderrObserver.join(); - } catch (InterruptedException e1) { - // Ignore - } - - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: waiting stdout thread to finish", jobID); //$NON-NLS-1$ - try { - stdoutObserver.join(); - } catch (InterruptedException e1) { - // Ignore - } - - /* - * Still experience has shown that remote process might not have yet terminated, although stdout and stderr is closed. - */ - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: waiting mpi process to finish completely", jobID); //$NON-NLS-1$ - try { - process.waitFor(); - } catch (InterruptedException e) { - // Ignore - } - - DebugUtil.trace(DebugUtil.RTS_JOB_TRACING_MORE, "RTS job #{0}: completely finished", jobID); //$NON-NLS-1$ - } - -} diff --git a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2TraceParser.java b/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2TraceParser.java deleted file mode 100644 index f0433c05f..000000000 --- a/rms/org.eclipse.ptp.rm.mpi.mpich2.core/src/org/eclipse/ptp/rm/mpi/mpich2/core/rtsystem/MPICH2TraceParser.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.mpi.mpich2.core.rtsystem; - -import java.io.BufferedReader; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.ptp.rm.core.utils.DebugUtil; - -/** - * - * @author Greg Watson - * - */ -public class MPICH2TraceParser { - private String errorMessage = null; - private MPICH2HostMap map = new MPICH2HostMap(); - private static Pattern pattern = Pattern.compile("([^_]+)_([0-9])+ \\(([0-9.]+)\\)"); //$NON-NLS-1$ - - /** - * Parse the output of the mpdtrace command. - * - * @param reader - * @return an MPICH2HostMap containing the known hosts, or null if there was an error - * @throws IOException - */ - public MPICH2HostMap parse(BufferedReader reader) throws IOException { - MPICH2TraceParser parser = new MPICH2TraceParser(); - String line; - while ((line = reader.readLine()) != null) { - line = line.trim(); - - if (line.length()==0) { - // Ignore empty line - continue; - } - - Matcher matcher = pattern.matcher(line); - if (!matcher.matches()) { - /* - * Probably an error from mpdtrace. Collect lines and mark error. - */ - errorMessage = ""; //$NON-NLS-1$ - - while ((line = reader.readLine()) != null) { - errorMessage += line + "\n"; //$NON-NLS-1$ - } - - return null; - } - - if (matcher.matches() && matcher.groupCount() == 3) { - String host = matcher.group(1); - String port = matcher.group(2); - String addr = matcher.group(3); - parser.map.addHost(host, addr, port); - DebugUtil.trace(DebugUtil.RTS_DISCOVER_TRACING, "found host " + host + " addr " + addr + " port " + port); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } - - return parser.map; - } - - /** - * @return error message - */ - public String getErrorMessage() { - return errorMessage; - } -} - |