Salome HOME
Implementation de sat #11056 : Gestion des launcher mesa: nct/mesa
authorcrouzet <nicolas.crouzet@cea.fr>
Thu, 5 Apr 2018 12:58:13 +0000 (14:58 +0200)
committercrouzet <nicolas.crouzet@cea.fr>
Thu, 5 Apr 2018 12:58:13 +0000 (14:58 +0200)
 - ajout de l'option --use_mesa  à sat application et sat launcher
 - génération si mesa est embarqué qu'un launcher mesa_salome
 - environment : on saute les produits mesa par défaut - sauf quand c'est activé

commands/application.py
commands/launcher.py
commands/package.py
src/__init__.py
src/environment.py
src/internal_config/README_BIN.template
src/internal_config/README_LAUNCHER.template

index 4a0d9b9a681f2e169d675c7ebb838c0c9bb42ef9..46cf96c5085656c49989792971ed32e1123ee007 100644 (file)
@@ -42,6 +42,9 @@ parser.add_option('', 'gencat', 'string', 'gencat',
 parser.add_option('m', 'module', 'list2', 'modules',
     _("Optional: the restricted list of module(s) to include in the "
       "application"))
+parser.add_option('', 'use_mesa', 'boolean', 'use_mesa',
+    _("Optional: Create a launcher that will use mesa products\n\t"
+      "It can be usefull whan salome is used on a remote machine through ssh"))
 
 ##
 # Creates an alias for runAppli.
@@ -416,6 +419,10 @@ def run(args, runner, logger):
     if options.modules:
         runner.cfg.APPLICATION.virtual_app['modules'] = options.modules
 
+    # activate mesa use in the generated application
+    if options.use_mesa:
+        src.activate_mesa_property(runner.cfg)
+
     # set name and application_name
     if options.name:
         runner.cfg.APPLICATION.virtual_app['name'] = options.name
index 213845adf783988b3703e0582a525e5554fbd234..f0e0ece8ea43e1440cf3f2a45caae7a5ccf21234 100644 (file)
@@ -24,6 +24,7 @@ import subprocess
 import stat
 
 import src
+import src.debug as DBG
 
 parser = src.options.Options()
 
@@ -36,6 +37,9 @@ parser.add_option('', 'gencat', 'string', 'gencat',
     _("Optional: Create a resources catalog for the specified machines "
       "(separated with ',') \n\tNOTICE: this command will ssh to retrieve"
       " information to each machine in the list"))
+parser.add_option('', 'use_mesa', 'boolean', 'use_mesa',
+    _("Optional: Create a launcher that will use mesa products\n\t"
+      "It can be usefull whan salome is used on a remote machine through ssh"))
 
 def generate_launch_file(config,
                          logger,
@@ -256,6 +260,10 @@ def run(args, runner, logger):
                                          logger)
         additional_environ = copy_catalog(runner.cfg, catalog_path)
 
+    # activate mesa use in the generated launcher
+    if options.use_mesa:
+        src.activate_mesa_property(runner.cfg)
+
     # Generate the launcher
     launcherPath = generate_launch_file( runner.cfg,
                                          logger,
index 5a2c493b31b15ad668505a840b83d08a46042e1d..9e1d423aaed6dde4cb17636126eaa6dde9e15417 100644 (file)
@@ -465,6 +465,7 @@ def binary_package(config, logger, options, tmp_working_dir):
     l_source_dir = []
     l_not_installed = []
     l_sources_not_present = []
+    generate_mesa_launcher = False  # a flag to know if we generate a mesa launcher
     for prod_name, prod_info in l_product_info:
 
         # Add the sources of the products that have the property 
@@ -476,6 +477,10 @@ def binary_package(config, logger, options, tmp_working_dir):
             else:
                 l_sources_not_present.append(prod_name)
 
+        # if at least one of the application products has the "is_mesa" property
+        if src.get_property_in_product_cfg(prod_info, "is_mesa") == "yes":
+            generate_mesa_launcher = True  # we will generate a mesa launcher
+
         # ignore the native and fixed products for install directories
         if (src.product.product_is_native(prod_info) 
                 or src.product.product_is_fixed(prod_info)
@@ -574,8 +579,36 @@ WARNING: existing binaries directory from previous detar installation:
                                                  launcher_name,
                                                  binaries_dir_name,
                                                  not(options.without_commercial))
-        
             d_products["launcher"] = (launcher_package, launcher_name)
+
+            # if the application contains mesa products, we generate in addition to the 
+            # classical salome launcher a launcher using mesa and called mesa_salome 
+            # (the mesa launcher will be used for remote usage through ssh).
+            if generate_mesa_launcher:
+                #if there is one : store the use_mesa property
+                restore_use_mesa_option=None
+                if ('properties' in config.APPLICATION and 
+                    'use_mesa' in config.APPLICATION.properties):
+                    restore_use_mesa_option = config.APPLICATION.properties.use_mesa
+
+                # activate mesa property, and generate a mesa launcher
+                src.activate_mesa_property(config)  #activate use_mesa property
+                launcher_mesa_name="mesa_"+launcher_name
+                launcher_package_mesa = produce_relative_launcher(config,
+                                                     logger,
+                                                     tmp_working_dir,
+                                                     launcher_mesa_name,
+                                                     binaries_dir_name,
+                                                     not(options.without_commercial))
+                d_products["launcher (mesa)"] = (launcher_package_mesa, launcher_mesa_name)
+
+                # if there was a use_mesa value, we restore it
+                # else we set it to the default value "no"
+                if restore_use_mesa_option != None:
+                    config.APPLICATION.properties.use_mesa=restore_use_mesa_option
+                else:
+                    config.APPLICATION.properties.use_mesa="no"
+
             if options.sources:
                 # if we mix binaries and sources, we add a copy of the launcher, 
                 # prefixed  with "bin",in order to avoid clashes
index 13e8a1817d64ecd5b78ccc997cf99b5f01b40539..7f3d789a4d588e3667d7e378dfc2926b149d5f25 100644 (file)
@@ -420,3 +420,14 @@ def get_property_in_product_cfg(product_cfg, pprty):
     if not pprty in product_cfg.properties:
         return None
     return product_cfg.properties[pprty]
+
+def activate_mesa_property(config):
+    """Add mesa property into application properties
+    
+    :param config Config: The global configuration. It must have an application!
+    """
+    # Verify the existence of the file
+    if not 'properties' in config.APPLICATION:
+        config.APPLICATION.addMapping( 'properties', src.pyconf.Mapping(), None )
+    config.APPLICATION.properties.use_mesa="yes"
+
index 650efe59e9e8830f85ad2ef1c9c6776fa63cafdd..56ba0b81ac3e84b069ff84a2f3de6cf2ff208e35 100644 (file)
@@ -521,6 +521,19 @@ class SalomeEnviron:
 
         # Get the informations corresponding to the product
         pi = src.product.get_product_config(self.cfg, product)
+
+        # skip mesa product, unless use_mesa property was activated
+        
+        if not ("APPLICATION" in self.cfg  and
+                "properties" in self.cfg.APPLICATION  and
+                "use_mesa" in self.cfg.APPLICATION.properties  and
+                self.cfg.APPLICATION.properties.use_mesa == "yes") :
+            if ("properties" in pi and
+                "is_mesa" in pi.properties  and
+                pi.properties.is_mesa == "yes") :
+                logger.write(_("Skip mesa product %s\n") % pi.name, 4)
+                return
+           
         
         if self.for_package:
             pi.install_dir = os.path.join("out_dir_Path",
index 5307eb24206121037a048ed5ab3d265d4f42fc06..2f0154d715dd0cdc68ffbaf58c91c48eb85a8d7e 100644 (file)
@@ -5,9 +5,8 @@ Binaries
 This package includes a binary installation of the application ¤{application}.
 The binaries are stored in BINARIES directory.
 
-Warning : This binary installation depends upon some native packages. 
+Warning : This binary installation depends upon some native linux packages. 
 If some of these packages are missing on your system, the execution may fail. 
-If this is the case, please check if the file *_dep_sys_rpms.txt is present (it contains the known dependencies), 
-and install the missing ones.
+If this is the case, please install the missing ones with your linux package manager.
 
 
index 966b6150d1db96e0b8eb06966f789c65ddf83b16..984c4cd6fa618b49fd454a23f9bd9dcd599195d9 100644 (file)
@@ -2,3 +2,11 @@
 To run the application, launch the following command:
 > $ROOT/¤{launcher}
 
+Note for the use of Salome on a remote computer through ssh: 
+    When salome is used on a remote machine, the use of openGL 3 is not compatible with X11 forwarding (ssh -X).
+    This cause segmentation faults when the 3D viewers are used.
+    For people who have no other choice and need to use ssh, we provide a mesa laucher called $ROOT/mesa_¤{launcher}. 
+    It will avoid the segmentation faults, at the price of poor performance : it should only be used in this case!
+    If performance is required, a solution based on the use of VirtualGL and TurboVNC/x2go would be recommended.
+    But this requires some configuration of the tools to be done as root.
+