ompi icon indicating copy to clipboard operation
ompi copied to clipboard

error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'

Open abeltre1 opened this issue 6 years ago • 6 comments

Thank you for taking the time to submit an issue!

Background information

I was able to easily compile and build OpenMPI regardless of the version. However, now I am hitting this roadblocks which a lot of error where I have to place the compilation flags to configure the installation.

What version of Open MPI are you using? (e.g., v1.10.3, v2.1.0, git branch name and hash, etc.)

v4.0.0.

Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)

tarball

Please describe the system on which you are running

  • Operating system/version: centos:7.6.1810
  • Computer hardware: Intel
  • Network type: IB

Details of the problem

make[2]: Entering directory `/openmpi-4.0.0/opal/mca/btl/uct'
  CC       btl_uct_module.lo
  CC       btl_uct_component.lo
In file included from btl_uct_component.c:37:0:
btl_uct_device_context.h: In function 'mca_btl_uct_get_context_index':
btl_uct_device_context.h:67:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
         static _Thread_local int uct_index = -1;
                              ^
make[2]: *** [btl_uct_component.lo] Error 1
make[2]: Leaving directory `/openmpi-4.0.0/opal/mca/btl/uct'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/openmpi-4.0.0/opal'
make: *** [all-recursive] Error 1

abeltre1 avatar Jan 31 '19 16:01 abeltre1

@hjelmn I'm not sure how this does become a problem? Does our configure missed OPAL_C_HAVE__THREAD_LOCAL define or we put the wrong check?

@abeltre1 What compiler are you using? You can circumvent this component by configure with --without-uct if you dont care about this component. (just a workaround)

 65 #if OPAL_C_HAVE__THREAD_LOCAL
 66     if (mca_btl_uct_component.bind_threads_to_contexts) {
 67         static _Thread_local int uct_index = -1;
 68
 69         context_id = uct_index;
 70         if (OPAL_UNLIKELY(-1 == context_id)) {
 71             context_id = uct_index = opal_atomic_fetch_add_32 ((opal_atomic_int32_t *) &next_uct_index, 1) %
 72                 mca_btl_uct_component.num_contexts_per_module;
 73         }
 74     } else {
 75 #endif

Anyhow, I propose this change. I'm not sure it will fix the problem but this should go in.

diff --git a/opal/mca/btl/uct/btl_uct_device_context.h b/opal/mca/btl/uct/btl_uct_device_context.h
index f88e431471..538e717af7 100644
--- a/opal/mca/btl/uct/btl_uct_device_context.h
+++ b/opal/mca/btl/uct/btl_uct_device_context.h
@@ -62,9 +62,9 @@ static inline int mca_btl_uct_get_context_index (void)
     static opal_atomic_uint32_t next_uct_index = 0;
     int context_id;

-#if OPAL_C_HAVE__THREAD_LOCAL
+#if OPAL_HAVE_THREAD_LOCAL
     if (mca_btl_uct_component.bind_threads_to_contexts) {
-        static _Thread_local int uct_index = -1;
+        static opal_thread_local int uct_index = -1;

         context_id = uct_index;
         if (OPAL_UNLIKELY(-1 == context_id)) {
@@ -76,7 +76,7 @@ static inline int mca_btl_uct_get_context_index (void)
         /* avoid using atomics in this. i doubt it improves performance to ensure atomicity on the next
          * index in this case. */
         context_id = next_uct_index++ % mca_btl_uct_component.num_contexts_per_module;
-#if OPAL_C_HAVE__THREAD_LOCAL
+#if OPAL_HAVE_THREAD_LOCAL
     }
 #endif

thananon avatar Jan 31 '19 19:01 thananon

@thananon Are you going to make a PR for your proposed patch?

jsquyres avatar Feb 06 '19 11:02 jsquyres

I'm waiting for @hjelmn to pitch in on this. He said that ICC support for c11 atomic is kinda weird right now. So I'm not sure if the patch will work. Also @abeltre1 hasn't replied to our question about what compiler he's using.

thananon avatar Feb 06 '19 17:02 thananon

@thananon I see no reason to apply your patch. I won't have the time to make the change for the next several weeks.

hjelmn avatar Feb 18 '19 00:02 hjelmn

Is this still an issue in the latest 4.0.x or 4.1.x releases?

jsquyres avatar Mar 24 '21 15:03 jsquyres

It looks like this issue is expecting a response, but hasn't gotten one yet. If there are no responses in the next 2 weeks, we'll assume that the issue has been abandoned and will close it.

github-actions[bot] avatar Feb 16 '24 21:02 github-actions[bot]

Per the above comment, it has been a month with no reply on this issue. It looks like this issue has been abandoned.

I'm going to close this issue. If I'm wrong and this issue is not abandoned, please feel free to re-open it. Thank you!

github-actions[bot] avatar Mar 01 '24 21:03 github-actions[bot]