Skip to content

Experiments in optimisation using vectorisation and parallelisation across CPU and GPU threads to solve problems such as matrix-matrix multiplication, matrix-vector multiplication, and two dimensional convolution [Assignments from Software Programming for Performance - IIIT-Hyderabad, Spring '23]

License

Notifications You must be signed in to change notification settings

Varun0157/software-programming-for-performance

Repository files navigation

Software Programming for Performance

Experiments in optimisation using vectorisation and parallelisation across CPU and GPU threads to solve problems such as matrix - matrix multiplication, matrix-vector multiplication, and two dimensional convolution.

These programs formed a subset of assignments of the course - Software Programming for Performance (IIIT Hyderabad - Spring '23).

Note

the reason for the obscene number of commits is because we were benchmarking our code on a server that pulled from a repo. Each commit was an experiment beyond the initial implementation.

Local System Details

Some of these programs were initially written to run on a server with a different architecture, but they have been refactored to work with my local system, with the following characteristics:

OS: Ubuntu 22.04 LTS

lscpu

Architecture:             x86_64
  CPU op-mode(s):         32-bit, 64-bit
  Address sizes:          39 bits physical, 48 bits virtual
  Byte Order:             Little Endian
CPU(s):                   16
  On-line CPU(s) list:    0-15
Vendor ID:                GenuineIntel
  Model name:             12th Gen Intel(R) Core(TM) i7-1260P
    CPU family:           6
    Model:                154
    Thread(s) per core:   2
    Core(s) per socket:   12
    Socket(s):            1
    Stepping:             3
    CPU max MHz:          4700.0000
    CPU min MHz:          400.0000
    BogoMIPS:             4992.00
    Flags:                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xt
                          opology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave av
                          x f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clfl
                          ushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg g
                          fni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
Virtualization features:
  Virtualization:         VT-x
Caches (sum of all):
  L1d:                    448 KiB (12 instances)
  L1i:                    640 KiB (12 instances)
L2:                     9 MiB (6 instances)
  L3:                     18 MiB (1 instance)
NUMA:
  NUMA node(s):           1
  NUMA node0 CPU(s):      0-15
Vulnerabilities:
  Gather data sampling:   Not affected
  Itlb multihit:          Not affected
  L1tf:                   Not affected
  Mds:                    Not affected
  Meltdown:               Not affected
  Mmio stale data:        Not affected
  Reg file data sampling: Mitigation; Clear Register File
  Retbleed:               Not affected
  Spec rstack overflow:   Not affected
  Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
  Srbds:                  Not affected
  Tsx async abort:        Not affected

NVIDIA-SMI

Mon Jan  6 18:28:25 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 565.57.01              Driver Version: 565.57.01      CUDA Version: 12.7     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce MX550           On  |   00000000:02:00.0 Off |                  N/A |
| N/A   50C    P8              3W /   30W |       5MiB /   2048MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      2121      G   /usr/lib/xorg/Xorg                              4MiB |
+-----------------------------------------------------------------------------------------+

TODO

  • create explanations of the vectorised algorithms in 2D conv, matrix-matrix and matrix-vector multiplication

About

Experiments in optimisation using vectorisation and parallelisation across CPU and GPU threads to solve problems such as matrix-matrix multiplication, matrix-vector multiplication, and two dimensional convolution [Assignments from Software Programming for Performance - IIIT-Hyderabad, Spring '23]

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published