Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal binaries... #15

Open
anyzelman opened this issue Oct 3, 2023 · 1 comment
Open

Universal binaries... #15

anyzelman opened this issue Oct 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@anyzelman
Copy link
Member

...are currently broken. @KADichev can provide a recent example

@anyzelman anyzelman added the bug Something isn't working label Oct 3, 2023
@KADichev
Copy link
Collaborator

KADichev commented Oct 3, 2023

Here a basic example:

#include <cstring>
#include <lpf/core.h>
#include <lpf/mpi.h>

const int LPF_MPI_AUTO_INITIALIZE = 0;

void spmd( lpf_t lpf, lpf_pid_t pid, lpf_pid_t nprocs, lpf_args_t args )
{
    (void) args;  // ignore args parameter passed by lpf_exec
}

int main(int argc, char **argv)
{

  const int required = MPI_THREAD_SERIALIZED;

  int provided;
  MPI_Init_thread(&argc, &argv, required, &provided);
  if (provided != required) {
      fprintf(stderr, "Error: MPI threading level not supported!\n");
      return 1;
  }

  lpf_args_t args;
  memset(&args, 0, sizeof(lpf_args_t));
  args.input = argv;
  args.input_size = argc;
  lpf_init_t init;
  lpf_mpi_initialize_with_mpicomm(MPI_COMM_WORLD, &init);
  lpf_hook(init, &spmd, args);
  lpf_mpi_finalize(init);
  MPI_Finalize();
  return 0;
}

This does not compile without specifying engine:

lpfcxx  -o test2 test2.cpp 
/usr/bin/ld: /tmp/ccziLMzO.o: in function `main':
test2.cpp:(.text+0x56): undefined reference to `MPI_Init_thread'
/usr/bin/ld: test2.cpp:(.text+0xc0): undefined reference to `lpf_mpi_initialize_with_mpicomm'
/usr/bin/ld: test2.cpp:(.text+0xf8): undefined reference to `lpf_mpi_finalize'
/usr/bin/ld: test2.cpp:(.text+0xfd): undefined reference to `MPI_Finalize'
collect2: error: ld returned 1 exit status

This compiles:

lpfcxx -engine ibverbs  -o test2 test2.cpp 
/usr/bin/ld: /tmp/ccziLMzO.o: in function `main':
test2.cpp:(.text+0x56): undefined reference to `MPI_Init_thread'
/usr/bin/ld: test2.cpp:(.text+0xc0): undefined reference to `lpf_mpi_initialize_with_mpicomm'
/usr/bin/ld: test2.cpp:(.text+0xf8): undefined reference to `lpf_mpi_finalize'
/usr/bin/ld: test2.cpp:(.text+0xfd): undefined reference to `MPI_Finalize'
collect2: error: ld returned 1 exit status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants