Intial commit of source code samples for GitHub repo.
This commit is contained in:
parent
5793080047
commit
9462407ba8
14 changed files with 397 additions and 1 deletions
38
openmp-c/Makefile
Normal file
38
openmp-c/Makefile
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Sample makefile to add version/compiler info via an extra
|
||||
# object module linked to final binary.
|
||||
#
|
||||
COMPILER_VER:=$(shell gcc --version)
|
||||
COMPILER_OPTS=-fopenmp
|
||||
GIT_DESCRIBE:=$(shell git describe --abbrev=7 --dirty --always --tags --long)
|
||||
|
||||
.PHONY: all
|
||||
all: hello-omp
|
||||
|
||||
versioninfo.txt:
|
||||
@echo "@(#) Compiler version: ${COMPILER_VER}." >versioninfo.txt
|
||||
@echo "@(#) Compiler options: ${COMPILER_OPTS}." >>versioninfo.txt
|
||||
@echo "@(#) Git info: ${GIT_DESCRIBE}" >>versioninfo.txt
|
||||
|
||||
versioninfo.o: versioninfo.txt
|
||||
objcopy --input binary \
|
||||
--output elf64-x86-64 \
|
||||
--binary-architecture i386 \
|
||||
--add-section versioninfo=versioninfo.txt \
|
||||
--set-section-flags versioninfo=contents,noload \
|
||||
versioninfo.txt versioninfo.o
|
||||
|
||||
hello-omp: hello-omp.c Makefile versioninfo.o
|
||||
gcc $(COMPILER_OPTS) -DVERSIONINFO="\"$(GIT_DESCRIBE)\"" hello-omp.c \
|
||||
versioninfo.o -o hello-omp
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
(export OMP_NUM_THREADS=2; ./hello-omp)
|
||||
sleep 5
|
||||
(export OMP_NUM_THREADS=24; ./hello-omp)
|
||||
sleep 5
|
||||
(export OMP_NUM_THREADS=500; ./hello-omp)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f hello-omp versioninfo.*
|
||||
Loading…
Add table
Add a link
Reference in a new issue