[Trilinos-Users] Teuchos link error with Xcode

Sensei senseiwa at gmail.com
Tue Jul 14 08:11:44 EDT 2015


An addition to the problem.

It seems I cannot create an Epetra_Map correctly. In addition to the 
code I've posted, which cannot be linked for some missing identifiers, 
I've found a weird error.

If I create a map, be either with RCP or standalone, it crashes.

Take a look at this code, crashing when accessing a map:


#include <iostream>

#include "mpi.h"

#include "BelosConfigDefs.hpp"
#include "BelosLinearProblem.hpp"
#include "BelosEpetraAdapter.hpp"
#include "BelosBlockGmresSolMgr.hpp"

#include "Epetra_Map.h"
#ifdef EPETRA_MPI
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif
#include "Epetra_CrsMatrix.h"
#include "Teuchos_CommandLineProcessor.hpp"
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_StandardCatchMacros.hpp"

int main(int argc, char * argv[])
{
     int rank = 0;

#ifdef EPETRA_MPI
     // Initialize MPI
     MPI_Init(&argc,&argv);
     Epetra_MpiComm Comm(MPI_COMM_WORLD);
     rank = Comm.MyPID();
#else
     Epetra_SerialComm Comm;
#endif

     typedef double                            ST;
     typedef Teuchos::ScalarTraits<ST>        SCT;
     typedef SCT::magnitudeType                MT;
     typedef Epetra_MultiVector                MV;
     typedef Epetra_Operator                   OP;
     typedef Belos::MultiVecTraits<ST,MV>     MVT;
     typedef Belos::OperatorTraits<ST,MV,OP>  OPT;

     using Teuchos::ParameterList;
     using Teuchos::RCP;
     using Teuchos::rcp;


     RCP<Epetra_Map> Map;//(new Epetra_Map(20, 0, Comm)); // LINK ERROR 
IF CONSTRUCTED WITH new Epetra_Map
     RCP<Epetra_CrsMatrix> A;
     RCP<Epetra_MultiVector> B, X;

     Epetra_Map m(200, 0, Comm); // RUNTIME ERROR

     if (rank == 0)
     {
         std::cout << "Communicator size " << Comm.NumProc() << std::endl;

         int willCrash = 1;

         switch (willCrash)
         {
             case 1:  // CRASH WITH MAP
                 std::cout << "MAP " << rank << " #global " << 
m.NumGlobalElements() << " #local " << m.NumMyElements() << std::endl;
                 break;

             case 2:  // CRASH WITH RCP
                 std::cout << "RCP " << rank << " #global " << 
Map->NumGlobalElements() << " #local " << Map->NumMyElements() << std::endl;
                 break;

             default: // NO CRASH
                 std::cout << rank << std::endl;
                 break;
         }
     }


#ifdef EPETRA_MPI
     MPI_Finalize();
#endif
     return 0;
}



The error at runtime is the following:

Communicator size 4
MAP 0 #global libc++abi.dylib: terminating with uncaught exception of 
type char const*
[Senseis-MacBook-Pro:00955] *** Process received signal ***
[Senseis-MacBook-Pro:00955] Signal: Abort trap: 6 (6)
[Senseis-MacBook-Pro:00955] Signal code:  (0)
[Senseis-MacBook-Pro:00955] [ 0] 2   libsystem_platform.dylib 
  0x00007fff948f5f1a _sigtramp + 26
[Senseis-MacBook-Pro:00955] [ 1] 3   ??? 
  0x00007fff5fbfe0b8 0x0 + 140734799798456
[Senseis-MacBook-Pro:00955] [ 2] 4   libsystem_c.dylib 
  0x00007fff96b78b53 abort + 129
[Senseis-MacBook-Pro:00955] [ 3] 5   libc++abi.dylib 
  0x00007fff89a51a21 __cxa_bad_cast + 0
[Senseis-MacBook-Pro:00955] [ 4] 6   libc++abi.dylib 
  0x00007fff89a799d1 _ZL26default_unexpected_handlerv + 0
[Senseis-MacBook-Pro:00955] [ 5] 7   libobjc.A.dylib 
  0x00007fff8cea17eb _ZL15_objc_terminatev + 124
[Senseis-MacBook-Pro:00955] [ 6] 8   libc++abi.dylib 
  0x00007fff89a770a1 _ZSt11__terminatePFvvE + 8
[Senseis-MacBook-Pro:00955] [ 7] 9   libc++abi.dylib 
  0x00007fff89a76b30 
_ZN10__cxxabiv1L22exception_cleanup_funcE19_Unwind_Reason_CodeP17_Unwind_Exception 
+ 0
[Senseis-MacBook-Pro:00955] [ 8] 10  intervals 
  0x0000000100001e7a _ZNK15Epetra_BlockMap17NumGlobalElementsEv + 106
[Senseis-MacBook-Pro:00955] [ 9] 11  intervals 
  0x000000010000123b main + 635
[Senseis-MacBook-Pro:00955] [10] 12  libdyld.dylib 
  0x00007fff8c55b5c9 start + 1
[Senseis-MacBook-Pro:00955] [11] 13  ??? 
  0x0000000000000001 0x0 + 1
[Senseis-MacBook-Pro:00955] *** End of error message ***
--------------------------------------------------------------------------
orterun noticed that process rank 0 with PID 955 on node 
Senseis-MacBook-Pro.local exited on signal 6 (Abort trap: 6).
--------------------------------------------------------------------------



Why is Epetra_BlockMap::NumGlobalElements crashing? Am I doing something 
really stupid?

Any hint is highly appreciated!


Thanks!












More information about the Trilinos-Users mailing list