You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/courses/containers-for-hpc/building-apptainer.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -292,7 +292,7 @@ While our container is functional, there is room for improvement. We shall look
292
292
293
293
### 1. Clean up
294
294
295
-
Package managers usually leave behind some cache files after installation that can be safely removed. Dependending on your application, they can easily accumulate up to several GBs.
295
+
Package managers usually leave behind some cache files after installation that can be safely removed. Depending on your application, they can easily accumulate up to several GBs.
296
296
297
297
{{< code-snippet >}}Bootstrap: docker
298
298
From: ubuntu:22.04
@@ -424,7 +424,7 @@ A container registry is a repository for container images. Here we examine two p
424
424
425
425
The Apptainer/Singularity SIF is supported by Docker Hub. Register for a free account.
426
426
427
-
{{< info >}}Replace "myname" with your actual user name in the following commands.{{< /info >}}
427
+
{{< info >}}Replace "myname" with your actual username in the following commands.{{< /info >}}
428
428
429
429
Login:
430
430
```bash
@@ -486,7 +486,7 @@ Your project requires PyTorch 2.1.2, Numpy, Seaborn, and Pandas. Write the corre
486
486
487
487
Hints:
488
488
- Find the appropriate base image from [here](https://hub.docker.com/r/pytorch/pytorch/tags).
489
-
- Pull the base image and examine it first. Does it already provide some of the packages?
489
+
- Pull the base image and examine it first. Does it already provide some packages?
490
490
491
491
{{< info >}}While PyTorch runs on a GPU, you do not need to build the container on a GPU.{{< /info >}}
492
492
@@ -507,7 +507,7 @@ Your project requires R 4.3.2, dplyr, ggplot2, and RcppGSL. Write the correspond
507
507
508
508
Hints:
509
509
- Pick an appropriate base image - there are two viable choices here.
510
-
- Pull the base image and examine it first. Does it already provide some of the packages?
510
+
- Pull the base image and examine it first. Does it already provide some packages?
511
511
- In the definition file, install CRAN packages via `R -e "install.packages('...')"`.
512
512
- Load the three packages. Do they all succeed? If not, how can you fix it?
Almost all package managers leave behind some cache files after installation that can be safely removed. Dependending on your application, they can easily accumulate up to several GBs. Let's see what happens if we try to clean up the cache in a separate `RUN` statement.
170
+
Almost all package managers leave behind some cache files after installation that can be safely removed. Depending on your application, they can easily accumulate up to several GBs. Let's see what happens if we try to clean up the cache in a separate `RUN` statement.
Copy file name to clipboardExpand all lines: content/courses/containers-for-hpc/minimal.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -303,7 +303,7 @@ LightGBM is a gradient boosting framework that uses tree based learning algorith
303
303
304
304
## Exercise: `fortune` from scratch
305
305
306
-
This exercise illustrates how we can cherrypick files from the package manager that are essential to the application.
306
+
This exercise illustrates how we can cherry-pick files from the package manager that are essential to the application.
307
307
308
308
1. The Ubuntu base image shall be our basis of comparison. Copy the Dockerfile and build the image.
309
309
@@ -576,7 +576,7 @@ where $A_{mk}, B_{kn}, C_{mn}$ are matrices and $\alpha, \beta$ are constants. F
576
576
This exercise illustrates that it is easier to build a minimal container of a static binary.
577
577
578
578
## Exercise: Linking against LibTorch
579
-
LibTorch is the C++ frontend of PyTorch. This exericse is based on the ["Writing a Basic Application"](https://pytorch.org/tutorials/advanced/cpp_frontend.html#writing-a-basic-application) section of the PyTorch tutorial.
579
+
LibTorch is the C++ frontend of PyTorch. This exercise is based on the ["Writing a Basic Application"](https://pytorch.org/tutorials/advanced/cpp_frontend.html#writing-a-basic-application) section of the PyTorch tutorial.
580
580
581
581
1. Select an appropriate base image. (Hint: You will be compiling C++ code.)
Copy file name to clipboardExpand all lines: content/courses/cpp-introduction/boost.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,12 @@ One of the most popular add-on libraries for C++, especially numerical or scient
11
11
12
12
### Installing Boost
13
13
14
-
Boost uses its own build system on Unix and Mac OS. On Windows there is an experimental CMake system but generally the "bjam" builder is still used.
14
+
Boost uses its own build system on Unix and macOS. On Windows there is an experimental CMake system but generally the "bjam" builder is still used.
15
15
In all cases, installing Boost requires some familiarity with using a command line.
16
16
17
-
#### Unix and Mac OS
17
+
#### Unix and macOS
18
18
19
-
On a Linux system, the simplest way to install Boost is to utilize the package manager of the distribution. For example on Ubunutu the command is
19
+
On a Linux system, the simplest way to install Boost is to utilize the package manager of the distribution. For example on Ubuntu the command is
20
20
```no-highlight
21
21
sudo apt install libboost-all-dev
22
22
```
@@ -25,9 +25,9 @@ or on Fedora (or Centos 8 and beyond)
25
25
sudo dnf install boost
26
26
sudo dnf install boost-devel
27
27
```
28
-
If you do not have superuser (sudo) permission or you wish to install Boost somewhere other than the main system libraries, follow the general [instructions](
28
+
If you do not have superuser (sudo) permission, or you wish to install Boost somewhere other than the main system libraries, follow the general [instructions](
The default prefix for installation from `b2 install` is `/usr/local`. This is true for both Linux and Mac OS. If you wish to install to `/usr/local`, which is normally in the system search paths, you will need to run the installation command with sudo
30
+
The default prefix for installation from `b2 install` is `/usr/local`. This is true for both Linux and macOS. If you wish to install to `/usr/local`, which is normally in the system search paths, you will need to run the installation command with sudo
31
31
```no-highlight
32
32
cd path/to/boost/source
33
33
./bootstrap.sh
@@ -59,11 +59,11 @@ Installation on Windows is somewhat more complicated than on Unix variants. Fir
59
59
60
60
Using Boost is probably simplest with a Makefile. The [example](/courses/cpp-introduction/codes/makefile.windows_boost) is for Windows with a particular choice of location for the boost header files and libraries. Change the locations for `-I` and `-L` as appropriate if they are located elsewhere on your system. Please refer to the earlier [chapter](/courses/cpp-introduction/make) for a review of setting up Makefiles. This example goes with a standard Boost [example](/courses/cpp-introduction/codes/boost_example.cxx).
61
61
62
-
If you have installed Boost onto a Linux or Mac OS system to a system default search location such as `/usr` or `/usr/local` you will not need to specify the `-I` or `-L` paths at all. The example [makefile](/courses/cpp-introduction/codes/makefile.linux_mac_boost) assumes installation in system paths in the compiler's default search paths.
62
+
If you have installed Boost onto a Linux or macOS system to a system default search location such as `/usr` or `/usr/local` you will not need to specify the `-I` or `-L` paths at all. The example [makefile](/courses/cpp-introduction/codes/makefile.linux_mac_boost) assumes installation in system paths in the compiler's default search paths.
63
63
64
64
## Boost MultiArrays
65
65
66
-
C-style arrays are widely used but lack some important features, such as the ability to check that index references do not occur outside of the arrays bounds.
66
+
C-style arrays are widely used but lack some important features, such as the ability to check whether indexes outside the array bounds are referenced.
67
67
The C++ STL array type has more features, but is limited to one dimension. A workaround is to "stack" vectors, since a vector of a vector amounts to a 2-dimensional structure.
Copy file name to clipboardExpand all lines: content/courses/cpp-introduction/building.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ weight: 11
7
7
8
8
---
9
9
10
-
The "traditional" development environment for compiled languages was a text editor and a command line. Many programmers continue to use these successfully, but modern tools can greatly improve programmer productivity. Some such tools are especially recommended for the Windows operating system, since it does not support command-line usage as cleanly as Linux or Mac OS.
10
+
The "traditional" development environment for compiled languages was a text editor and a command line. Many programmers continue to use these successfully, but modern tools can greatly improve programmer productivity. Some such tools are especially recommended for the Windows operating system, since it does not support command-line usage as cleanly as Linux or macOS.
11
11
12
12
## Compilers
13
13
@@ -30,21 +30,21 @@ Intel has recently released the [oneAPI Toolkits](https://software.intel.com/con
30
30
31
31
An Integrated Development Environment (IDE) combines an editor and a way to compile and run programs in the environment.
32
32
A well-known IDE for Microsoft Windows is Visual Studio. This is available through the Microsoft Store; it is not free for individuals.
33
-
Mac OS uses Xcode as its native IDE. Xcode includes some compilers, particularly for Swift, but it can manage several other languages. Available at the App Store and free.
33
+
macOS uses Xcode as its native IDE. Xcode includes some compilers, particularly for Swift, but it can manage several other languages. Available at the App Store and free.
34
34
35
35
A full-featured cross-platform IDE is [Eclipse] (http://www.eclipse.org/). Free.
36
36
37
37
A lighter-weight IDE for Windows and Linux is [Code::Blocks] (http://www.codeblocks.org/). Free.
38
38
39
39
Windows programmers using Intel's oneAPI distribution must also install [Visual Studio](https://visualstudio.microsoft.com/).
40
40
41
-
An increasingly popular IDE is Visual Studio Code ([VSCode](https://code.visualstudio.com/)) from Microsoft. It is also cross-platform, with versions available for Windows, Mac OS, and Linux. It does not support C, C++, or Fortran by default; extensions must be installed to provide syntax highlighting and debugging for those languages. C and C++ are installed with one extension that can be found at the top of the list.
41
+
An increasingly popular IDE is Visual Studio Code ([VSCode](https://code.visualstudio.com/)) from Microsoft. It is also cross-platform, with versions available for Windows, macOS, and Linux. It does not support C, C++, or Fortran by default; extensions must be installed to provide syntax highlighting and debugging for those languages. C and C++ are installed with one extension that can be found at the top of the list.
42
42
43
43
In our examples, we will use a very lightweight IDE called [Geany](https://www.geany.org/) since it is free, easy to install and use, and works on all three platforms. It is more of a programmer's editor than a full-featured IDE, but it does include some build tools.
44
44
45
45
## Building an Executable
46
46
47
-
Creating an executable is generally a multi-step process. Of course, the first step is the preparation of a _source file_. The convention for C++ was once a file extension of `.cpp`, but that conflicts with the name of the preprocessor (C PreProcessor) so `.cxx` is increasingly common. We will use `.cxx` but `.cpp` still works.
47
+
Creating an executable is generally a multistep process. Of course, the first step is the preparation of a _source file_. The convention for C++ was once a file extension of `.cpp`, but that conflicts with the name of the preprocessor (C PreProcessor) so `.cxx` is increasingly common. We will use `.cxx` but `.cpp` still works.
48
48
49
49
From each source file, the compiler first produces an _object file_. In Unix these end in `.o`, or `.obj` on Windows.
50
50
This is the _compilation_ step.
@@ -54,15 +54,15 @@ If not told otherwise a compiler will attempt to compile and link the source fil
54
54
55
55
For Unix compilers the `-c` option suppresses linking. The compiler must then be run again to build the executable from the object files.
56
56
The linker option `-o` is used to name the binary something other than `a.out`.
57
-
Unix and MacOS do not care about file extensions, but Windows will expect an executable to end in `.exe`.
57
+
Unix and macOS do not care about file extensions, but Windows will expect an executable to end in `.exe`.
58
58
59
59
### Command Line
60
60
61
-
For full control and access to more compiler options, we can build from the command line. For Linux and Mac this is a terminal application. On windows, use a command prompt for gcc. The Intel oneAPI distribution ships with an integrated command prompt in its folder in the applications menu; this command prompt is aware of the location of the compiler executables and libraries.
61
+
For full control and access to more compiler options, we can build from the command line. For Linux and Mac this is a terminal application. On Windows, use a command prompt for gcc. The Intel oneAPI distribution ships with an integrated command prompt in its folder in the "applications" menu; this command prompt is aware of the location of the compiler executables and libraries.
62
62
63
63
**Example**
64
64
```
65
65
g++ -c mymain.cxx
66
66
g++ -c mysub.cxx
67
67
```
68
-
IDEs generally manage basic compiler options and usually name the executable based on the project name. Our examples of command line usage will all assume a Unix operating system; there are some differences between Linux and MacOS, with larger differences for Windows. On MacOS and especially Windows, using an IDE makes code management simpler. Using Geany as our example, clicking the icon showing a pyramid pointing to a circle will compile the current file without attempting to invoke the linker. The brick icon builds the current file, so it must be possible to create a standalone executable from a single file.
68
+
IDEs generally manage basic compiler options and usually name the executable based on the project name. Our examples of command line usage will all assume a Unix operating system; there are some differences between Linux and macOS, with larger differences for Windows. On macOS and especially Windows, using an IDE makes code management simpler. Using Geany as our example, clicking the icon showing a pyramid pointing to a circle will compile the current file without attempting to invoke the linker. The brick icon builds the current file, so it must be possible to create a standalone executable from a single file.
Type in a short user name (any string), then type `Eleventy` as your password. It should work as expected. Now try typing a user name that is longer than 10 characters and see what happens.
93
+
Type in a short username (any string), then type `Eleventy` as your password. It should work as expected. Now try typing a username that is longer than 10 characters and see what happens.
94
94
95
95
If using C-style strings and functions, guard against this by using
Copy file name to clipboardExpand all lines: content/courses/cpp-introduction/classes.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Objects _encapsulate_ related concepts and keep them unified. They may _hide_ d
15
15
Generally speaking, an object would contain the procedures required to update and maintain its _state_.
16
16
In most object-oriented programming languages, objects are abstract concepts that are represented in code by _classes_.
17
17
18
-
Object-oriented programming (OOP) grew from programming fields that simulated real-world, physical objects and it may be easiest to grasp by thinking of that model. These objects well defined and their interactions could be managed through the _interface_ that each object provided. A user interface is a good example. We have various objects such as figures, text, menus, and so forth. The figures might be one-dimensional (lines, arrows, etc.) or two-dimensional (rectangles, ellipses, etc). They have characteristics such as length/radius, they have a state such as current size, color and location of their centers, and they have behaviors such as moving or rotating. Text has location and the content of the string that it displays. All these objects interact with each other, as the user takes various actions or the program executes.
18
+
Object-oriented programming (OOP) grew from programming fields that simulated real-world, physical objects and it may be easiest to grasp by thinking of that model. These objects are well-defined and their interactions can be managed through the _interface_ that each object provided. A user interface is a good example. We have various objects such as figures, text, menus, and so forth. The figures might be one-dimensional (lines, arrows, etc.) or two-dimensional (rectangles, ellipses, etc). They have characteristics such as length/radius, they have a state such as current size, color and location of their centers, and they have behaviors such as moving or rotating. Text has location and the content of the string that it displays. All these objects interact with each other, as the user takes various actions or the program executes.
19
19
20
20
For another example, return to the Employee struct. The struct collected data about an employee into a unified type. However, actions may be associated with an employee. Salaries could be raised, addresses could be updated, employees could join or quit the company, and so forth. We would implement procedures to carry out these actions and include them in the object.
Copy file name to clipboardExpand all lines: content/courses/cpp-introduction/console_io.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ The standard streams are incorporated with the header
20
20
```c++
21
21
#include<iostream>
22
22
```
23
-
The iostream library is part of the C++ standard libraries set and contains _stream objects_ for standard streams. They correspond to the standard streams of Unix or Mac OS. Windows handles console IO differently, but iostream can map the stream objects to its equivalents.
23
+
The iostream library is part of the C++ standard libraries set and contains _stream objects_ for standard streams. They correspond to the standard streams of Unix or macOS. Windows handles console IO differently, but iostream can map the stream objects to its equivalents.
24
24
25
25
{{< table >}}
26
26
| cin | standard input |
@@ -30,7 +30,7 @@ The iostream library is part of the C++ standard libraries set and contains _str
30
30
{{< /table >}}
31
31
32
32
The `cin` object is for input; it is a member of the _istream_ (input stream) class. If a console is attached the others all output is to the same device (the screen). They are members of the _ostream_ (output stream) class.
33
-
Unix and Mac OS shells can redirect standard output and standard error to separate files.
33
+
Unix and macOS shells can redirect standard output and standard error to separate files.
34
34
Standard output is for "normal" output whereas standard error is used for error messages.
35
35
36
36
On Linux cin and cout are buffered, whereas cerr is not.
Copy file name to clipboardExpand all lines: content/courses/cpp-introduction/containers_templates.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ int main() {
39
39
}
40
40
```
41
41
42
-
The standard library consists of _containers_, _algorithms_, _iterators_, and a number of general-purpose and numerical sublibraries. A comprehensive list is [here](https://www.cplusplus.com/reference/).
42
+
The standard library consists of _containers_, _algorithms_, _iterators_, and a number of general-purpose and numerical sub-libraries. A comprehensive list is [here](https://www.cplusplus.com/reference/).
0 commit comments