execute.sh.in 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!@REALBASH@
  2. # StarPU --- Runtime system for heterogeneous multicore architectures.
  3. #
  4. # Copyright (C) 2020-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  5. #
  6. # StarPU is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as published by
  8. # the Free Software Foundation; either version 2.1 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # StarPU is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. #
  17. exampledir=@STARPU_SRC_DIR@/starpupy/examples
  18. modpath=@STARPU_BUILD_DIR@/src/.libs:
  19. pypath=@STARPU_BUILD_DIR@/starpupy/src/build:$PYTHONPATH
  20. LOADER=@PYTHON@
  21. read_arg()
  22. {
  23. do_shift=0
  24. if test "$1" == "--valgrind"
  25. then
  26. export PYTHONMALLOC=malloc
  27. LOADER="valgrind --track-origins=yes @PYTHON@"
  28. do_shift=1
  29. elif test "$1" == "--gdb"
  30. then
  31. LOADER="gdb --args @PYTHON@"
  32. do_shift=1
  33. elif test "$1" == "--mpirun"
  34. then
  35. if test "$MPI_LAUNCHER"
  36. then
  37. LOADER="$MPI_LAUNCHER @PYTHON@"
  38. else
  39. LOADER="mpiexec -np 2 @PYTHON@"
  40. fi
  41. do_shift=1
  42. fi
  43. }
  44. for x in $*
  45. do
  46. read_arg $x
  47. if test $do_shift == 1
  48. then
  49. shift
  50. fi
  51. done
  52. for x in $LOADER_ARGS
  53. do
  54. read_arg $x
  55. done
  56. examplefile=$1
  57. if test -f $examplefile
  58. then
  59. pythonscript=$examplefile
  60. elif test -f $exampledir/$examplefile
  61. then
  62. pythonscript=$exampledir/$examplefile
  63. else
  64. echo "Error. Python script $examplefile not found in current directory or in $exampledir"
  65. exit 1
  66. fi
  67. shift
  68. set -x
  69. PYTHONPATH=$pypath LD_LIBRARY_PATH=$modpath $LOADER $pythonscript $*