示例#1
0
/* Language interface initialization function. */
void C4SNetInit( int id, snet_distrib_t distImpl)
{
	/* set call back function on data */
	SNetReferenceSetDataFunc(AllocatedSpace);

  interface_id = id;
  snet_pack_fun_t packfun = NULL;
  snet_unpack_fun_t unpackfun = NULL;

  switch (distImpl) {
    case nodist:
      break;
    case mpi:
      #ifdef ENABLE_DIST_MPI
        packfun = (void (*)(void*, void*)) &MPIPackFun;
        unpackfun = (void *(*)(void*)) &MPIUnpackFun;
      #else
        SNetUtilDebugFatal("C4SNet supports MPI, but is not configured to use "
                           "it.\n");
      #endif
      break;
    case scc:
      #ifdef ENABLE_DIST_SCC
        MemAlloc = &SCCMalloc;
        MemFree = &SCCFreeWrapper;
        packfun = (void (*)(void*, void*)) &SCCPackFun;
        unpackfun = &SCCUnpackFun;
      #else
        SNetUtilDebugFatal("C4SNet supports SCC, but is not configured to use "
                           "it.\n");
      #endif
      break;
    default:
      SNetUtilDebugFatal("C4SNet doesn't support the selected distribution "
                         "layer (%d).\n", distImpl);
      break;
  }

  SNetInterfaceRegister( id,
                         (void (*)(void*))          &C4SNetFree,
                         (void *(*)(void*))         &C4SNetShallowCopy,
                         (size_t (*)(void*))        &AllocatedSpace,
                         (void (*)(FILE*, void*))   &C4SNetSerialise,
                         (void *(*)(FILE*))         &C4SNetDeserialise,
                         (void (*)(FILE*, void*))   &C4SNetEncode,
                         (void *(*)(FILE*))         &C4SNetDecode,
                         packfun,
                         unpackfun);
}
示例#2
0
void SAC4SNetInit( int id, snet_distrib_t distImpl)
{
  my_interface_id = id;
  snet_pack_fun_t packfun = NULL;
  snet_unpack_fun_t unpackfun = NULL;

  switch (distImpl) {
    case nodist:
      break;
    case mpi:
      #ifdef ENABLE_DIST_MPI
        packfun = &SAC4SNetMPIPackFun;
        unpackfun = &SAC4SNetMPIUnpackFun;
      #else
        SNetUtilDebugFatal("SAC4SNet supports MPI, but is not configured to use "
                           "it.\n");
      #endif
      break;
    case scc:
      #ifdef ENABLE_DIST_SCC
        packfun = &SAC4SNetSCCPackFun;
        unpackfun = &SAC4SNetSCCUnpackFun;
      #else
        SNetUtilDebugFatal("SAC4SNet supports SCC, but is not configured to use "
                           "it.\n");
      #endif
      break;
    default:
      SNetUtilDebugFatal("SAC4SNet doesn't support the selected distribution "
                         "layer (%d).\n", distImpl);
      break;
  }

  SNetInterfaceRegister( id,
                         &SACARGfree,
                         &SACARGcopy,
                         &SAC4SNetAllocSize,
                         &SAC4SNetDataSerialise,
                         &SAC4SNetDataDeserialise,
                         &SAC4SNetDataEncode,
                         &SAC4SNetDataDecode,
                         packfun,
                         unpackfun);
  
  SAC_InitRuntimeSystem();
}