In order to successfully complete this assignment you need to participate both individually and in groups during class. If you attend class in-person then have one of the instructors check your notebook and sign you out before leaving class on Friday March 5. If you are attending asynchronously, turn in your assignment using D2L no later than _11:59pm on Friday March 5.
Image from: https://en.wikipedia.org/wiki/Phalanx
Magma is a large, well-supported software package designed for computations in algebra, number theory, algebraic geometry and algebraic combinatorics. It provides a mathematically rigorous environment for defining and working with structures such as groups, rings, fields, modules, algebras, schemes, curves, graphs, designs, codes and many others. Magma also supports a number of databases designed to aid computational research in those areas of mathematics which are algebraic in nature.
✅ QUESTION: Download a magma example using getexample:
✅ QUESTION: Fix the example to run on a CUDA node properly
✅ QUESTION: Benchmark the example and compare running time in a job betwee k20 and k80 and v100.
Individually and as a class lets see if we can run the 1D wave example on the GPU and measure the performace
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char ** argv) {
int nx = 500;
int nt = 100000;
int i,it;
double x[nx];
double y[nx];
double v[nx];
double dvdt[nx];
double dt;
double dx;
double max,min;
double dx2inv;
double tmax;
int nxm1;
max=10.0;
min=0.0;
dx = (max-min)/(double)(nx);
x[0] = min;
for(i=1;i<nx-1;i++) {
x[i] = min+(double)i*dx;
}
x[nx-1] = max;
tmax=10.0;
dt= (tmax-0.0)/(double)(nt);
for (i=0;i<nx;i++) {
y[i] = exp(-(x[i]-5.0)*(x[i]-5.0));
v[i] = 0.0;
dvdt[i] = 0.0;
}
dx2inv=1.0/(dx*dx);
nxm1=nx-1;
for(it=0;it<nt-1;it++) {
for(i=1;i<nxm1;i++)
dvdt[i]=(y[i+1]+y[i-1]-2.0*y[i])*(dx2inv);
for(i=1; i<nxm1; i++) {
v[i] = v[i] + dt*dvdt[i];
y[i] = y[i] + dt*v[i];
}
}
for(i=nx/2-10; i<nx/2+10; i++) {
printf("%g %g\n",x[i],y[i]);
}
return 0;
}
If you attend class in-person then have one of the instructors check your notebook and sign you out before leaving class. If you are attending asynchronously, turn in your assignment using D2L.
Written by Dr. Dirk Colbry, Michigan State University
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.