Skip to content

Conversation

@Thyre
Copy link
Contributor

@Thyre Thyre commented Oct 30, 2025

The first argument for AC_LANG_PROGRAM is missing an additional layer of braces, while the second argument defines a main which is automatically added by AC_LANG_PROGRAM.

This fails the test with NVHPC and other Clang-based compilers, and might produce unexpected results with other compilers.

To fix this, apply proper syntax to the ucc subconfigure.

@Thyre
Copy link
Contributor Author

Thyre commented Oct 30, 2025

Currently, a similar code to this is tested:

int main( void )
{
    int main( void )
    {
        return 0;
    }
}

This always fails with several compilers.
Clang for example simply returns:

<source>:4:5: error: function definition is not allowed here
    4 |     {
      |     ^
1 error generated.
Compiler returned: 1

See https://godbolt.org/z/Kr1z8xx18

@carsten-clauss
Copy link
Contributor

Thank you very much for the report and the pull request. 👍
At a first glance, I would say you are absolutely right, and we will try to include this in the master branch as soon as possible and thus fix it with the next release. Stay tuned!

@Thyre
Copy link
Contributor Author

Thyre commented Oct 30, 2025

I've tried this patch with both NVHPC 25.9 & oneAPI 2025.2.0 for our upcoming software stage. Both failed before.

CUDA support is reported as existing:

checking if UCC is CUDA-aware (HAVE_CUDA)... yes

Without the patch, configure fails like this:

configure:59608: icx -c   -DMPIR_CONTEXT_DYNAMIC_PROC_WIDTH=0  -DNDEBUG -DNVALGRIND -O3   -DMPIR_USE_DEVICE_MEMCPY -I/p/project
1/cjsc/reuter1/EasyBuild/Next/easybuild/jurecadc/software/UCC/default-GCCcore-14.3.0/include -I/p/software/default/stages/2026/
software/CUDA/13/include -I/dev/shm/reuter1/jurecadc/psmpi/5.13.0-1/intel-compilers-2025.2.0/psmpi-5.13.0-1/mpich2/src/mpl/incl
ude -I/dev/shm/reuter1/jurecadc/psmpi/5.13.0-1/intel-compilers-2025.2.0/psmpi-5.13.0-1/mpich2/modules/json-c -D_REENTRANT -I/de
v/shm/reuter1/jurecadc/psmpi/5.13.0-1/intel-compilers-2025.2.0/psmpi-5.13.0-1/mpich2/src/mpi/romio/include -I/p/project1/cjsc/r
euter1/EasyBuild/Next/easybuild/jurecadc/software/PMIx/5.0.8-GCCcore-14.3.0/include -I/dev/shm/reuter1/jurecadc/psmpi/5.13.0-1/
intel-compilers-2025.2.0/psmpi-5.13.0-1/mpich2/src/pmi/include conftest.c >&5
[...]
conftest.c:300:52: error: function definition is not allowed here
  300 |                                         int main() {
      |                                                    ^
8 warnings and 1 error generated.
configure:59608: $? = 1
configure: failed program was:
[...]
| #define UCC_MODULE_SUBDIR         "ucc"
| #define UCS_HAVE_CONFIG_GLOBAL_LIST_ENTRY_FLAGS 1
| #define UCS_HAVE_MPOOL_PARAMS     1
| #define UCS_HAVE_PARSER_CONFIG_DOC 1
| #define UCS_HAVE_PARSER_PRINT_FILTER_ARG 1
| #define UCS_HAVE_PARSER_SET_VALUE_TABLE_PREFIX 1
| #define UCS_HAVE_RCACHE_MERGE_CB  1
| #define UCS_HAVE_RCACHE_REGION_ALIGNMENT 1
| #define UCS_MAX_LOG_LEVEL         UCS_LOG_LEVEL_DEBUG
| #define VERSION                   "1.4"
| int
| main (void)
| {
|
|                                         int main() {
|                                           #if !defined(HAVE_CUDA) || HAVE_CUDA != 1
|                                           #error macro not defined
|                                           #endif
|                                           return 0;
|                                         }
|
|
|   ;
|   return 0;
| }
|

@carsten-clauss
Copy link
Contributor

Yes, thanks again, also for this detailed explanation. I think this bug as not been detected before because it seems as if gcc allows for nested functions as an gcc-specific extension. 😲 (...which reminds me how important it is to check things with all common compilers. 😉)

The first argument for AC_LANG_PROGRAM is missing an additional layer
of braces, while the second argument defines a main which is automatically
added by AC_LANG_PROGRAM.

This fails the test with NVHPC and other Clang-based compilers, and might
produce unexpected results with other compilers.

To fix this, apply proper syntax to the ucc subconfigure.

Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de>
@Thyre Thyre force-pushed the psmpi-fix-configure branch from a746bca to 304c9d4 Compare October 30, 2025 16:46
@carsten-clauss
Copy link
Contributor

Thanks again for your contribution. Are you ok with us incorporating your fix under ParaStation MPI's license, i.e. QPL?

@carsten-clauss
Copy link
Contributor

Just for for information: Your commit has now been merged via ParTec's internal GitHub into the psmpi master branch.

I think we can close this PR now. Thanks again for your contribution! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants