Skip to content

Commit 98c0908

Browse files
authored
Add GTPin v3 download and unpack scripts
* Updated CMake macros and python scripts for download and unpack GTPin v3 * Scripts/macros for GTPin v2 renamed, added "_legacy" suffix
1 parent 9039790 commit 98c0908

File tree

11 files changed

+704
-115
lines changed

11 files changed

+704
-115
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ You may obtain a copy of the License at https://opensource.org/licenses/MIT
8585
## Prerequisites
8686
- [CMake](https://cmake.org/) (version 3.12 and above)
8787
- [Git](https://git-scm.com/) (version 1.8 and above)
88-
- [Python](https://www.python.org/) (version 2.7 and above)
88+
- [Python](https://www.python.org/) (version 3.6 and above)
8989
- On Linux one have to be a part of `video` (Ubuntu 18 and below) or `render` (Ubuntu 19 and above) user group to do any computations on Intel(R) Processor Graphics:
9090
```sh
9191
sudo usermod -a -G video <username>

build_utils/CMakeLists.txt

Lines changed: 222 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ macro(CheckForMetricsLibrary)
372372
NAMES igdml64
373373
PATHS ${SEARCH_LIB_PATH})
374374
endif()
375-
375+
376376
if(NOT ML_LIB_PATH)
377377
message(WARNING
378378
"Metrics Library for Metrics Discovery API (Metrics Library for MD API) is not found. "
@@ -402,7 +402,7 @@ macro(GetMDHeaders TARGET)
402402
endif()
403403
endmacro()
404404

405-
macro(FindGTPinLibrary TARGET)
405+
macro(FindGTPinLibrary_legacy TARGET)
406406
if(DEFINED GTPIN_PATH)
407407
find_library(GTPIN_LIB_PATH
408408
NAMES gtpin
@@ -432,7 +432,7 @@ macro(FindGTPinLibrary TARGET)
432432
${GTPIN_LIB_PATH}/GTPIN/libgtpin_core.so
433433
${GTPIN_LIB_PATH}/GTPIN/libiga_wrapper.so
434434
${GTPIN_LIB_PATH}/GTPIN/libstdc++.so.6
435-
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_libs.py" ${GTPIN_LIB_PATH} ${CMAKE_BINARY_DIR})
435+
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_libs_legacy.py" ${GTPIN_LIB_PATH} ${CMAKE_BINARY_DIR})
436436

437437
target_link_libraries(${TARGET}
438438
"${GTPIN_LIB_PATH}/GTPIN/libgtpin.so")
@@ -450,7 +450,7 @@ macro(FindGTPinLibrary TARGET)
450450
${GTPIN_LIB_PATH}/gtpin.dll
451451
${GTPIN_LIB_PATH}/gtpin_core.dll
452452
${GTPIN_LIB_PATH}/iga_wrapper.dll
453-
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_libs.py" ${GTPIN_LIB_PATH} ${CMAKE_BINARY_DIR})
453+
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_libs_legacy.py" ${GTPIN_LIB_PATH} ${CMAKE_BINARY_DIR})
454454

455455
target_link_libraries(${TARGET}
456456
"${GTPIN_LIB_PATH}/GTPIN/gtpin.lib")
@@ -462,7 +462,7 @@ macro(FindGTPinLibrary TARGET)
462462
endif()
463463
endmacro()
464464

465-
macro(GetGTPinHeaders TARGET)
465+
macro(GetGTPinHeaders_legacy TARGET)
466466
if(DEFINED GTPIN_PATH)
467467
message(STATUS "Graphics Technology Pin (GT Pin) include path: ${GTPIN_PATH}/Include")
468468
target_include_directories(${TARGET}
@@ -520,7 +520,7 @@ macro(GetGTPinHeaders TARGET)
520520
${GTPIN_INC_PATH}/GTPIN/api/igt_core.h
521521
${GTPIN_INC_PATH}/GTPIN/api/gt_gpu_defs.h
522522
${GTPIN_INC_PATH}/GTPIN/api/gt_basic_utils.h
523-
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_headers.py" ${GTPIN_INC_PATH} ${CMAKE_BINARY_DIR})
523+
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_headers_legacy.py" ${GTPIN_INC_PATH} ${CMAKE_BINARY_DIR})
524524

525525
target_include_directories(${TARGET}
526526
PUBLIC "${GTPIN_INC_PATH}/GTPIN"
@@ -530,6 +530,222 @@ macro(GetGTPinHeaders TARGET)
530530
endif()
531531
endmacro()
532532

533+
macro(GetGTPinLibrary TARGET)
534+
if(NOT DEFINED GTPIN_PATH)
535+
set(GTPIN_LIB_PATH "${CMAKE_BINARY_DIR}")
536+
RequirePythonInterp()
537+
if(UNIX)
538+
add_custom_target(gtpin_libs ALL
539+
DEPENDS ${GTPIN_LIB_PATH}/GTPIN/libgcc_s.so.1
540+
${GTPIN_LIB_PATH}/GTPIN/libged.so
541+
${GTPIN_LIB_PATH}/GTPIN/libgtpin_core.so
542+
${GTPIN_LIB_PATH}/GTPIN/libgtpin.so
543+
${GTPIN_LIB_PATH}/GTPIN/libiga_wrapper.so)
544+
add_custom_command(OUTPUT ${GTPIN_LIB_PATH}/GTPIN/libgcc_s.so.1
545+
${GTPIN_LIB_PATH}/GTPIN/libged.so
546+
${GTPIN_LIB_PATH}/GTPIN/libgtpin_core.so
547+
${GTPIN_LIB_PATH}/GTPIN/libgtpin.so
548+
${GTPIN_LIB_PATH}/GTPIN/libiga_wrapper.so
549+
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_libs.py" ${GTPIN_LIB_PATH} ${CMAKE_BINARY_DIR})
550+
target_link_libraries(${TARGET}
551+
"${GTPIN_LIB_PATH}/GTPIN/libgtpin.so")
552+
target_link_libraries(${TARGET}
553+
"${GTPIN_LIB_PATH}/GTPIN/libged.so")
554+
add_dependencies(${TARGET}
555+
gtpin_libs)
556+
elseif(WIN32)
557+
add_custom_target(gtpin_libs ALL
558+
DEPENDS ${GTPIN_LIB_PATH}/GTPIN/gtpin.lib
559+
${GTPIN_LIB_PATH}/ged.dll
560+
${GTPIN_LIB_PATH}/gtpin.dll
561+
${GTPIN_LIB_PATH}/gtpin_core.dll
562+
${GTPIN_LIB_PATH}/iga_wrapper.dll)
563+
add_custom_command(OUTPUT ${GTPIN_LIB_PATH}/GTPIN/gtpin.lib
564+
${GTPIN_LIB_PATH}/ged.dll
565+
${GTPIN_LIB_PATH}/gtpin.dll
566+
${GTPIN_LIB_PATH}/gtpin_core.dll
567+
${GTPIN_LIB_PATH}/iga_wrapper.dll
568+
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_libs.py" ${GTPIN_LIB_PATH} ${CMAKE_BINARY_DIR})
569+
target_link_libraries(${TARGET}
570+
"${GTPIN_LIB_PATH}/GTPIN/gtpin.lib")
571+
add_dependencies(${TARGET}
572+
gtpin_libs)
573+
else()
574+
message(FATAL_ERROR "Graphics Technology Pin (GT Pin) path was not specified. Use -DGTPIN_PATH to set it")
575+
endif()
576+
endif()
577+
endmacro()
578+
579+
macro(FindGTPinLibrary TARGET)
580+
if(DEFINED GTPIN_PATH)
581+
find_library(GTPIN_LIB_PATH
582+
NAMES gtpin
583+
HINTS "${GTPIN_PATH}/Lib/intel64")
584+
find_library(GTPIN_GED_LIB_PATH
585+
NAMES ged
586+
HINTS "${GTPIN_PATH}/Lib/intel64")
587+
if(GTPIN_LIB_PATH AND GTPIN_GED_LIB_PATH)
588+
message(STATUS "Graphics Technology Pin (GT Pin) library path: ${GTPIN_LIB_PATH} & ${GTPIN_GED_LIB_PATH}")
589+
target_link_libraries(${TARGET}
590+
${GTPIN_LIB_PATH})
591+
target_link_libraries(${TARGET}
592+
${GTPIN_GED_LIB_PATH})
593+
else()
594+
message(FATAL_ERROR "Graphics Technology Pin (GT Pin) library was not found at ${GTPIN_PATH}/Lib/intel64")
595+
endif()
596+
else()
597+
message(STATUS "Graphics Technology Pin (GT Pin) path was not defined - it will be downloaded automatically on build")
598+
GetGTPinLibrary(${TARGET})
599+
endif()
600+
endmacro()
601+
602+
macro(GetGTPinHeaders TARGET)
603+
if(NOT DEFINED GTPIN_PATH)
604+
set(GTPIN_INC_PATH "${CMAKE_BINARY_DIR}")
605+
RequirePythonInterp()
606+
607+
add_custom_target(gtpin_headers ALL
608+
DEPENDS ${GTPIN_INC_PATH}/GTPIN/api/gt_basic_defs.h
609+
${GTPIN_INC_PATH}/GTPIN/api/gt_basic_utils.h
610+
${GTPIN_INC_PATH}/GTPIN/api/gt_gen_procedure.h
611+
${GTPIN_INC_PATH}/GTPIN/api/gt_gpu_defs.h
612+
${GTPIN_INC_PATH}/GTPIN/api/gt_hli_function.h
613+
${GTPIN_INC_PATH}/GTPIN/api/gt_ins_fields.h
614+
${GTPIN_INC_PATH}/GTPIN/api/gt_knob_defs.h
615+
${GTPIN_INC_PATH}/GTPIN/api/gt_knob.h
616+
${GTPIN_INC_PATH}/GTPIN/api/gtpin_api.h
617+
${GTPIN_INC_PATH}/GTPIN/api/gt_profile_array.h
618+
${GTPIN_INC_PATH}/GTPIN/api/gt_profile_trace.h
619+
${GTPIN_INC_PATH}/GTPIN/api/gt_reg.h
620+
${GTPIN_INC_PATH}/GTPIN/api/igt_cfg.h
621+
${GTPIN_INC_PATH}/GTPIN/api/igt_core.h
622+
${GTPIN_INC_PATH}/GTPIN/api/igt_event.h
623+
${GTPIN_INC_PATH}/GTPIN/api/igt_gen_arch.h
624+
${GTPIN_INC_PATH}/GTPIN/api/igt_gen_coder.h
625+
${GTPIN_INC_PATH}/GTPIN/api/igt_gen_procedure.h
626+
${GTPIN_INC_PATH}/GTPIN/api/igt_hli_library.h
627+
${GTPIN_INC_PATH}/GTPIN/api/igt_iarg_factory.h
628+
${GTPIN_INC_PATH}/GTPIN/api/igt_iarg.h
629+
${GTPIN_INC_PATH}/GTPIN/api/igt_ins_factory.h
630+
${GTPIN_INC_PATH}/GTPIN/api/igt_ins.h
631+
${GTPIN_INC_PATH}/GTPIN/api/igt_kernel.h
632+
${GTPIN_INC_PATH}/GTPIN/api/igt_knob_arg.h
633+
${GTPIN_INC_PATH}/GTPIN/api/igt_knob_registry.h
634+
${GTPIN_INC_PATH}/GTPIN/api/igt_memory_mapper.h
635+
${GTPIN_INC_PATH}/GTPIN/api/igt_profile_buffer.h
636+
${GTPIN_INC_PATH}/GTPIN/api/igt_reg_allocator.h
637+
${GTPIN_INC_PATH}/GTPIN/api/igt_tool.h
638+
${GTPIN_INC_PATH}/GTPIN/api/igt_vreg_factory.h
639+
${GTPIN_INC_PATH}/GTPIN/api/igt_vreg.h
640+
${GTPIN_INC_PATH}/GTPIN/api/gt_api_version.h
641+
${GTPIN_INC_PATH}/GTPIN/ged/ged_basic_types.h
642+
${GTPIN_INC_PATH}/GTPIN/ged/ged_enumerations.h
643+
${GTPIN_INC_PATH}/GTPIN/ged/ged_enum_types.h
644+
${GTPIN_INC_PATH}/GTPIN/ged/ged.h
645+
${GTPIN_INC_PATH}/GTPIN/ged/ged_ins_field.h)
646+
add_custom_command(OUTPUT ${GTPIN_INC_PATH}/GTPIN/api/gt_basic_defs.h
647+
${GTPIN_INC_PATH}/GTPIN/api/gt_basic_utils.h
648+
${GTPIN_INC_PATH}/GTPIN/api/gt_gen_procedure.h
649+
${GTPIN_INC_PATH}/GTPIN/api/gt_gpu_defs.h
650+
${GTPIN_INC_PATH}/GTPIN/api/gt_hli_function.h
651+
${GTPIN_INC_PATH}/GTPIN/api/gt_ins_fields.h
652+
${GTPIN_INC_PATH}/GTPIN/api/gt_knob_defs.h
653+
${GTPIN_INC_PATH}/GTPIN/api/gt_knob.h
654+
${GTPIN_INC_PATH}/GTPIN/api/gtpin_api.h
655+
${GTPIN_INC_PATH}/GTPIN/api/gt_profile_array.h
656+
${GTPIN_INC_PATH}/GTPIN/api/gt_profile_trace.h
657+
${GTPIN_INC_PATH}/GTPIN/api/gt_reg.h
658+
${GTPIN_INC_PATH}/GTPIN/api/igt_cfg.h
659+
${GTPIN_INC_PATH}/GTPIN/api/igt_core.h
660+
${GTPIN_INC_PATH}/GTPIN/api/igt_event.h
661+
${GTPIN_INC_PATH}/GTPIN/api/igt_gen_arch.h
662+
${GTPIN_INC_PATH}/GTPIN/api/igt_gen_coder.h
663+
${GTPIN_INC_PATH}/GTPIN/api/igt_gen_procedure.h
664+
${GTPIN_INC_PATH}/GTPIN/api/igt_hli_library.h
665+
${GTPIN_INC_PATH}/GTPIN/api/igt_iarg_factory.h
666+
${GTPIN_INC_PATH}/GTPIN/api/igt_iarg.h
667+
${GTPIN_INC_PATH}/GTPIN/api/igt_ins_factory.h
668+
${GTPIN_INC_PATH}/GTPIN/api/igt_ins.h
669+
${GTPIN_INC_PATH}/GTPIN/api/igt_kernel.h
670+
${GTPIN_INC_PATH}/GTPIN/api/igt_knob_arg.h
671+
${GTPIN_INC_PATH}/GTPIN/api/igt_knob_registry.h
672+
${GTPIN_INC_PATH}/GTPIN/api/igt_memory_mapper.h
673+
${GTPIN_INC_PATH}/GTPIN/api/igt_profile_buffer.h
674+
${GTPIN_INC_PATH}/GTPIN/api/igt_reg_allocator.h
675+
${GTPIN_INC_PATH}/GTPIN/api/igt_tool.h
676+
${GTPIN_INC_PATH}/GTPIN/api/igt_vreg_factory.h
677+
${GTPIN_INC_PATH}/GTPIN/api/igt_vreg.h
678+
${GTPIN_INC_PATH}/GTPIN/api/gt_api_version.h
679+
${GTPIN_INC_PATH}/GTPIN/ged/ged_basic_types.h
680+
${GTPIN_INC_PATH}/GTPIN/ged/ged_enumerations.h
681+
${GTPIN_INC_PATH}/GTPIN/ged/ged_enum_types.h
682+
${GTPIN_INC_PATH}/GTPIN/ged/ged.h
683+
${GTPIN_INC_PATH}/GTPIN/ged/ged_ins_field.h
684+
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_headers.py" ${GTPIN_INC_PATH} ${CMAKE_BINARY_DIR})
685+
target_include_directories(${TARGET}
686+
PUBLIC "${GTPIN_INC_PATH}/GTPIN"
687+
PUBLIC "${GTPIN_INC_PATH}/GTPIN/api"
688+
PUBLIC "${GTPIN_INC_PATH}/GTPIN/ged/intel64")
689+
add_dependencies(${TARGET}
690+
gtpin_headers)
691+
endif()
692+
endmacro()
693+
694+
macro(FindGTPinHeaders TARGET)
695+
if(CMAKE_INCLUDE_PATH)
696+
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH})
697+
endif()
698+
if(DEFINED GTPIN_PATH)
699+
message(STATUS "Graphics Technology Pin (GT Pin) include path: ${GTPIN_PATH}/Include, ${GTPIN_PATH}/Include/api, ${GTPIN_PATH}/Include/ged/intel64")
700+
target_include_directories(${TARGET}
701+
PUBLIC "${GTPIN_PATH}/Include"
702+
PUBLIC "${GTPIN_PATH}/Include/api"
703+
PUBLIC "${GTPIN_PATH}/Include/ged/intel64")
704+
else()
705+
message(STATUS "Graphics Technology Pin (GT Pin) path was not defined - it will be downloaded automatically on build")
706+
GetGTPinHeaders(${TARGET})
707+
endif()
708+
set(CMAKE_REQUIRED_INCLUDES)
709+
endmacro()
710+
711+
macro(GetGTPinUtil TARGET UTIL)
712+
if(NOT DEFINED GTPIN_PATH)
713+
set(GTPIN_UTIL_PATH "${CMAKE_BINARY_DIR}")
714+
RequirePythonInterp()
715+
add_custom_target(gtpin_${UTIL} ALL
716+
DEPENDS "${GTPIN_UTIL_PATH}/GTPIN/utils/${UTIL}.h"
717+
"${GTPIN_UTIL_PATH}/GTPIN/utils/${UTIL}.cpp")
718+
add_custom_command(OUTPUT "${GTPIN_UTIL_PATH}/GTPIN/utils/${UTIL}.h"
719+
"${GTPIN_UTIL_PATH}/GTPIN/utils/${UTIL}.cpp"
720+
COMMAND "${PYTHON_EXECUTABLE}" "${PTI_CMAKE_MACRO_DIR}/get_gtpin_util.py" ${GTPIN_UTIL_PATH} ${CMAKE_BINARY_DIR} ${UTIL})
721+
target_sources(${TARGET} PRIVATE
722+
"${GTPIN_UTIL_PATH}/Examples/utils/${UTIL}.cpp")
723+
target_include_directories(${TARGET}
724+
PUBLIC "${GTPIN_UTIL_PATH}/GTPIN/utils")
725+
add_dependencies(${TARGET}
726+
gtpin_${UTIL})
727+
endif()
728+
endmacro()
729+
730+
macro(FindGTPinUtil TARGET UTIL)
731+
if(DEFINED GTPIN_PATH)
732+
find_file(GTPIN_${UTIL}_PATH
733+
NAMES ${UTIL}.cpp
734+
PATHS "${GTPIN_PATH}/Examples/utils")
735+
if(GTPIN_${UTIL}_PATH)
736+
target_sources(${TARGET} PRIVATE
737+
${GTPIN_${UTIL}_PATH})
738+
target_include_directories(${TARGET}
739+
PUBLIC "${GTPIN_PATH}/Examples/utils")
740+
else()
741+
message(FATAL_ERROR "Graphics Technology Pin (GT Pin) ${UTIL} was not found at ${GTPIN_PATH}/Examples/utils")
742+
endif()
743+
else()
744+
message(STATUS "Graphics Technology Pin (GT Pin) path was not defined - it will be downloaded automatically on build")
745+
GetGTPinUtil(${TARGET} ${UTIL})
746+
endif()
747+
endmacro()
748+
533749
macro(GetLevelZeroHeaders TARGET)
534750
set(L0_INC_PATH "${CMAKE_BINARY_DIR}")
535751
RequirePythonInterp()

build_utils/get_gtpin.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import sys
2+
import os
3+
4+
import build_utils
5+
6+
def get_gtpin(build_path):
7+
platform = sys.platform
8+
if platform.startswith('win32'):
9+
gtpin_package = "external-release-gtpin-3.4-win.zip"
10+
download_link = "https://downloadmirror.intel.com/777295/"
11+
elif platform.startswith('linux'):
12+
gtpin_package = "external-release-gtpin-3.4-linux.tar.xz"
13+
download_link = "https://downloadmirror.intel.com/777295/"
14+
else:
15+
print("Platform not supported: ", platform)
16+
return -2
17+
18+
build_utils.download(download_link + gtpin_package, build_path)
19+
arch_file = os.path.join(build_path, gtpin_package)
20+
build_utils.unpack(arch_file, build_path)
21+
22+
return 0
23+
24+
def main(argv):
25+
if len(argv) < 2:
26+
print("Usage: python get_gtpin.py <build_path>")
27+
return -1
28+
return get_gtpin(argv[1])
29+
30+
if __name__ == "__main__":
31+
sys.exit(main(sys.argv))

0 commit comments

Comments
 (0)