SPO Lab 6 (Vectorization)

In this lab, we had to make a simple program that randomly generated numbers for two 1000 size array, and then get the total sum of those Arrays.

Test Code:

#include <stdio.h>
#include <time.h>
#include <stdlib.h>

#define size 1000
int main(){
int num[size], num2[size], num3[size]
long int arrSum = 0;
for(int i = 0; i < size; i++){
num[i] = rand();
num2[i] = rand();
num3[i] = num[i] + num2[i];
arrSum += num3[i];

printf(“Final Sum of the two arrays: %ld \n”, arrSum);
return 0;


Command lines to Compile code

: c99 -o Lab6.c


Final Sum of the two arrays: 59113227920


To obtain the disassembly code, I used the command objdump -d a.out


Screenshot from 2017-02-19 00-03-56.png

Reflection from the lab

I think overall this lab showed the importance of Vector and how it can increase provide better performance overall and why we could use vectorization in loops.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s