diff --git a/script/app-mlperf-inference/_cm.yaml b/script/app-mlperf-inference/_cm.yaml index 45094cacbc..928709a8f4 100644 --- a/script/app-mlperf-inference/_cm.yaml +++ b/script/app-mlperf-inference/_cm.yaml @@ -27,6 +27,7 @@ default_env: CM_MLPERF_RUN_STYLE: test CM_TEST_QUERY_COUNT: '10' CM_MLPERF_QUANTIZATION: off + CM_GET_PLATFORM_DETAILS: yes env: CM_MLPERF_PRINT_SUMMARY: "no" @@ -114,8 +115,6 @@ posthook_deps: - tags: get,mlperf,sut,description #populate system meta information like framework - tags: get,platform,details enable_if_any_env: - CM_SUDO_USER: - - yes CM_GET_PLATFORM_DETAILS: - yes skip_if_env: diff --git a/script/detect-sudo/_cm.yaml b/script/detect-sudo/_cm.yaml index 56c83b8304..64b60a5f6c 100644 --- a/script/detect-sudo/_cm.yaml +++ b/script/detect-sudo/_cm.yaml @@ -9,7 +9,7 @@ cache: false category: DevOps automation new_env_keys: - - CM_SUDO_* + - CM_SUDO* tags: - detect diff --git a/script/detect-sudo/customize.py b/script/detect-sudo/customize.py index dbc9b89705..31c72ba9d6 100644 --- a/script/detect-sudo/customize.py +++ b/script/detect-sudo/customize.py @@ -20,6 +20,8 @@ def preprocess(i): env['CM_SUDO_USER'] = "yes" if os.geteuid() == 0: env['CM_SUDO'] = '' #root user does not need sudo + else: + env['CM_SUDO'] = 'sudo' else: if can_execute_sudo_without_password(): env['CM_SUDO_USER'] = "yes" diff --git a/script/get-platform-details/_cm.json b/script/get-platform-details/_cm.json index 3c6c5b4bd6..11c57baa18 100644 --- a/script/get-platform-details/_cm.json +++ b/script/get-platform-details/_cm.json @@ -4,17 +4,44 @@ "automation_uid": "5b4e0237da074764", "cache": false, "category": "Platform information", + "input_mapping": { + "out_dir_path": "CM_PLATFORM_DETAILS_DIR_PATH", + "out_file_name": "CM_PLATFORM_DETAILS_FILE_NAME" + }, "deps": [ { "tags": "detect,os" }, { + "skip_if_env": { + "CM_HOST_OS_TYPE": [ + "windows" + ] + }, + "tags": "detect,sudo" + }, + { + "skip_if_env": { + "CM_HOST_OS_TYPE": [ + "windows" + ] + }, "tags": "get,sys-util,generic,_psmisc" }, { + "enable_if_env": { + "CM_HOST_OS_TYPE": [ + "linux" + ] + }, "tags": "get,sys-util,generic,_systemd" }, { + "enable_if_env": { + "CM_HOST_OS_TYPE": [ + "linux" + ] + }, "tags": "get,sys-util,generic,_dmidecode" } ], @@ -23,6 +50,9 @@ "enable_if_env": { "CM_INSTALL_NUMACTL": [ "True" + ], + "CM_HOST_OS_TYPE": [ + "linux" ] }, "tags": "get,sys-util,generic,_numactl" @@ -31,6 +61,9 @@ "enable_if_env": { "CM_INSTALL_CPUPOWER": [ "True" + ], + "CM_HOST_OS_TYPE": [ + "linux" ] }, "tags": "get,sys-util,generic,_linux-tools" diff --git a/script/get-platform-details/customize.py b/script/get-platform-details/customize.py index 47f1bab8b8..9c26dae026 100644 --- a/script/get-platform-details/customize.py +++ b/script/get-platform-details/customize.py @@ -13,17 +13,18 @@ def preprocess(i): os_info = i['os_info'] env = i['env'] - if os_info['platform'] == "windows": - return {'return':1, 'error':'get-platform-details script not yet supported in windows!'} - if not check_installation("numactl",os_info): env['CM_INSTALL_NUMACTL'] = 'True' #if not check_installation("cpupower",os_info): env['CM_INSTALL_CPUPOWER'] = 'True' - + if env.get('CM_PLATFORM_DETAILS_FILE_PATH', '') == '': - env['CM_PLATFORM_DETAILS_FILE_PATH'] = os.path.join(os.getcwd(), "system_info.txt") + if env.get('CM_PLATFORM_DETAILS_DIR_PATH', '') == '': + env['CM_PLATFORM_DETAILS_DIR_PATH'] = os.getcwd() + if env.get('CM_PLATFORM_DETAILS_FILE_NAME', '') == '': + env['CM_PLATFORM_DETAILS_FILE_NAME'] = "system_info.txt" + env['CM_PLATFORM_DETAILS_FILE_PATH'] = os.path.join(env['CM_PLATFORM_DETAILS_DIR_PATH'], env['CM_PLATFORM_DETAILS_FILE_NAME']) return {'return':0} diff --git a/script/get-platform-details/run-macos.sh b/script/get-platform-details/run-macos.sh new file mode 100644 index 0000000000..fcde181c03 --- /dev/null +++ b/script/get-platform-details/run-macos.sh @@ -0,0 +1 @@ +echo "WARNING: get-platform-details script is fully supported on linux systems only." diff --git a/script/get-platform-details/run.bat b/script/get-platform-details/run.bat index 73412b64ab..fcde181c03 100644 --- a/script/get-platform-details/run.bat +++ b/script/get-platform-details/run.bat @@ -1 +1 @@ -echo "This CM script not supported for windows yet" +echo "WARNING: get-platform-details script is fully supported on linux systems only." diff --git a/script/get-platform-details/run.sh b/script/get-platform-details/run.sh index 481319f223..d3fc7e0d37 100644 --- a/script/get-platform-details/run.sh +++ b/script/get-platform-details/run.sh @@ -5,120 +5,134 @@ OUTPUT_FILE="$CM_PLATFORM_DETAILS_FILE_PATH" #echo $OUTPUT_FILE echo "WARNING: sudo permission is needed for some of the below commands" -if [[ ${CM_HOST_OS_FLAVOR} == "macos" ]]; then - echo "WARNING: To be done for the mac os" -else - echo "Platform Details" > $OUTPUT_FILE - echo "" >> $OUTPUT_FILE - echo "------------------------------------------------------------" >> $OUTPUT_FILE - echo "1. uname -a" >> $OUTPUT_FILE - eval "uname -a" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "2. w" >> $OUTPUT_FILE - eval "w" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "3. Username" >> $OUTPUT_FILE - echo "From environment variable \$USER: $USER" >> $OUTPUT_FILE - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "4. ulimit -a" >> $OUTPUT_FILE - eval "ulimit -a" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "5. sysinfo process ancestry" >> $OUTPUT_FILE - eval "pstree" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "6. /proc/cpuinfo" >> $OUTPUT_FILE - eval "cat /proc/cpuinfo" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "7. lscpu" >> $OUTPUT_FILE - eval "lscpu" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "8. numactl --hardware" >> $OUTPUT_FILE - eval "numactl --hardware" >> $OUTPUT_FILE - #test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "9. /proc/meminfo" >> $OUTPUT_FILE - eval "cat /proc/meminfo" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "10. who -r" >> $OUTPUT_FILE - eval "who -r" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "11. Systemd service manager version" >> $OUTPUT_FILE - eval "systemctl --version | head -n 1" >> $OUTPUT_FILE +echo "Platform Details" > $OUTPUT_FILE +echo "" >> $OUTPUT_FILE +echo "------------------------------------------------------------" >> $OUTPUT_FILE +echo "1. uname -a" >> $OUTPUT_FILE +eval "uname -a" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "2. w" >> $OUTPUT_FILE +eval "w" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "3. Username" >> $OUTPUT_FILE +echo "From environment variable \$USER: $USER" >> $OUTPUT_FILE +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "4. ulimit -a" >> $OUTPUT_FILE +eval "ulimit -a" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "5. sysinfo process ancestry" >> $OUTPUT_FILE +eval "pstree" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "6. /proc/cpuinfo" >> $OUTPUT_FILE +eval "cat /proc/cpuinfo" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "7. lscpu" >> $OUTPUT_FILE +eval "lscpu" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "8. numactl --hardware" >> $OUTPUT_FILE +if [[ ${CM_SUDO_USER} == "yes" ]]; then + echo "${CM_SUDO} numactl --hardware" + eval "${CM_SUDO} numactl --hardware" >> $OUTPUT_FILE test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "12. Services, from systemctl list-unit-files" >> $OUTPUT_FILE - eval "systemctl list-unit-files" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "13. Linux kernel boot-time arguments, from /proc/cmdline" >> $OUTPUT_FILE - eval "cat /proc/cmdline" >> $OUTPUT_FILE +else + echo "Requires SUDO permission" >> $OUTPUT_FILE +fi +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "9. /proc/meminfo" >> $OUTPUT_FILE +eval "cat /proc/meminfo" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "10. who -r" >> $OUTPUT_FILE +eval "who -r" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "11. Systemd service manager version" >> $OUTPUT_FILE +eval "systemctl --version | head -n 1" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "12. Services, from systemctl list-unit-files" >> $OUTPUT_FILE +eval "systemctl list-unit-files" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "13. Linux kernel boot-time arguments, from /proc/cmdline" >> $OUTPUT_FILE +eval "cat /proc/cmdline" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "14. cpupower frequency-info" >> $OUTPUT_FILE +eval "cpupower frequency-info" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "15. sysctl" >> $OUTPUT_FILE +if [[ ${CM_SUDO_USER} == "yes" ]]; then + echo "${CM_SUDO} sysctl -a" + eval "${CM_SUDO} sysctl -a" >> $OUTPUT_FILE test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE +else + echo "Requires SUDO permission" >> $OUTPUT_FILE +fi +echo "------------------------------------------------------------" >> $OUTPUT_FILE - echo "14. cpupower frequency-info" >> $OUTPUT_FILE - eval "cpupower frequency-info" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE +echo "16. /sys/kernel/mm/transparent_hugepage" >> $OUTPUT_FILE +eval "cat /sys/kernel/mm/transparent_hugepage/enabled" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE - echo "15. sysctl" >> $OUTPUT_FILE - eval "sudo sysctl -a" >> $OUTPUT_FILE - #test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE +echo "17. /sys/kernel/mm/transparent_hugepage/khugepaged" >> $OUTPUT_FILE +eval "cat /sys/kernel/mm/transparent_hugepage/khugepaged/defrag" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE - echo "16. /sys/kernel/mm/transparent_hugepage" >> $OUTPUT_FILE - eval "cat /sys/kernel/mm/transparent_hugepage/enabled" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE +echo "18. OS release" >> $OUTPUT_FILE +eval "cat /etc/os-release" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE - echo "17. /sys/kernel/mm/transparent_hugepage/khugepaged" >> $OUTPUT_FILE - eval "cat /sys/kernel/mm/transparent_hugepage/khugepaged/defrag" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE +echo "19. Disk information" >> $OUTPUT_FILE +eval "lsblk" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE - echo "18. OS release" >> $OUTPUT_FILE - eval "cat /etc/os-release" >> $OUTPUT_FILE - test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE +echo "20. /sys/devices/virtual/dmi/id" >> $OUTPUT_FILE +eval "ls /sys/devices/virtual/dmi/id" >> $OUTPUT_FILE +test $? -eq 0 || exit $? +echo "------------------------------------------------------------" >> $OUTPUT_FILE - echo "19. Disk information" >> $OUTPUT_FILE - eval "lsblk" >> $OUTPUT_FILE +echo "21. dmidecode" >> $OUTPUT_FILE +if [[ ${CM_SUDO_USER} == "yes" ]]; then + eval "${CM_SUDO} dmidecode" >> $OUTPUT_FILE test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE +else + echo "Requires SUDO permission" >> $OUTPUT_FILE +fi +echo "------------------------------------------------------------" >> $OUTPUT_FILE - echo "20. /sys/devices/virtual/dmi/id" >> $OUTPUT_FILE - eval "ls /sys/devices/virtual/dmi/id" >> $OUTPUT_FILE +echo "22. BIOS" >> $OUTPUT_FILE +if [[ ${CM_SUDO_USER} == "yes" ]]; then + eval "${CM_SUDO} dmidecode -t bios" >> $OUTPUT_FILE test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "21. dmidecode" >> $OUTPUT_FILE - eval "sudo dmidecode" >> $OUTPUT_FILE - #test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "22. BIOS" >> $OUTPUT_FILE - eval "sudo dmidecode -t bios" >> $OUTPUT_FILE - #test $? -eq 0 || exit $? - echo "------------------------------------------------------------" >> $OUTPUT_FILE - - echo "System information has been saved to $PWD/$OUTPUT_FILE" +else + echo "Requires SUDO permission" >> $OUTPUT_FILE fi +echo "------------------------------------------------------------" >> $OUTPUT_FILE + +echo "System information has been saved to $PWD/$OUTPUT_FILE"