]> SALOME platform Git repositories - tools/sat_salome.git/commitdiff
Salome HOME
temporary fix to retrieve environment variable for ptscotch/scotch until bug fix...
authorNabil Ghodbane <nabil.ghodbane@cea.fr>
Wed, 23 Mar 2022 14:15:14 +0000 (15:15 +0100)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Wed, 23 Mar 2022 14:15:14 +0000 (15:15 +0100)
products/env_scripts/ptscotch.py [new file with mode: 0644]
products/env_scripts/scotch.py
products/scotch.pyconf

diff --git a/products/env_scripts/ptscotch.py b/products/env_scripts/ptscotch.py
new file mode 100644 (file)
index 0000000..506ab20
--- /dev/null
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+import os.path
+def set_env(env, prereq_dir, version):
+  SCOTCH_HPC=True
+  #SCOTCH_HPC=env.get('SCOTCH_HPC') == '1'
+  if SCOTCH_HPC: 
+    env.set('SCOTCH_ROOT_DIR', prereq_dir)
+    env.set('PTSCOTCH_ROOT_DIR', prereq_dir)
+    env.set('PTSCOTCHDIR', prereq_dir)
+    env.set('SCOTCHDIR', prereq_dir)
+    env.set('PTSCOTCH_INCLUDE_DIR',os.path.join(prereq_dir,'include'))
+  else:
+    env.set('SCOTCHDIR', prereq_dir)
+    env.set('SCOTCH_ROOT_DIR', prereq_dir)
+
+def set_nativ_env(env):
+  SCOTCH_HPC=True
+
+  #SCOTCH_HPC=env.get('SCOTCH_HPC') == '1'
+  if SCOTCH_HPC:
+    prereq_dir='/usr'
+    prereq_inc='/usr/include'
+    prereq_lib= None
+    try:
+      import distro
+      if any(distribution in distro.name().lower() for distribution in ["centos", "fedora"]) :
+        prereq_dir='/usr'
+        prereq_inc= '/usr/include/openmpi-x86_64'
+        prereq_lib='/usr/lib64/openmpi/lib'
+      elif any(distribution in distro.name().lower() for distribution in ["debian", "ubuntu"]) :
+        prereq_dir='/usr'
+        prereq_inc='/usr/include/scotch-long'
+        prereq_lib='/usr/lib/x86_64-linux-gnu/scotch-long'
+      else:
+        print("Unimplemented distribution (1): {}".format(distro.name.lower()))
+    except:
+        import platform
+        if any(distribution in platform.linux_distribution()[0].lower() for distribution in ["centos", "fedora"]) :
+            prereq_dir='/usr'
+            prereq_inc= '/usr/include/openmpi-x86_64'
+            prereq_lib='/usr/lib64/openmpi/lib'
+        else:
+          print("Unimplemented distribution (2): {}".format(platform.linux_distribution()[0].lower()))
+
+    env.set('SCOTCH_ROOT_DIR', prereq_dir)
+    env.set('PTSCOTCH_ROOT_DIR', prereq_dir)
+    env.set('PTSCOTCHDIR', prereq_dir)
+    env.set('PTSCOTCH_INCLUDE_DIR', prereq_inc)
+    if prereq_lib is not None:
+        env.prepend('LD_LIBRARY_PATH', prereq_lib)
+  else:
+    prereq_dir='/usr'
+    env.set('SCOTCH_ROOT_DIR', prereq_dir)
index 5c0a1d921f841a3a2fa45ddf70be9d6f861d9877..636dd963a2e48e541156090110b734c204292718 100755 (executable)
@@ -3,7 +3,9 @@
 
 import os.path
 def set_env(env, prereq_dir, version):
-  if env.get('SCOTCH_HPC') == '1':
+  SCOTCH_HPC=False
+  #SCOTCH_HPC=env.get('SCOTCH_HPC') == '1'
+  if SCOTCH_HPC: 
     env.set('SCOTCH_ROOT_DIR', prereq_dir)
     env.set('PTSCOTCH_ROOT_DIR', prereq_dir)
     env.set('PTSCOTCHDIR', prereq_dir)
@@ -14,10 +16,10 @@ def set_env(env, prereq_dir, version):
     env.set('SCOTCH_ROOT_DIR', prereq_dir)
 
 def set_nativ_env(env):
-  if env.get('SCOTCH_HPC') != '1':
-    prereq_dir='/usr'
-    env.set('SCOTCH_ROOT_DIR', prereq_dir)
-  else:
+  SCOTCH_HPC=False
+
+  #SCOTCH_HPC=env.get('SCOTCH_HPC') == '1'
+  if SCOTCH_HPC:
     prereq_dir='/usr'
     prereq_inc='/usr/include'
     prereq_lib= None
@@ -48,3 +50,6 @@ def set_nativ_env(env):
     env.set('PTSCOTCH_INCLUDE_DIR', prereq_inc)
     if prereq_lib is not None:
         env.prepend('LD_LIBRARY_PATH', prereq_lib)
+  else:
+    prereq_dir='/usr'
+    env.set('SCOTCH_ROOT_DIR', prereq_dir)
index 3cca898d8ba5e0421455f51c5d8a9bb2f4469980..87e429ff56f1920010c699c8dc1363492a6c9dd1 100644 (file)
@@ -58,7 +58,7 @@ version_6_0_4_MPI :
     }
     environ :
     {
-       env_script : "scotch.py"
+       env_script : "ptscotch.py"
     }
     compil_script: "scotch-6.0.4.sh"
     depend: ['openmpi']