mic-configure 2.1 KB

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