Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
[]$ which python
/usr/bin/python

...

Context: Run a Python Script on the System

Copy files:

Code Block
[]$ cd 
[~]$ cp -r /project/arccanetrain/intro_to_hpc/ .
[~]$ cd intro_to_hpc/
[intro_to_hpc]$ ls
Intro_to_hpc.pdf  python01.py  python01.py.fixed  run_gpu.sh  run.sh

...

Let's run a python script:

Code Block
# If you have NOT already copied the files.
# Navigate back to your home folder.
[]$ cd
[~]$ mkdir intro_to_hpc
[~]$ cd intro_to_hpc/
[intro_to_hpc]$ ls
[intro_to_hpc]$ pwd
/home/<username>/intro_to_hpc
[intro_to_hpc]$ vim python01.py
"python01.py" [New File] 
# Using vim: Press ESC followed by ‘i’ to INSERT: Start typing:
import sys
print("Python version: " + sys.version)
print("Version info: " + sys.version_info)
# Using vim: ESC followed by ‘:wq’, then Return

...

Let's run a python script: Fixed:

Code Block
[]$ python python01.py
Python version: 3.8.16 (default, May 31 2023, 12:44:21)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-18)]
Traceback (most recent call last):
  File "python01.py", line 3, in <module>
    print("Version info: " + sys.version_info)
TypeError: can only concatenate str (not "sys.version_info") to str
# Let's update the code:
From: print("Version info: " + sys.version_info)
To:   print("Version info: " + str(sys.version_info))
[]$ python python01.py
Python version: 3.8.17 (default, Aug 10 2023, 12:50:17)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-20)]
Version info: sys.version_info(major=3, minor=8, micro=17, releaselevel='final', serial=0)
[]$ python --version
Python 3.8.17

...

You can’t break the System

Code Block
[]$ ls /usr/bin

[]$ cd /usr/bin
[bin]$ ls
[]$ pwd
/usr/bin

# Permissions (ugo:rwx) and Ownership (user:group)
[bin]$ ls -al
[bin]$ ls -al python*

You can't break the system.
[bin]$ rm python
rm: cannot remove 'python': Permission denied

Warning

sudo: you will not be granted sudo access – do not ask!

...

What’s available?

Code Block
[bin]$ cd ~
[~]$ cd intro_to_hpc/

[]$ ml
[]$ module avail

[]$ module load gcc/12.2.0
[]$ ml
[]$ module avail

# What is different compared to the first time we called ml?


[]$ module load gcc/11.2.0
# What happened?

...