Source Information¶


Author:

Last Updated Date: October 25, 2024 updated by Gloria Seo

Resources:


Goal¶

This notebook introduces how to print "Hello, World!" on a CPU. It also covers basic Python functions, printing host information, and checking CPU details.

In [1]:
import hello

Required Modules for the Jupyter Notebook¶

Before running the notebook, we need to load the following modules.

Module: hello

Print 'Hello, World!' using CPU¶

To display a message in Python, we use the print() function. For example, lets print out Hello world!!! using print() function.

In [2]:
print('Hello world!!!!')

Defining a Function in Python¶

Next, we use the def keyword to define a function. Here's an example of a function that takes a name as an argument and prints it:

In [3]:
# Define a local function
def world2(name):
    print(name)
In [4]:
# Call function
world2("mary") 
mary

Using a Module Function¶

You can also call functions from imported modules. For example:

In [5]:
hello.greeting("good times")
Greetings, good times
In [6]:
hello.world("World.")
Hello, World.

Print out host information¶

In [7]:
!hostname
exp-1-04

check the CPU information¶

In [8]:
!lscpu 
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              128
On-line CPU(s) list: 0-127
Thread(s) per core:  1
Core(s) per socket:  64
Socket(s):           2
NUMA node(s):        8
Vendor ID:           AuthenticAMD
CPU family:          23
Model:               49
Model name:          AMD EPYC 7742 64-Core Processor
Stepping:            0
CPU MHz:             2245.891
BogoMIPS:            4491.78
Virtualization:      AMD-V
L1d cache:           32K
L1i cache:           32K
L2 cache:            512K
L3 cache:            16384K
NUMA node0 CPU(s):   0-15
NUMA node1 CPU(s):   16-31
NUMA node2 CPU(s):   32-47
NUMA node3 CPU(s):   48-63
NUMA node4 CPU(s):   64-79
NUMA node5 CPU(s):   80-95
NUMA node6 CPU(s):   96-111
NUMA node7 CPU(s):   112-127
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr wbnoinvd amd_ppin arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sme sev sev_es

Submit Ticket¶

If you find anything that needs to be changed, edited, or if you would like to provide feedback or contribute to the notebook, please submit a ticket by contacting us at:

Email: consult@sdsc.edu

We appreciate your input and will review your suggestions promptly!

In [ ]:
 
In [ ]: