You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ms...@apache.org on 2014/12/10 13:38:15 UTC

[4/5] airavata git commit: working mpi example

working mpi example

Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6644942b
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6644942b
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6644942b

Branch: refs/heads/master
Commit: 6644942bfd1a3b2214a0497bc7ddaaf6d839fe1d
Parents: f4a32fd
Author: msmemon <sh...@gmail.com>
Authored: Wed Dec 10 13:31:14 2014 +0100
Committer: msmemon <sh...@gmail.com>
Committed: Wed Dec 10 13:31:14 2014 +0100

----------------------------------------------------------------------
 .../client/samples/CreateLaunchExperiment.java  | 68 +++++++++++++++++++-
 .../tools/RegisterSampleApplications.java       | 53 ++++++++++++++-
 modules/distribution/server/pom.xml             | 10 +--
 3 files changed, 123 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/6644942b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index 5c3ef19..aa3e654 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -58,6 +58,7 @@ public class CreateLaunchExperiment {
     private static Airavata.Client airavataClient;
 
     private static String echoAppId = "Echo_753d7cf6-f79a-4f7f-8ada-5d707e90c383";
+    private static String mpiAppId = "HelloMPI_da45305f-5d90-4a18-8716-8dd54c3b2376";
     private static String wrfAppId = "WRF_7ad5da38-c08b-417c-a9ea-da9298839762";
     private static String amberAppId = "Amber_49b16f6f-93ab-4885-9971-6ab2ab5eb3d3";
     private static String gromacsAppId = "GROMACS_05622038-9edd-4cb1-824e-0b7cb993364b";
@@ -81,7 +82,7 @@ public class CreateLaunchExperiment {
     public static void main(String[] args) throws Exception {
                 airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT);
                 System.out.println("API version is " + airavataClient.getAPIVersion());
-//                registerApplications(); // run this only the first time
+//              registerApplications(); // run this only the first time
                 createAndLaunchExp();
     }
     
@@ -93,7 +94,8 @@ public class CreateLaunchExperiment {
         try {
             for (int i = 0; i < 1; i++) {
 //                final String expId = createExperimentForSSHHost(airavata);
-                final String expId = createEchoExperimentForFSD(airavataClient);
+//                final String expId = createEchoExperimentForFSD(airavataClient);
+                final String expId = createMPIExperimentForFSD(airavataClient);
 //                final String expId = createEchoExperimentForStampede(airavataClient);
 //                final String expId = createEchoExperimentForTrestles(airavataClient);
 //                final String expId = createExperimentEchoForLocalHost(airavataClient);
@@ -296,9 +298,71 @@ public class CreateLaunchExperiment {
         }
         return null;
     }
+    
+    
+    public static String createMPIExperimentForFSD(Airavata.Client client) throws TException {
+        try {
+           
+        	List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();
+            InputDataObjectType input = new InputDataObjectType();
+            input.setName("Sample_Input");
+            input.setType(DataType.STRING);
+            input.setValue("");
+        	exInputs.add(input);
+            
+            List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
+            OutputDataObjectType output = new OutputDataObjectType();
+            output.setName("Sample_Output");
+            output.setType(DataType.STRING);
+            output.setValue("");
+            exOut.add(output);
+            
+            Experiment simpleExperiment = 
+                    ExperimentModelUtil.createSimpleExperiment("default", "admin", "mpiExperiment", "HelloMPI", mpiAppId, null);
+//          simpleExperiment.setExperimentOutputs(exOut);
+            
+            
+            
+            Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(mpiAppId);
+            if (computeResources != null && computeResources.size() != 0) {
+                for (String id : computeResources.keySet()) {
+                    String resourceName = computeResources.get(id);
+                    if (resourceName.equals(unicoreHostName)) {
+                        ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 2, 1, 2, "normal", 30, 0, 1048576, "sds128");
+                        UserConfigurationData userConfigurationData = new UserConfigurationData();
+                        userConfigurationData.setAiravataAutoSchedule(false);
+                        userConfigurationData.setOverrideManualScheduledParams(false);
+                        userConfigurationData.setComputationalResourceScheduling(scheduling);
+                        
+                        // set output directory 
+                        AdvancedOutputDataHandling dataHandling = new AdvancedOutputDataHandling();
+                        dataHandling.setOutputDataDir("/tmp/airavata/output/"+UUID.randomUUID().toString()+"/");
+                        userConfigurationData.setAdvanceOutputDataHandling(dataHandling);
+                        simpleExperiment.setUserConfigurationData(userConfigurationData);
+                        
+                        return client.createExperiment(simpleExperiment);
+                    }
+                }
+            }
+        } catch (AiravataSystemException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataSystemException(e);
+        } catch (InvalidRequestException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new InvalidRequestException(e);
+        } catch (AiravataClientException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataClientException(e);
+        } catch (TException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new TException(e);
+        }
+        return null;
+    }
 
     
     
+    
     public static String createExperimentWRFStampede(Airavata.Client client) throws TException {
         try {
             List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();

http://git-wip-us.apache.org/repos/asf/airavata/blob/6644942b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
index ce26814..9a2aaf7 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
@@ -71,6 +71,7 @@ public class RegisterSampleApplications {
     private static final String trinityName = "Trinity";
     private static final String wrfName = "WRF";
     private static final String phastaName = "PHASTA";
+    private static final String mpiName = "HelloMPI";
 
     //Appplication Descriptions
     private static final String echoDescription = "A Simple Echo Application";
@@ -83,6 +84,7 @@ public class RegisterSampleApplications {
     private static final String trinityDescription = "de novo reconstruction of transcriptomes from RNA-seq data";
     private static final String wrfDescription = "Weather Research and Forecasting";
     private static final String phastaDescription = "Computational fluid dynamics solver";
+    private static final String mpiDescription = "A Hello MPI Application";
 
     //App Module Id's
     private static String echoModuleId;
@@ -95,9 +97,11 @@ public class RegisterSampleApplications {
     private static String trinityModuleId = "Trinity_8af45ca0-b628-4614-9087-c7b73f5f2fb6";
     private static String wrfModuleId;
     private static String phastaModuleId;
+    private static String mpiModuleId;
 
     //App Interface Id's
     private static String echoInterfaceId = "";
+    private static String mpiInterfaceId = "";
     private static String echoLocalInterfaceId = "";
     private static String amberInterfaceId = "";
     private static String autoDockInterfaceId = "";
@@ -230,6 +234,12 @@ public class RegisterSampleApplications {
                     RegisterSampleApplicationsUtils.createApplicationModule(
                             echoName, "1.0", echoDescription));
             System.out.println("Echo Module Id " + echoModuleId);
+            
+            mpiModuleId = airavataClient.registerApplicationModule(
+                    RegisterSampleApplicationsUtils.createApplicationModule(
+                            mpiName, "1.0", mpiDescription));
+            System.out.println("MPI Module Id " + mpiModuleId);
+            
 
             //Register Amber
             amberModuleId = airavataClient.registerApplicationModule(
@@ -320,6 +330,9 @@ public class RegisterSampleApplications {
 
         //Registering Echo
         registerEchoInterface();
+        
+        //Registering MPI
+        registerMPIInterface();
 
         //Registering Amber
         registerAmberInterface();
@@ -552,7 +565,39 @@ public class RegisterSampleApplications {
             e.printStackTrace();
         }
     }
+    
+    
+    public void registerMPIInterface() {
+        try {
+            System.out.println("#### Registering MPI Interface #### \n");
+            
+            List<String> appModules = new ArrayList<String>();
+            appModules.add(mpiModuleId);
 
+            InputDataObjectType input1 = RegisterSampleApplicationsUtils.createAppInput("Sample_Input", "",
+                    DataType.STRING, null, false, "An optional MPI source file", null);
+            
+            List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>();
+            applicationInputs.add(input1);
+            
+            OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("Sample_Output",
+                    "", DataType.STRING);
+            
+            List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
+            applicationOutputs.add(output1);
+ 
+            
+            mpiInterfaceId = airavataClient.registerApplicationInterface(
+                    RegisterSampleApplicationsUtils.createApplicationInterfaceDescription(mpiName, mpiDescription,
+                            appModules, applicationInputs, applicationOutputs));
+            System.out.println("MPI Application Interface Id " + mpiInterfaceId);
+
+        } catch (TException e) {
+            e.printStackTrace();
+        }
+    }
+
+    
     public void registerAmberInterface() {
         try {
             System.out.println("#### Registering Amber Interface #### \n");
@@ -1039,7 +1084,13 @@ public class RegisterSampleApplications {
             String echoAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId, fsdResourceId,
                             "/bin/echo", ApplicationParallelismType.SERIAL, echoDescription));
-            System.out.println("Echo on FSD deployment Id " + echoAppDeployId);
+            System.out.println("Echo on FSD deployment Id: " + echoAppDeployId);
+
+            //Register MPI
+            String mpiAppDeployId = airavataClient.registerApplicationDeployment(
+                    RegisterSampleApplicationsUtils.createApplicationDeployment(mpiModuleId, fsdResourceId,
+                            "/home/bes/hellompi", ApplicationParallelismType.OPENMP_MPI, mpiDescription));
+            System.out.println("MPI on FSD deployment Id: " + mpiAppDeployId);
 
         } catch (TException e) {
             e.printStackTrace();

http://git-wip-us.apache.org/repos/asf/airavata/blob/6644942b/modules/distribution/server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/server/pom.xml b/modules/distribution/server/pom.xml
index 1f8b659..fb018a0 100644
--- a/modules/distribution/server/pom.xml
+++ b/modules/distribution/server/pom.xml
@@ -319,11 +319,11 @@
             <!--<artifactId>airavata-gfac-gram</artifactId>-->
             <!--<version>${project.version}</version>-->
         <!--</dependency>-->
-        <!--<dependency>-->
-            <!--<groupId>org.apache.airavata</groupId>-->
-            <!--<artifactId>airavata-gfac-bes</artifactId>-->
-            <!--<version>${project.version}</version>-->
-        <!--</dependency>-->
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-gfac-bes</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.airavata</groupId>
             <artifactId>airavata-gfac-gsissh</artifactId>