Skip to main content

Unit 0.3.4 Cloning the LAFF-On-PfHP repository

We have placed all materials on GitHub. GitHub is a development environment for software projects. In our case, we use it to disseminate the various activities associated with this course.

On the computer on which you have chosen to work, "clone" the GitHub repository for this course:

  • Visit https://github.com/ULAFF/LAFF-On-PfHP

  • Click on

    and copy https://github.com/ULAFF/LAFF-On-PfHP.git.

  • On the computer where you intend to work, in a terminal session on the command line in the directory where you would like to place the materials, execute

    git clone https://github.com/ULAFF/LAFF-On-PfHP.git
    

    This will create a local copy (clone) of the materials.

  • Sometimes we will update some of the files from the repository. When this happens you will want to execute, in the cloned directory,

    git stash save
    

    which saves any local changes you have made, followed by

    git pull
    

    which updates your local copy of the repository, followed by

    git stash pop
    

    which restores local changes you made. This last step may require you to "merge" files that were changed in the repository that conflict with local changes.

Upon completion of the cloning, you will have a directory structure similar to that given in Figure 0.3.3.

Figure 0.3.3. Directory structure for your basic LAFF-On-PfHP materials. In this example, we cloned the repository in Robert's home directory, rvdg.

Homework 0.3.4.1.

We start by checking whether your environment is set up correctly for the programming exercises. In a terminal window, change to the directory Assignments/Week0/C/. In it, at the prompt, type

make HelloWorld

This will compile, link, and execute the driver in file main.c.

Solution

If all went well, you will see output that looks like

gcc -O3 -I/Users/rvdg/blis/include/blis -m64 -mavx2 -std=c99 -march=native -fopenmp -D_POSIX_C_SOURCE=200809L   -c -o driver.o driver.c
gcc -O3 -I/Users/rvdg/blis/include/blis -m64 -mavx2 -std=c99 -march=native -fopenmp -D_POSIX_C_SOURCE=200809L   -c -o FLA_Clock.o FLA_Clock.c
gcc -O3 -I/Users/rvdg/blis/include/blis -m64 -mavx2 -std=c99 -march=native -fopenmp -D_POSIX_C_SOURCE=200809L   -c -o MaxAbsDiff.o MaxAbsDiff.c
gcc -O3 -I/Users/rvdg/blis/include/blis -m64 -mavx2 -std=c99 -march=native -fopenmp -D_POSIX_C_SOURCE=200809L   -c -o RandomMatrix.o RandomMatrix.c
gcc driver.o FLA_Clock.o MaxAbsDiff.o RandomMatrix.o /Users/rvdg/blis/lib/libblis.a -o driver.x -lpthread -m64 -lm -fopenmp 
echo 

./driver.x
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World

(The number of times "Hello World" is printed may vary depending on how many cores your processor has.)

Remark 0.3.4.
  • If make HelloWorld indicates libblis.a is not found, then you likely did not install that library correction in Unit 0.3.3. In particular, you likely skipped make install.

  • If you get the error message

    clang: error: unsupported option '-fopenmp'
    

    Then you need to set the path to the gcc compiler. See Unit 0.3.3.