add an openmp version of hello world ;)
This commit is contained in:
		
							parent
							
								
									341990f1ee
								
							
						
					
					
						commit
						d0be71ac8f
					
				
					 3 changed files with 12 additions and 1 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -30,3 +30,4 @@ av-variance
 | 
				
			||||||
undefined-behaviour
 | 
					undefined-behaviour
 | 
				
			||||||
multibrot-openmp
 | 
					multibrot-openmp
 | 
				
			||||||
multibrot-openmp.png
 | 
					multibrot-openmp.png
 | 
				
			||||||
 | 
					hello-openmp
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
					@ -5,7 +5,7 @@ CFLAGS=-std=c99 -Wextra -pedantic -g -O0
 | 
				
			||||||
CC_OPENMP=gcc # no OpenMP in our clang
 | 
					CC_OPENMP=gcc # no OpenMP in our clang
 | 
				
			||||||
CFLAGS_OPENMP=$(CFLAGS) -fopenmp
 | 
					CFLAGS_OPENMP=$(CFLAGS) -fopenmp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom wo-lernen lua-foo binsearch test-inline-assembly uiowa-threads-example mtrace-test av-variance undefined-behaviour multibrot-openmp
 | 
					TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom wo-lernen lua-foo binsearch test-inline-assembly uiowa-threads-example mtrace-test av-variance undefined-behaviour multibrot-openmp hello-openmp
 | 
				
			||||||
EXTRAS=mandelbrot.bmp multibrot.png test-inline-assembly.s tags mtrace-test.trace mtrace-test.txt
 | 
					EXTRAS=mandelbrot.bmp multibrot.png test-inline-assembly.s tags mtrace-test.trace mtrace-test.txt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: all
 | 
					.PHONY: all
 | 
				
			||||||
| 
						 | 
					@ -67,5 +67,8 @@ uiowa-threads-example: uiowa-threads.o uiowa-threads-example.c
 | 
				
			||||||
av-variance: av-variance.c
 | 
					av-variance: av-variance.c
 | 
				
			||||||
	$(CC) $(CFLAGS) -o $@ $< -lm
 | 
						$(CC) $(CFLAGS) -o $@ $< -lm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					hello-openmp: hello-openmp.c
 | 
				
			||||||
 | 
						$(CC_OPENMP) $(CFLAGS_OPENMP) -o $@ $<
 | 
				
			||||||
 | 
					
 | 
				
			||||||
multibrot-openmp: multibrot-openmp.c
 | 
					multibrot-openmp: multibrot-openmp.c
 | 
				
			||||||
	$(CC_OPENMP) $(CFLAGS_OPENMP) -o $@ $< -lm -lpng
 | 
						$(CC_OPENMP) $(CFLAGS_OPENMP) -o $@ $< -lm -lpng
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										7
									
								
								hello-openmp.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								hello-openmp.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,7 @@
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main(void) {
 | 
				
			||||||
 | 
					  #pragma omp parallel
 | 
				
			||||||
 | 
					    printf("Hello, world.\n");
 | 
				
			||||||
 | 
					  return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue