mic-configure 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/bash
  2. ROOT_DIR=$(dirname $0)
  3. cat > ./mic-config.log << EOF
  4. This file was created by StarPU mic-configure
  5. $ $0 $*
  6. EOF
  7. prefix="/usr/local"
  8. coi_dir="/opt/intel/mic/coi"
  9. mic_host="x86_64-k1om-linux"
  10. for arg in $*
  11. do
  12. case $arg in
  13. --prefix=*)
  14. prefix="${arg#--prefix=}"
  15. ;;
  16. --with-coi-dir=*)
  17. coi_dir="${arg#--with-coi-dir=}"
  18. ;;
  19. --mic-host=*)
  20. mic_host="${arg#--mic-host=}"
  21. ;;
  22. esac
  23. done
  24. if [ ! -x "${mic_host}-gcc" ]
  25. then
  26. echo "[error] please add path to ${mic_host}-gcc in your PATH"
  27. exit 1
  28. fi
  29. for arch in mic host
  30. do
  31. # We call the configure script from a build directory further in the
  32. # arborescence
  33. case $ROOT_DIR in
  34. /*) command="${ROOT_DIR}/configure";;
  35. *) command="../${ROOT_DIR}/configure";;
  36. esac
  37. params="--enable-mic --with-coi-dir=$coi_dir --prefix=$prefix/$arch"
  38. if test x$arch = xmic ; then
  39. # TODO: fix hwloc detection to look for another pkg-config place, and not just believe in the host version of hwloc.pc...
  40. params="$params --without-hwloc --with-coi-lib-dir=$coi_dir/device-linux-release/lib --host=$mic_host"
  41. else
  42. params="$params --with-coi-lib-dir=$coi_dir/host-linux-release/lib"
  43. fi
  44. # If the build directory doesn't exist yet, create it
  45. if [ ! -d "build_${arch}" ] ; then
  46. mkdir "build_${arch}"
  47. fi
  48. cd "build_${arch}"
  49. if test x$arch = xmic ; then
  50. LDFLAGS=-export-dynamic $command $* $params
  51. else
  52. $command $* $params
  53. fi
  54. if [ "$?" != 0 ]
  55. then
  56. exit $?
  57. fi
  58. cd ..
  59. done
  60. cat > Makefile << EOF
  61. all:
  62. \$(MAKE) -C build_host
  63. \$(MAKE) -C build_mic
  64. clean:
  65. \$(MAKE) -C build_host clean
  66. \$(MAKE) -C build_mic clean
  67. distclean: clean
  68. rm -f Makefile
  69. check:
  70. \$(MAKE) -C build_host check
  71. \$(MAKE) -C build_mic check
  72. install:
  73. \$(MAKE) -C build_host install
  74. \$(MAKE) -C build_mic install
  75. ln -sf "${prefix}/mic/lib/pkgconfig/starpu-1.2.pc" "${prefix}/mic/lib/pkgconfig/starpu-1.2-mic.pc"
  76. EOF