From 0fd51e8a9cbc2cd18136207f4c8176f4881bd9bd Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Wed, 19 Aug 2020 11:19:16 +0200 Subject: [PATCH] Add OpenMP parallelization for computeForce. --- include_CLANG.mk | 4 ++-- src/main.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include_CLANG.mk b/include_CLANG.mk index 1383bc0..4a862c8 100644 --- a/include_CLANG.mk +++ b/include_CLANG.mk @@ -7,11 +7,11 @@ ANSI_CFLAGS += -std=c99 ANSI_CFLAGS += -pedantic ANSI_CFLAGS += -Wextra -CFLAGS = -Ofast $(ANSI_CFLAGS) #-g +CFLAGS = -Ofast $(ANSI_CFLAGS) -Xpreprocessor -fopenmp #-g ASFLAGS = -masm=intel CXXFLAGS = $(CFLAGS) FCFLAGS = LFLAGS = DEFINES = -D_GNU_SOURCE -DALIGNMENT=64 INCLUDES = -LIBS = +LIBS = -lomp diff --git a/src/main.c b/src/main.c index 96e83a8..b5200f1 100644 --- a/src/main.c +++ b/src/main.c @@ -156,6 +156,7 @@ double computeForce(Parameter *param, Atom *atom, Neighbor *neighbor) fz[i] = 0.0; } +#pragma omp parallel for for(int i = 0; i < Nlocal; i++) { neighs = &neighbor->neighbors[i * neighbor->maxneighs]; int numneighs = neighbor->numneigh[i];