[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [covid-19] Autoconf solved but now there is a C issue (Was: Help with r-bioc-rgadem needed)



On 2020-04-06, at 20:32:12 +0200, Andreas Tille wrote:
> Hi Jeremy,
>
> On Mon, Apr 06, 2020 at 05:34:23PM +0100, Jeremy Sowden wrote:
> > On 2020-04-06, at 17:59:05 +0200, Andreas Tille wrote:
> > >    dh_autoreconf -O--buildsystem=R
> > > autoheader: warning: missing template: HAVE_OPENMP
> > > autoheader: Use AC_DEFINE([HAVE_OPENMP], [], [Description])
> > > autoreconf: /usr/bin/autoheader failed with exit status: 1
> > > dh_autoreconf: error: autoreconf -f -i returned exit code 1
> > > make: *** [debian/rules:4: binary] Error 25
> > > dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
> >
> > Similar to some of the problems with mpqc yesterday.  Patch attached.
>
> Thanks a lot for your patch (commited to Git[1]) which solved the
> autoconf issue.  Unfortunately there is another issue now:
>
>
> ecking for stdint.h... yes
> checking for unistd.h... yes
> checking dispatch/dispatch.h usability... no
> checking dispatch/dispatch.h presence... no
> checking for dispatch/dispatch.h... no
> checking whether OpenMP will work in a package... yes
> configure: creating ./config.status
> config.status: creating src/Makevars
> config.status: creating src/config.h
> ** libs
> make[1]: Entering directory '/build/r-bioc-rgadem-2.34.1/src'
> gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-j1tBvV/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c Gadem_Analysis.c -o Gadem_Analysis.o
> Gadem_Analysis.c: In function 'GADEM_Analysis':
> Gadem_Analysis.c:618:7: warning: implicit declaration of function 'DO_APPLY' [-Wimplicit-function-declaration]
>   618 |       DO_APPLY(populationCalculation(maxSeqLen, numEM, fitness+ii,
>       |       ^~~~~~~~
> Gadem_Analysis.c:618:16: error: invalid use of void expression
>   618 |       DO_APPLY(populationCalculation(maxSeqLen, numEM, fitness+ii,
>       |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   619 |                                      startPWMfound, minminSites, maxpFactor[ii],
>       |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   620 |                                      numSeq, numSeqEM, seq, rseq, seqLen, Iseq,
>       |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   621 |                                      bfreq0, posWeight, weightType,
>       |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   622 |                                      pvalueCutoff, emSeqLen,
>       |                                      ~~~~~~~~~~~~~~~~~~~~~~~
>   623 |                                      pwm[ii], pwmLen[ii], epwm[ii], opwm[ii],
>       |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   624 |                                      pwmConsensus[ii], scoreCutoff+ii, sdyad[ii], ii),
>       |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> make[1]: *** [/usr/lib/R/etc/Makeconf:168: Gadem_Analysis.o] Error 1
>
>
> Thanks a lot for your help anyway

Patch attached.

J.
From d3b5c1358bcf8463719c0175d759f74819e74f8e Mon Sep 17 00:00:00 2001
From: Jeremy Sowden <jeremy@azazel.net>
Date: Mon, 6 Apr 2020 20:41:54 +0100
Subject: [PATCH] The definition of DO_APPLY in src/config.h.in is clobbered by
 autoheader, so add it in Gadem_Analysis.c where it is used.

---
 src/Gadem_Analysis.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/Gadem_Analysis.c b/src/Gadem_Analysis.c
index a604afeb0479..0e868b56918a 100755
--- a/src/Gadem_Analysis.c
+++ b/src/Gadem_Analysis.c
@@ -25,6 +25,32 @@
 
 #include "config.h"
 
+#ifdef HAVE_DISPATCH_DISPATCH_H
+  #include <dispatch/dispatch.h>
+  #define DO_APPLY(task, n_times, counter_name) \
+    R_CheckUserInterrupt(); \
+    dispatch_apply(n_times, \
+                   dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),       \
+                   ^(size_t counter_name) { task; });
+  
+#else // not HAVE_DISPATCH_DISPATCH_H
+  #ifdef HAVE_OPENMP
+    #include <omp.h>
+    #define DO_APPLY(task, n_times, counter_name) \
+      R_CheckUserInterrupt(); \
+      _Pragma("omp parallel for") \
+      for (int counter_name = 0; counter_name < n_times; ++counter_name) { \
+        task; \
+      }
+  #else // not HAVE_OPENMP
+    #define DO_APPLY(task, n_times, counter_name) \
+      for (int counter_name = 0; counter_name < n_times; ++counter_name) { \
+        R_CheckUserInterrupt(); \
+        task; \
+      }
+  #endif // HAVE_OPENMP
+#endif // HAVE_DISPATCH_DISPATCH_H
+
 /*---------------------------------------------------------------------------
 // v1.3.1: last modifications 5/14/2011
 // added user-input background model
-- 
2.25.1

Attachment: signature.asc
Description: PGP signature


Reply to: