[GRASS-SVN] r68805 - grass-addons/grass7/imagery/i.spec.sam
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 30 01:01:07 PDT 2016
Author: ychemin
Date: 2016-06-30 01:01:07 -0700 (Thu, 30 Jun 2016)
New Revision: 68805
Modified:
grass-addons/grass7/imagery/i.spec.sam/Makefile
grass-addons/grass7/imagery/i.spec.sam/main.c
Log:
OpenMP parallelization
Modified: grass-addons/grass7/imagery/i.spec.sam/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.spec.sam/Makefile 2016-06-30 08:00:53 UTC (rev 68804)
+++ grass-addons/grass7/imagery/i.spec.sam/Makefile 2016-06-30 08:01:07 UTC (rev 68805)
@@ -5,6 +5,9 @@
LIBES = $(GISLIB) $(GMATHLIB) $(IMAGERYLIB) $(RASTERLIB)
DEPENDENCIES = $(GISDEP) $(GMATHDEP) $(IMAGERYDEP) $(RASTERDEP)
+EXTRA_CFLAGS = -fopenmp
+EXTRA_LIBS = -lgomp
+
include $(MODULE_TOPDIR)/include/Make/Module.make
default: cmd
Modified: grass-addons/grass7/imagery/i.spec.sam/main.c
===================================================================
--- grass-addons/grass7/imagery/i.spec.sam/main.c 2016-06-30 08:00:53 UTC (rev 68804)
+++ grass-addons/grass7/imagery/i.spec.sam/main.c 2016-06-30 08:01:07 UTC (rev 68805)
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <strings.h>
#include <math.h>
+#include <omp.h>
#include <grass/config.h>
#ifndef HAVE_LIBBLAS
@@ -208,6 +209,7 @@
Rast_get_d_row (cellfd[band], cell[band], row);
/* cols loop, work pixelwise for all bands */
+ #pragma omp parallel for default(shared) private(col,b,band,signature,Avector,spectangle)
for (col = 0; col < ncols; col++)
{
/* get pixel values of each band and store in b vector: */
@@ -232,6 +234,7 @@
}
G_vector_free(b);
} /* columns loop */
+ #pragma omp barrier
/* write the resulting rows: */
for (signature=0; signature<signaturecount; signature++)
More information about the grass-commit
mailing list