From: Nabil Ghodbane Date: Wed, 23 Mar 2022 14:15:14 +0000 (+0100) Subject: temporary fix to retrieve environment variable for ptscotch/scotch until bug fix... X-Git-Tag: V9_9_0~129 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=076c632e073ebe33c7fbfb767750d3e1431a3362;p=tools%2Fsat_salome.git temporary fix to retrieve environment variable for ptscotch/scotch until bug fix in SAT --- diff --git a/products/env_scripts/ptscotch.py b/products/env_scripts/ptscotch.py new file mode 100644 index 0000000..506ab20 --- /dev/null +++ b/products/env_scripts/ptscotch.py @@ -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) diff --git a/products/env_scripts/scotch.py b/products/env_scripts/scotch.py index 5c0a1d9..636dd96 100755 --- a/products/env_scripts/scotch.py +++ b/products/env_scripts/scotch.py @@ -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) diff --git a/products/scotch.pyconf b/products/scotch.pyconf index 3cca898..87e429f 100644 --- a/products/scotch.pyconf +++ b/products/scotch.pyconf @@ -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']