Homework/Lab 1 Sample Solutions Solutions here gathered from submissions Graded out of 5 points. 1. 0 points, since everyone can send e-mail. 2. 0 points, nothing to submit. 3. Makefile for pthread test program. (1 point) # # Makefile to compile and link the pthreadhello program # Default target all: pthreadhello # The compiler CC=gcc # Flags to pass to the compiler CFLAGS=-pthread # Source files CFILES=pthreadhello.c # Object files OFILES=$(CFILES:.c=.o) # Rule to make object files from source files .c.o: $(CC) -c $< # Rule to make the pthreadhello program pthreadhello: $(OFILES) $(CC) -o pthreadhello $(OFILES) 4. Makefile for MPI test program (1 point) # # Makefile to compile and link sample mpi program # Default target - create the mpi program all: mpihello # The compiler CC=mpicc # Flags to pass to the compiler CFLAGS= # The source files for the mpi program CFILES=mpihello.c # The object files for the program OFILES=$(CFILES:.c=.o) # Rule to make the object files from the source files .c.o: $(CC) -c $< # Rule to make the mpihello program/target mpihello: $(OFILES) $(CC) -o mpihello $(OFILES) 5. Come up with an example application that you use which you think could benefit from parallel processing. Describe how you think it could be parallelized and what benefit parallelization might provide. (3 points) Some of the answers given worthy of the full point: - web servers - file search utilitites - cracking of cryptographic codes