




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This document from docsity.com covers various examples of array operations in high performance computing, including merging arrays, daxpy, and 2-d matrix sum. The lectures also discuss cache memory and hits and misses in array access. Examples of c and fortran storage orders for multi-dimensional arrays.
Typology: Slides
1 / 8
This page cannot be seen from the preview
Don't miss anything!





2
struct {double A, B;} array[2048]; for (i=0; i<2048, i++) sum += array[i]. Aarray[i].* B;
4
double A[1024][1024], B[1024][1024]; for (j=0;j<1024;j++) for (i=0;i<1024;i++) B[i][j] = A[i][j] + B[i][j];
load A[0,0] load B[0,0] store B[0,0] load A[1,0] load B[1,0] store B[1,0] …
5
Example: for a 2-dimensional array, the elements of the first row of the array are followed by those of the 2 nd row of the array, the 3 rd row, and so on This is what is used in C
A 2-dimensional array is stored column by column in memory Used in FORTRAN
7
double A[1024][1024], B[1024][1024]; for (j=0; j<1024; j++) for (i=0; i<1024; i++) B[i][j] = A[i][j] + B[i][j];
8
double A[1024][1024], B[1024][1024]; for (i=0; i<1024; i++) for (j=0; j<1024; j++) B[i][j] = A[i][j] + B[i][j];
load A[0,0] load B[0,0] store B[0,0] load A[0,1] load B[0,1] store B[0,1] …