Skip to content

Commit

Permalink
LLM: check user env (#10580)
Browse files Browse the repository at this point in the history
* LLM: check user env

* small fix

* small fix

* small fix
  • Loading branch information
WeiguangHan authored Mar 29, 2024
1 parent c4b533f commit 9a83f21
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 40 deletions.
78 changes: 42 additions & 36 deletions python/llm/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The **Env-Check** scripts ([env-check.sh](./env-chec.sh), [env-check.bat](./env
```
sudo apt install xpu-smi
```
* On Windows, you can ignore the sections in `xpu-smi.exe` if you didn't install it. You can always use **Windows Task Manager** to monitor the status of GPUs on Windows.
* On Windows, you can ignore the sections in `xpu-smi.exe` if you didn't install it. You can always use **Windows Task Manager** to monitor the status of GPUs on Windows.

### Usage

Expand All @@ -34,17 +34,17 @@ sudo apt install xpu-smi

### Sample outputs

* An example output on a Linux Desktop equipped with i9 13-Gen Intel Core CPU and Intel(R) Arc(TM) A770 GPU looks like below.
* An example output on a Linux Desktop equipped with i9 13900K Intel Core CPU and Intel(R) Arc(TM) A770 GPU looks like below.

```
-----------------------------------------------------------------
PYTHON_VERSION=3.9.18
PYTHON_VERSION=3.9.19
-----------------------------------------------------------------
transformers=4.37.0
transformers=4.31.0
-----------------------------------------------------------------
torch=2.1.0a0+cxx11.abi
-----------------------------------------------------------------
IPEX Version: 2.5.0b20240219
ipex-llm Version: 2.1.0b20240327
-----------------------------------------------------------------
ipex=2.1.10+xpu
-----------------------------------------------------------------
Expand All @@ -57,43 +57,49 @@ CPU(s): 32
On-line CPU(s) list: 0-31
Vendor ID: GenuineIntel
Model name: 13th Gen Intel(R) Core(TM) i9-13900K
CPU family: 6
Model: 183
Thread(s) per core: 2
Core(s) per socket: 24
Socket(s): 1
Stepping: 1
CPU max MHz: 5800.0000
CPU min MHz: 800.0000
BogoMIPS: 5990.40
-----------------------------------------------------------------
MemTotal: 65585208 kB
-----------------------------------------------------------------
ulimit:
real-time non-blocking time (microseconds, -R) unlimited
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 255907
max locked memory (kbytes, -l) 8198148
max memory size (kbytes, -m) unlimited
open files (-n) 1048576
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 255907
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Total Memory: 62.5479 GB
-----------------------------------------------------------------
Operating System:
Ubuntu 22.04.3 LTS \n \l

-----------------------------------------------------------------
Environment Variable:
SHELL=/usr/bin/zsh
LSCOLORS=Gxfxcxdxbxegedabagacad
TBBROOT=/opt/intel/oneapi/tbb/2021.11/env/..
USER_ZDOTDIR=/home/user
COLORTERM=truecolor
LESS=-R
TERM_PROGRAM_VERSION=1.86.2
ONEAPI_ROOT=/opt/intel/oneapi
CONDA_EXE=/home/user/anaconda3/bin/conda
_CE_M=
03:00.0 VGA compatible controller: Intel Corporation Device 56a0 (rev 08) (prog-if 00 [VGA controller])
Subsystem: Device 1ef7:1307
Flags: bus master, fast devsel, latency 0, IRQ 201
Memory at 84000000 (64-bit, non-prefetchable) [size=16M]
Memory at 4000000000 (64-bit, prefetchable) [size=16G]
Expansion ROM at 85000000 [disabled] [size=2M]
Capabilities: <access denied>
Kernel driver in use: i915
Kernel modules: i915
-----------------------------------------------------------------
Linux arda-arc11 5.19.0-41-generic #42~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 18 17:40:00 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
-----------------------------------------------------------------
CLI:
Version: 1.2.13.20230704
Build ID: 00000000

Service:
Version: 1.2.13.20230704
Build ID: 00000000
Level Zero Version: 1.14.0
-----------------------------------------------------------------
Driver Version 2023.16.11.0.22_160000
Driver Version 2023.16.11.0.22_160000
Driver UUID 32332e31-372e-3236-3234-312e33330000
Driver Version 23.17.26241.33
-----------------------------------------------------------------
igpu not detected
-----------------------------------------------------------------
xpu-smi is properly installed.
-----------------------------------------------------------------
Expand Down
56 changes: 52 additions & 4 deletions python/llm/scripts/env-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,20 @@ check_cpu_info()
echo "-----------------------------------------------------------------"
echo "CPU Information: "
lscpu | head -n 17

}

check_memory_type()
{
echo "-----------------------------------------------------------------"
echo "CPU type: "
sudo dmidecode -t 17 | grep DDR

}

check_mem_info()
{
echo "-----------------------------------------------------------------"
cat /proc/meminfo | grep MemTotal
cat /proc/meminfo | grep "MemTotal" | awk '{print "Total Memory: " $2/1024/1024 " GB"}'

}

Expand Down Expand Up @@ -125,6 +132,41 @@ check_ipex()
fi
}

check_xpu_info()
{
echo "-----------------------------------------------------------------"
lspci -v | grep -i vga -A 8
}

check_linux_kernel_version()
{
echo "-----------------------------------------------------------------"
uname -a
}

check_xpu_driver()
{
echo "-----------------------------------------------------------------"
xpu-smi -v
}

check_OpenCL_driver()
{
echo "-----------------------------------------------------------------"
clinfo | fgrep Driver
}

check_igpu()
{
echo "-----------------------------------------------------------------"
if sycl-ls | grep -q "Intel(R) UHD Graphics\|Intel(R) Arc(TM) Graphics"; then
echo "igpu detected"
sycl-ls | grep -E "Intel\(R\) UHD Graphics|Intel\(R\) Arc\(TM\) Graphics"
else
echo "igpu not detected"
fi
}

main()
{
# first guarantee correct python is installed.
Expand All @@ -144,9 +186,15 @@ main()
# verify hardware (how many gpu availables, gpu status, cpu info, memory info, etc.)
check_cpu_info
check_mem_info
check_ulimit
# check_memory_type
# check_ulimit
check_os
check_env
# check_env
check_xpu_info
check_linux_kernel_version
check_xpu_driver
check_OpenCL_driver
check_igpu

# check if xpu-smi and GPU is available.
check_xpu_smi_install
Expand Down

0 comments on commit 9a83f21

Please sign in to comment.