diff --git a/exercises/complex/README.md b/exercises/complex/README.md new file mode 100644 index 0000000..6aa5885 --- /dev/null +++ b/exercises/complex/README.md @@ -0,0 +1,15 @@ +In your clone of this repository, find the `complex` exercise and list the files + +``` +$ cd archer2-cpp/exercises/complex$ ls Makefile complex.cpp complex.hpp test.cpp +``` + +The files `complex.hpp` and `complex.cpp` contain a partially working complex number class and `test.cpp` holds some basic unit tests. + +You can compile and run with: + +``` +$ make && ./testc++ --std=c++14 -I../include -c -o complex.o complex.cppc++ --std=c++14 -I../include -c -o test.o test.cppc++ complex.o test.o -o test===============================================================================All tests passed (34 assertions in 6 test cases) +``` + +But to get to this point you need to complete the code and fix a few bugs! diff --git a/exercises/eigen/modules.sh b/exercises/eigen/modules.sh index a9262e9..dcc0da0 100644 --- a/exercises/eigen/modules.sh +++ b/exercises/eigen/modules.sh @@ -1,7 +1,5 @@ #!/bin/bash -module purge -module load spack -module load eigen-3.3.7-gcc-6.3.0-qka5wf6 -module load clang -module load gnuplot/5.0.5-x11 -module load intel-compilers-18 +module load PrgEnv-gnu +module load cray-python +module load eigen/3.4.0 + diff --git a/exercises/morton-order/instructions.md b/exercises/morton-order/instructions.md index 07014ca..05fbeec 100644 --- a/exercises/morton-order/instructions.md +++ b/exercises/morton-order/instructions.md @@ -1,11 +1,15 @@ + # Morton order matrices in C++ -## Rupert Nash -## r.nash@epcc.ed.ac.uk +## James Richings +## j.richings@epcc.ed.ac.uk + + +# Sample code Source for this can be obtained from Github. Get a new copy with: ``` -git clone https://github.com/EPCCed/archer2-CPP-2021-07-20 +git clone https://github.com/EPCCed/archer2-cpp ``` or update your existing one with @@ -17,15 +21,17 @@ git pull then you can ``` -cd archer2-CPP-2021-07-20/exercises/morton-order +cd archer2-cpp/exercises/morton-order ``` +# Morton ordering + The Morton ordering (or z-ordering) of a matrix lays out the elements along a recursive z-shaped curve, as shown in the figure of four iterations of the Z-order curve (from -[Wikipedia](https://en.wikipedia.org/wiki/Z-order_curve)). +[z ordered curve](https://en.wikipedia.org/wiki/Z-order_curve)). -![Morton order](mortonorder.png) +# Indices You can compute the Morton index `z` from the x- and y-indices (`i` and `j` respectively) by interleaving their bits. An example is shown @@ -33,10 +39,10 @@ in the table. | | 0 | 1 | 2 | 3 | |----|----|----|----|----| -| 0 | 0| 1| 4| 5| -| 1 | 2| 3| 6| 7| -| 2 | 8| 9| 12| 13| -| 3 | 10| 11| 14| 15| +| 0 | 0| 1| 4| 5 | +| 1 | 2| 3| 6| 7| +| 2 | 8| 9| 12| 13| +| 3 | 10| 11| 14| 15| Mapping between `x-y` indexes and Morton index for a 4 by 4 matrix. Decimal on the left and binary on the right. @@ -51,6 +57,8 @@ matrix. Decimal on the left and binary on the right. Mapping between `x-y` indexes and Morton index for a matrix of size 4-by-4. Decimal on the left and binary on the right. + + The advantage of laying out data in this way is that it improves data locality (and hence cache use) without having to tune a block size or similar parameter. On a modern multilevel cache machine[^1], this @@ -76,7 +84,7 @@ number. Go to the step 1 directory: ```bash -cd archer2-CPP-2021-07-20/exercises/morton-order/step1 +cd archer2-cpp/exercises/morton-order/step1 ``` Using the partial implemenation in `matrix.hpp`, your task is to @@ -95,7 +103,7 @@ supplied `Makefile` should work. Go to the step 2 directory: ```bash -cd archer2-CPP-2021-07-20/exercises/morton-order/step2 +cd archer2-cpp/exercises/morton-order/step2 ``` I have a potential solution to part 1 here, but feel free to copy your diff --git a/lectures/algorithms-lambdas-traits/README.md b/lectures/algorithms-lambdas-traits/README.md index 24772fb..4d367cc 100644 --- a/lectures/algorithms-lambdas-traits/README.md +++ b/lectures/algorithms-lambdas-traits/README.md @@ -1,8 +1,8 @@ template: titleslide # Algorithms, lambdas, traits -## Rupert Nash -## r.nash@epcc.ed.ac.uk +## James Richings +## j.richings@epcc.ed.ac.uk --- @@ -534,7 +534,7 @@ void Comm::send(const std::vector& data, int dest, int tag) { # Real example -Then we can then provide a specialised defintion for all the types we +Then we can then provide a specialised definition for all the types we can handle: ```C++ diff --git a/lectures/classes/README.md b/lectures/classes/README.md index 30980ef..49c3cde 100644 --- a/lectures/classes/README.md +++ b/lectures/classes/README.md @@ -1,7 +1,7 @@ template: titleslide # Classes -## Maurice Jamieson, EPCC -## m.jamieson@epcc.ed.ac.uk +## James Richings, EPCC +## j.richings@epcc.ed.ac.uk --- diff --git a/lectures/cpp-intro/README.md b/lectures/cpp-intro/README.md index c124b70..cbc8ca4 100644 --- a/lectures/cpp-intro/README.md +++ b/lectures/cpp-intro/README.md @@ -1,8 +1,8 @@ template: titleslide # A brief introduction to C++ -## Maurice Jamieson, EPCC -## m.jamieson@epcc.ed.ac.uk +## James Richings, EPCC +## j.richings@epcc.ed.ac.uk --- @@ -243,7 +243,7 @@ template: titleslide --- # Machine choice -You can use your laptop or Cirrus +You can use your laptop or ARCHER2 __Your machine__ : you need a C++ compiler that supports at least C++11. If you use Windows and MSVC we may not be able to help diff --git a/lectures/eigen/README.md b/lectures/eigen/README.md index 9ec1dc1..f2cb0c0 100644 --- a/lectures/eigen/README.md +++ b/lectures/eigen/README.md @@ -1,7 +1,7 @@ template: titleslide # Linear Algebra for C++ (using Eigen) -## Joseph Lee, EPCC -## j.lee@epcc.ed.ac.uk +## James Richings, EPCC +## j.richings@epcc.ed.ac.uk --- # Source @@ -9,6 +9,7 @@ template: titleslide Original: - Chris Richardson (chris@bpi.cam.ac.uk) - Rupert Nash (r.nash@epcc.ed.ac.uk) +- Joseph Lee (j.lee@epcc.ed.ac.uk) --- # Rundown @@ -448,8 +449,9 @@ The matrix A is very similar - just flip the sign of the delta terms --- # Exercise: Diffusion equation (sparse) -Hints: +There is also a way to implement this example using the sparse matrix interface in eigen. +Some changes to look out for in the `sparse.cpp` example: ```C++ #include ``` @@ -468,4 +470,23 @@ for (int i = 0; i < n - 1; ++i) A.setFromTriplets(fill.begin(), fill.end()); ``` -See `exercises/eigen/sparse.cpp` \ No newline at end of file +See `exercises/eigen/sparse.cpp` + +--- +# Exercise: Diffusion equation 3 ways + +- Use `modules.sh` to load correct environment on ARCHER2 + +- Compile the examples using `make` + +- Run each of the three examples explicit, implicit and sparse + +- Generate the movie using the provided python script + +To view the movie you will need to either: + - Download the data and generate it locally + + or + + - Set up a python virtual environment on ARCHER2 with matplotlib + - User `ssh -X` to view graphics \ No newline at end of file diff --git a/lectures/loops-containers/README.md b/lectures/loops-containers/README.md index 978b0d2..f115c7a 100644 --- a/lectures/loops-containers/README.md +++ b/lectures/loops-containers/README.md @@ -1,7 +1,7 @@ template: titleslide # Containers, loops, and iterators -## Rupert Nash -## r.nash@epcc.ed.ac.uk +## James Richings +## j.richings@epcc.ed.ac.uk ??? @@ -464,7 +464,7 @@ In your clone of this repository, find the `containers` exercise and list the files ``` -$ cd archer2-CPP-2021-07-20/exercises/containers +$ cd archer2-cpp/exercises/containers $ ls Makefile test.cpp vector_ex.cpp vector_ex.hpp ``` diff --git a/lectures/resources/README.md b/lectures/resources/README.md index ea34ebf..8f8f795 100644 --- a/lectures/resources/README.md +++ b/lectures/resources/README.md @@ -1,5 +1,8 @@ template: titleslide + # Resource management +## James Richings, EPCC +## j.richings@epcc.ed.ac.uk --- # Resources @@ -779,3 +782,7 @@ etc wrapped here. Try out some of this with exercises/morton-order +Instructions can be found here: + +archer2-cpp/exercises/morton-order/instructions.md + diff --git a/lectures/templates/README.md b/lectures/templates/README.md index aeb4441..0680b47 100644 --- a/lectures/templates/README.md +++ b/lectures/templates/README.md @@ -1,7 +1,7 @@ template: titleslide # Templates -## Rupert Nash -## r.nash@epcc.ed.ac.uk +## James Richings +## j.richings@epcc.ed.ac.uk ??? diff --git a/lectures/threads-1/README.md b/lectures/threads-1/README.md index e1ee954..0ce71d5 100644 --- a/lectures/threads-1/README.md +++ b/lectures/threads-1/README.md @@ -1,7 +1,11 @@ template: titleslide + # C++ Threads - Basics +## James Richings, EPCC +## j.richings@epcc.ed.ac.uk --- + # Overview - Introduction