Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom path for saving platform details #418

Merged
merged 26 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
35117a7
Added custom dir input var
anandhu-eng Oct 25, 2024
d9df89e
save system_info.txt to specific folder
anandhu-eng Oct 25, 2024
2ba7bec
Handle automatic creation of directory if not present
anandhu-eng Oct 25, 2024
4306e65
input mapping name change
anandhu-eng Oct 25, 2024
71655a9
added input mapping for file name
anandhu-eng Oct 25, 2024
71a57ed
Updated file path
anandhu-eng Oct 25, 2024
c81e331
handle commands requiring sudo
anandhu-eng Oct 25, 2024
0738add
changes for platform details
anandhu-eng Oct 25, 2024
32d9239
add echo for debug - WIP
anandhu-eng Oct 25, 2024
4b914c3
typo + test commit to fix gh action error
anandhu-eng Oct 26, 2024
5fb3ea3
test commit for gh error - WIP
anandhu-eng Oct 26, 2024
d5ac90c
bug fix - WIP
anandhu-eng Oct 26, 2024
24d0dda
test commit for gh error - WIP
anandhu-eng Oct 26, 2024
7ed8fe8
Update regex condition for new env keys
anandhu-eng Oct 26, 2024
46762d9
Skip get-platform details for non linux systems
anandhu-eng Oct 26, 2024
b15bc8a
fix typo
anandhu-eng Oct 26, 2024
5d62c16
skip dependency installation on non supported system
anandhu-eng Oct 26, 2024
23c7ea7
code clean
anandhu-eng Oct 26, 2024
31723a8
corrected typo
anandhu-eng Oct 28, 2024
1e7d587
WIP - handle workload of different OS through different scripts
anandhu-eng Oct 28, 2024
db93c53
updated warning message
anandhu-eng Oct 28, 2024
984c30b
Create run-macos.sh
anandhu-eng Oct 28, 2024
2f0191e
enable numactl and linux-tools for linux system only
anandhu-eng Oct 28, 2024
c9dbd40
Code clean
anandhu-eng Oct 28, 2024
1c0eafd
Merge branch 'mlperf-inference' into anandhu-eng-patch-3
anandhu-eng Oct 28, 2024
1b3793c
Update customize.py
arjunsuresh Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions script/app-mlperf-inference/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion script/detect-sudo/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cache: false
category: DevOps automation

new_env_keys:
- CM_SUDO_*
- CM_SUDO*

tags:
- detect
Expand Down
2 changes: 2 additions & 0 deletions script/detect-sudo/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
33 changes: 33 additions & 0 deletions script/get-platform-details/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
],
Expand All @@ -23,6 +50,9 @@
"enable_if_env": {
"CM_INSTALL_NUMACTL": [
"True"
],
"CM_HOST_OS_TYPE": [
"linux"
]
},
"tags": "get,sys-util,generic,_numactl"
Expand All @@ -31,6 +61,9 @@
"enable_if_env": {
"CM_INSTALL_CPUPOWER": [
"True"
],
"CM_HOST_OS_TYPE": [
"linux"
]
},
"tags": "get,sys-util,generic,_linux-tools"
Expand Down
11 changes: 6 additions & 5 deletions script/get-platform-details/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
1 change: 1 addition & 0 deletions script/get-platform-details/run-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "WARNING: get-platform-details script is fully supported on linux systems only."
2 changes: 1 addition & 1 deletion script/get-platform-details/run.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
echo "This CM script not supported for windows yet"
echo "WARNING: get-platform-details script is fully supported on linux systems only."
224 changes: 119 additions & 105 deletions script/get-platform-details/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading