execute.sh.in 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
  19. pypath=@STARPU_BUILD_DIR@/starpupy/src/build:$PYTHONPATH
  20. LOADER=@PYTHON@
  21. if test -z "$MPI_LAUNCHER"
  22. then
  23. MPI_LAUNCHER="mpiexec -np 2"
  24. fi
  25. mpi=""
  26. gdb=""
  27. read_arg()
  28. {
  29. do_shift=0
  30. if test "$1" == "--valgrind"
  31. then
  32. export PYTHONMALLOC=malloc
  33. LOADER="valgrind --track-origins=yes @PYTHON@"
  34. do_shift=1
  35. elif test "$1" == "--gdb"
  36. then
  37. gdb="gdb"
  38. if test "$mpi" == "mpi"
  39. then
  40. LOADER="$MPI_LAUNCHER xterm -sl 10000 -hold -e gdb --args @PYTHON@"
  41. else
  42. LOADER="gdb --args @PYTHON@"
  43. fi
  44. do_shift=1
  45. elif test "$1" == "--mpirun"
  46. then
  47. mpi="mpi"
  48. if test "$gdb" == "gdb"
  49. then
  50. LOADER="$MPI_LAUNCHER xterm -sl 10000 -hold -e gdb --args @PYTHON@"
  51. else
  52. LOADER="$MPI_LAUNCHER @PYTHON@"
  53. fi
  54. do_shift=1
  55. fi
  56. }
  57. for x in $*
  58. do
  59. read_arg $x
  60. if test $do_shift == 1
  61. then
  62. shift
  63. fi
  64. done
  65. for x in $LOADER_ARGS
  66. do
  67. read_arg $x
  68. done
  69. examplefile=$1
  70. if test -f $examplefile
  71. then
  72. pythonscript=$examplefile
  73. elif test -f $exampledir/$examplefile
  74. then
  75. pythonscript=$exampledir/$examplefile
  76. else
  77. echo "Error. Python script $examplefile not found in current directory or in $exampledir"
  78. exit 1
  79. fi
  80. shift
  81. set -x
  82. PYTHONPATH=$pypath LD_LIBRARY_PATH=$modpath exec $LOADER $pythonscript $*