mic-configure 1.9 KB

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