Example #1
0
void
CreateDistribution (cluster_type cluster, model_type model)
{
    particle *particle_array;
    int global_num_particles;
    particle *new_particle;
    char particle_state[RANDOM_SIZE];
    real charge;
    real r_scale;
    real v_scale;
    vector r_sum;
    vector v_sum;
    int end_limit;
    int i;
    int j;
    real temp_r;
    real radius;
    real x_vel;
    real y_vel;
    real vel;
    real offset;
    particle *twin_particle;

    particle_array = (particle *) G_MALLOC(Total_Particles * sizeof(particle));

    Particle_List = (particle **) G_MALLOC(Total_Particles * sizeof(particle *));
    for (i = 0; i < Total_Particles; i++)
        Particle_List[i] = &particle_array[i];

    r_scale = 3 * M_PI / 16;
    v_scale = (real) sqrt(1.0 / (double) r_scale);
    r_sum.x = (real) 0.0;
    r_sum.y = (real) 0.0;
    v_sum.x = (real) 0.0;
    v_sum.y = (real) 0.0;
    initstate(0, particle_state, RANDOM_SIZE);

    switch (cluster) {
    case ONE_CLUSTER:
        end_limit = Total_Particles;
        switch (model) {
        case UNIFORM:
            printf("Creating a one cluster, uniform distribution for %d ",
                   Total_Particles);
            printf("particles\n");
            break;
        case PLUMMER:
            printf("Creating a one cluster, non uniform distribution for %d ",
                   Total_Particles);
            printf("particles\n");
            break;
        }
        break;
    case TWO_CLUSTER:
        end_limit = (Total_Particles / 2) + (Total_Particles & 0x1);
        switch (model) {
        case UNIFORM:
            printf("Creating a two cluster, uniform distribution for %d ",
                   Total_Particles);
            printf("particles\n");
            break;
        case PLUMMER:
            printf("Creating a two cluster, non uniform distribution for %d ",
                   Total_Particles);
            printf("particles\n");
            break;
        }
        break;
    }
    setstate(particle_state);
    global_num_particles = 0;
    charge = 1.0 / Total_Particles;
    charge /= Total_Particles;
    for (i = 0; i < end_limit; i++) {
        new_particle = InitParticle(charge, charge);
        switch (model) {
        case UNIFORM:
            do {
                new_particle->pos.x = XRand(-1.0, 1.0);
                new_particle->pos.y = XRand(-1.0, 1.0);
                temp_r = DOT_PRODUCT((new_particle->pos), (new_particle->pos));
            }
            while (temp_r > (real) 1.0);
            radius = sqrt(temp_r);
            break;
        case PLUMMER:
            do
                radius = (real) 1.0 / (real) sqrt(pow(XRand(0.0, MAX_FRAC),
                                                      -2.0/3.0) - 1);
            while (radius > 9.0);
            PickShell(&(new_particle->pos), r_scale * radius);
            break;
        }
        VECTOR_ADD(r_sum, r_sum, (new_particle->pos));

        do {
            x_vel = XRand(0.0, 1.0);
            y_vel = XRand(0.0, 0.1);
        }
        while (y_vel > x_vel * x_vel * (real) pow(1.0 - (x_vel * x_vel), 3.5));
        vel = (real) sqrt(2.0) * x_vel / pow(1.0 + (radius * radius), 0.25);
        PickShell(&(new_particle->vel), v_scale * vel);
        VECTOR_ADD(v_sum, v_sum, (new_particle->vel));
    }

    if (cluster == TWO_CLUSTER) {
        switch (model) {
        case UNIFORM:
            offset = 1.5;
            break;
        case PLUMMER:
            offset = 2.0;
            break;
        }
        for (i = end_limit; i < Total_Particles; i++) {
            new_particle = InitParticle(charge, charge);
            twin_particle = Particle_List[i - end_limit];
            new_particle->pos.x = twin_particle->pos.x + offset;
            new_particle->pos.y = twin_particle->pos.y + offset;
            VECTOR_ADD(r_sum, r_sum, (new_particle->pos));
            new_particle->vel.x = twin_particle->vel.x;
            new_particle->vel.y = twin_particle->vel.y;
            VECTOR_ADD(v_sum, v_sum, (new_particle->vel));
        }
    }

    VECTOR_DIV(r_sum, r_sum, (real) Total_Particles);
    VECTOR_DIV(v_sum, v_sum, (real) Total_Particles);
    for (i = 0; i < Total_Particles; i++) {
        new_particle = Particle_List[i];
        VECTOR_SUB((new_particle->pos), (new_particle->pos), r_sum);
        VECTOR_SUB((new_particle->vel), (new_particle->vel), v_sum);
    }
}
Example #2
0
void intercom_handle_claim(struct l3ctx *ctx, intercom_packet_claim *packet) {
  struct timespec now;
  clock_gettime(CLOCK_MONOTONIC, &now);

  struct client client = {
    .ours = false,
    .lastseen = (struct timespec) {
      .tv_sec = now.tv_sec - packet->lastseen,
      .tv_nsec = 0
    }
  };

  struct in6_addr sender;

  memcpy(&sender.s6_addr, &packet->sender, sizeof(uint8_t) * 16);
  memcpy(client.mac, &packet->mac, sizeof(uint8_t) * 6);

  struct client_ip ip;

  intercom_packet_claim_entry *entry = (intercom_packet_claim_entry*)((uint8_t*)(packet) +  sizeof(intercom_packet_claim));

  for (int i = 0; i < packet->num_addresses; i++) {
    memcpy(&ip.address.s6_addr, &entry->address, sizeof(uint8_t) * 16);

    ip.lastseen = (struct timespec) {
      .tv_sec = now.tv_sec - entry->lastseen,
      .tv_nsec = 0,
    };

    VECTOR_ADD(client.addresses, ip);

    entry++;
  }

  clientmgr_handle_claim(&ctx->clientmgr_ctx, ctx, &client, &sender);
}

void intercom_handle_packet(intercom_ctx *ctx, struct l3ctx *l3ctx, uint8_t *packet, ssize_t packet_len) {
  intercom_packet_hdr *hdr = (intercom_packet_hdr*) packet;

  printf("Packet nonce %u -> ", hdr->nonce);

  if (intercom_recently_seen(ctx, hdr)) {
    printf("dropped\n");
    return;
  }
  printf("accepted\n");

  intercom_recently_seen_add(ctx, hdr);

  if (hdr->type == INTERCOM_SEEK)
    intercom_handle_seek(l3ctx, (intercom_packet_seek*)packet);

  if (hdr->type == INTERCOM_CLAIM)
    intercom_handle_claim(l3ctx, (intercom_packet_claim*)packet);

  hdr->ttl--;

  if (hdr->ttl > 0) {
    printf("intercom: forwarding packet\n");
    intercom_send_packet(ctx, packet, packet_len);
  }
}
Example #3
0
void intercom_add_interface(intercom_ctx *ctx, char *ifname) {
  if (intercom_has_ifname(ctx, ifname))
    return;

  intercom_if iface = {
    .ok = false,
    .ifname = ifname
  };

  VECTOR_ADD(ctx->interfaces, iface);

  intercom_update_interfaces(ctx);
}

void intercom_init(intercom_ctx *ctx) {

  struct in6_addr mgroup_addr;
  inet_pton(AF_INET6, INTERCOM_GROUP, &mgroup_addr); // TODO Fehler abfangen

  ctx->groupaddr = (struct sockaddr_in6) {
    .sin6_family = AF_INET6,
    .sin6_addr = mgroup_addr,
    .sin6_port = htons(INTERCOM_PORT),
  };

  ctx->fd = socket(PF_INET6, SOCK_DGRAM | SOCK_NONBLOCK, 0);

  if (ctx->fd < 0)
    exit_error("creating socket");

  struct sockaddr_in6 server_addr = {};

  server_addr.sin6_family = AF_INET6;
  server_addr.sin6_addr = in6addr_any;
  server_addr.sin6_port = htons(INTERCOM_PORT);

  if (bind(ctx->fd, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
    perror("bind failed");
    exit(EXIT_FAILURE);
  }
}

void intercom_seek(intercom_ctx *ctx, const struct in6_addr *address) {
  intercom_packet_seek packet;

  uint32_t nonce = rand();

  packet.hdr = (intercom_packet_hdr) {
    .type = INTERCOM_SEEK,
    .nonce = nonce,
    .ttl = 255,
  };

  memcpy(&packet.address, address, 16);

  intercom_recently_seen_add(ctx, &packet.hdr);

  intercom_send_packet(ctx, (uint8_t*)&packet, sizeof(packet));
}

void intercom_send_packet(intercom_ctx *ctx, uint8_t *packet, ssize_t packet_len) {
  for (int i = 0; i < VECTOR_LEN(ctx->interfaces); i++) {
    intercom_if *iface = &VECTOR_INDEX(ctx->interfaces, i);

    if (!iface->ok)
      continue;

    struct sockaddr_in6 groupaddr = ctx->groupaddr;

    groupaddr.sin6_scope_id = iface->ifindex;

    printf("intercom send %i %zi\n", iface->ifindex, packet_len);
    ssize_t rc = sendto(ctx->fd, packet, packet_len, 0, &groupaddr, sizeof(groupaddr));

    if (rc < 0)
      iface->ok = false;
  }
}

bool intercom_recently_seen(intercom_ctx *ctx, intercom_packet_hdr *hdr) {
  for (int i = 0; i < VECTOR_LEN(ctx->recent_packets); i++) {
    intercom_packet_hdr *ref_hdr = &VECTOR_INDEX(ctx->recent_packets, i);

    if (ref_hdr->nonce == hdr->nonce && ref_hdr->type == hdr->type)
        return true;
  }
  return false;
}

void intercom_recently_seen_add(intercom_ctx *ctx, intercom_packet_hdr *hdr) {
  if (VECTOR_LEN(ctx->recent_packets) > INTERCOM_MAX_RECENT)
    VECTOR_DELETE(ctx->recent_packets, 0);

  VECTOR_ADD(ctx->recent_packets, *hdr);
}

void intercom_handle_seek(struct l3ctx *ctx, intercom_packet_seek *packet) {
  icmp6_send_solicitation(ctx, (const struct in6_addr *)packet->address);
}
bool CDecoder_OMS_fixed_NEON16_v3::decode_8bits(signed char Intrinsic_fix[], signed char Rprime_fix[], int nombre_iterations)
{
    ////////////////////////////////////////////////////////////////////////////
    //
    // Initilisation des espaces memoire
    //
//    for (int i=0; i<MESSAGE; i++){
//        var_mesgs[i] = VECTOR_ZERO;
//    }
    //
    ////////////////////////////////////////////////////////////////////////////


    ////////////////////////////////////////////////////////////////////////////
    //
    // ENTRELACEMENT DES DONNEES D'ENTREE POUR POUVOIR EXPLOITER LE MODE SIMD
    //
    if( NOEUD%16 == 0  ){
        uchar_transpose_neon((trans_TYPE*)Intrinsic_fix, (trans_TYPE*)var_nodes, NOEUD);
    }else{
        signed char* ptrVar = (signed char*) var_nodes;
        for (int i=0; i<NOEUD; i++){
            for (int z=0; z<16; z++){
                ptrVar[16 * i + z] = Intrinsic_fix[z * NOEUD + i];
            }
        }
    }
    //
    ////////////////////////////////////////////////////////////////////////////


    nombre_iterations--;
    if( 1 )
    {
        TYPE *p_msg1w                         = var_mesgs;
        const unsigned short *p_indice_nod1   = PosNoeudsVariable;
        const unsigned short *p_indice_nod2   = PosNoeudsVariable;

        //const TYPE min_var = VECTOR_SET1( -127 );
        const TYPE max_msg = VECTOR_SET1(   31 );

#if NB_DEGRES >= 1
        for (int i=0; i<DEG_1_COMPUTATIONS; i++){

            TYPE tab_vContr[DEG_1];
            TYPE sign = VECTOR_ZERO;
            TYPE min1 = VECTOR_SET1(vSAT_POS_VAR);
            TYPE min2 = min1;

#ifdef _PREFETCH_
            __builtin_prefetch (p_indice_nod1 + DEG_1, 0, 3);
#endif
            for(int j=0; j<DEG_1; j++){
                TYPE vContr = VECTOR_LOAD(&var_nodes[(*p_indice_nod1)]);
//#ifdef _PREFETCH_
//                if( (j & 0x01) == 0 ) __builtin_prefetch (p_msg1r+DEG_1, 0, 0);
//#endif
                TYPE cSign  = VECTOR_GET_SIGN_BIT(vContr);
                sign        = VECTOR_XOR(sign, cSign);
                TYPE vAbs   = VECTOR_ABS( vContr );
                tab_vContr[j] = vContr;
                TYPE vTemp = min1;
                min1       = VECTOR_MIN_1(vAbs, min1);
                min2       = VECTOR_MIN_2(vAbs, vTemp, min2);
                p_indice_nod1 += 1;
            }
#ifdef _PREFETCH_
            for(int j=0; j<DEG_1; j++){
                __builtin_prefetch (&var_nodes[p_indice_nod1[j]], 0, 3);
            }
#endif
            TYPE cste_1   = VECTOR_MIN( VECTOR_SBU(min2, VECTOR_SET1(offset)), max_msg);
            TYPE cste_2   = VECTOR_MIN( VECTOR_SBU(min1, VECTOR_SET1(offset)), max_msg);

            for(int j=0 ; j<DEG_1 ; j++) {
                    TYPE vContr = tab_vContr[j];
                    TYPE vAbs   = VECTOR_ABS    (vContr);
                    TYPE vRes   = VECTOR_CMOV   (vAbs, min1, cste_1, cste_2);
                    vRes        = VECTOR_MIN(vRes, max_msg); // BLG
                    TYPE vSig   = VECTOR_XOR    (sign, VECTOR_GET_SIGN_BIT(vContr));
                    TYPE v2St   = VECTOR_invSIGN2(vRes, vSig);
                    TYPE v2Sr   = VECTOR_ADD(vContr, v2St);
                    VECTOR_STORE( p_msg1w,                      v2St);
                    VECTOR_STORE( &var_nodes[(*p_indice_nod2)], v2Sr);
                    p_msg1w        += 1;
                    p_indice_nod2  += 1;
            }
        }
#endif
/////////////////////////////////////////////////////////////////////////////////
#if NB_DEGRES >= 2
        for (int i=0; i<DEG_2_COMPUTATIONS; i++){

            TYPE tab_vContr[DEG_2];
            TYPE sign = VECTOR_ZERO;
            TYPE min1 = VECTOR_SET1(vSAT_POS_VAR);
            TYPE min2 = min1;

#ifdef _PREFETCH_
            __builtin_prefetch (p_indice_nod1 + DEG_2, 0, 3);
#endif
            for(int j=0; j<DEG_2; j++){
                TYPE vContr = VECTOR_LOAD(&var_nodes[(*p_indice_nod1)]);
//#ifdef _PREFETCH_
//                if( (j & 0x01) == 0 ) __builtin_prefetch (p_msg1r+DEG_2, 0, 0);
//#endif
                TYPE cSign     = VECTOR_GET_SIGN_BIT(vContr);
                sign           = VECTOR_XOR(sign, cSign);
                TYPE vAbs      = VECTOR_ABS( vContr );
                tab_vContr[j]  = vContr;
                TYPE vTemp     = min1;
                min1           = VECTOR_MIN_1(vAbs, min1);
                min2           = VECTOR_MIN_2(vAbs, vTemp, min2);
                p_indice_nod1 += 1;
            }
#ifdef _PREFETCH_
            for(int j=0; j<DEG_2; j++){
                __builtin_prefetch (&var_nodes[p_indice_nod1[j]], 0, 3);
            }
#endif
            TYPE cste_1   = VECTOR_MIN( VECTOR_SBU(min2, VECTOR_SET1(offset)), max_msg);
            TYPE cste_2   = VECTOR_MIN( VECTOR_SBU(min1, VECTOR_SET1(offset)), max_msg);

            for(int j=0 ; j<DEG_2 ; j++) {
                    TYPE vContr = tab_vContr[j];
                    TYPE vAbs   = VECTOR_ABS    (vContr);
                    TYPE vRes   = VECTOR_CMOV   (vAbs, min1, cste_1, cste_2);
                    vRes        = VECTOR_MIN(vRes, max_msg); // BLG
                    TYPE vSig   = VECTOR_XOR    (sign, VECTOR_GET_SIGN_BIT(vContr));
                    TYPE v2St   = VECTOR_invSIGN2(vRes, vSig);
                    TYPE v2Sr   = VECTOR_ADD(vContr, v2St);
                    VECTOR_STORE( p_msg1w,                      v2St);
                    VECTOR_STORE( &var_nodes[(*p_indice_nod2)], v2Sr);
                    p_msg1w        += 1;
                    p_indice_nod2  += 1;
            }
        }
#endif
/////////////////////////////////////////////////////////////////////////////////
#if NB_DEGRES > 2
    printf("The number of DEGREE(Cn) IS HIGHER THAN 5. YOU NEED TO PERFORM A COPY PASTE IN SOURCE CODE...\n");
    exit( 0 );
#endif
    }


    //
    //
    // ON REPREND LE TRAITEMENT NORMAL DE L'INFORMATION
    //
    //
    while (nombre_iterations-- != 1) {
        TYPE *p_msg1r                      = var_mesgs;
        TYPE *p_msg1w                      = var_mesgs;
        const unsigned short *p_indice_nod1   = PosNoeudsVariable;
        const unsigned short *p_indice_nod2   = PosNoeudsVariable;

//        const TYPE min_var = VECTOR_SET1( -127 );
        const TYPE max_msg = VECTOR_SET1(   31 );

#if NB_DEGRES >= 1
        for (int i=0; i<DEG_1_COMPUTATIONS; i++){

            TYPE tab_vContr[DEG_1];
            TYPE sign = VECTOR_ZERO;
            TYPE min1 = VECTOR_SET1(vSAT_POS_VAR);
            TYPE min2 = min1;

#ifdef _PREFETCH_
            __builtin_prefetch (p_indice_nod1 + DEG_1, 0, 3);
#endif
            for(int j=0; j<DEG_1; j++){
                TYPE vNoeud = VECTOR_LOAD(&var_nodes[(*p_indice_nod1)]);
                TYPE vMessg = VECTOR_LOAD(p_msg1r);
#ifdef _PREFETCH_
                if( (j & 0x01) == 0 ) __builtin_prefetch (p_msg1r+DEG_1, 0, 0);
#endif
                TYPE vContr = VECTOR_SUB(vNoeud, vMessg);
                TYPE cSign  = VECTOR_GET_SIGN_BIT(vContr);
                sign        = VECTOR_XOR(sign, cSign);
                TYPE vAbs   = VECTOR_ABS( vContr );
                tab_vContr[j] = vContr;
                TYPE vTemp = min1;
                min1       = VECTOR_MIN_1(vAbs, min1);
                min2       = VECTOR_MIN_2(vAbs, vTemp, min2);
                p_indice_nod1 += 1;
                p_msg1r       += 1;
            }
#ifdef _PREFETCH_
            for(int j=0; j<DEG_1; j++){
                __builtin_prefetch (&var_nodes[p_indice_nod1[j]], 0, 3);
            }
#endif
            TYPE cste_1   = VECTOR_MIN( VECTOR_SBU(min2, VECTOR_SET1(offset)), max_msg);
            TYPE cste_2   = VECTOR_MIN( VECTOR_SBU(min1, VECTOR_SET1(offset)), max_msg);

            for(int j=0 ; j<DEG_1 ; j++) {
                    TYPE vContr = tab_vContr[j];
                    TYPE vAbs   = VECTOR_ABS    (vContr);
                    TYPE vRes   = VECTOR_CMOV   (vAbs, min1, cste_1, cste_2);
                    vRes        = VECTOR_MIN(vRes, max_msg); // BLG
                    TYPE vSig   = VECTOR_XOR    (sign, VECTOR_GET_SIGN_BIT(vContr));
                    TYPE v2St   = VECTOR_invSIGN2(vRes, vSig);
                    TYPE v2Sr   = VECTOR_ADD(vContr, v2St);
                    VECTOR_STORE( p_msg1w,                      v2St);
                    VECTOR_STORE( &var_nodes[(*p_indice_nod2)], v2Sr);
                    p_msg1w        += 1;
                    p_indice_nod2  += 1;
            }
        }
#endif
/////////////////////////////////////////////////////////////////////////////////
#if NB_DEGRES >= 2
        for (int i=0; i<DEG_2_COMPUTATIONS; i++){

            TYPE tab_vContr[DEG_2];
            TYPE sign = VECTOR_ZERO;
            TYPE min1 = VECTOR_SET1(vSAT_POS_VAR);
            TYPE min2 = min1;

#ifdef _PREFETCH_
            __builtin_prefetch (p_indice_nod1 + DEG_2, 0, 3);
#endif
            for(int j=0; j<DEG_2; j++){
                TYPE vNoeud = VECTOR_LOAD(&var_nodes[(*p_indice_nod1)]);
                TYPE vMessg = VECTOR_LOAD(p_msg1r);
#ifdef _PREFETCH_
                if( (j & 0x01) == 0 ) __builtin_prefetch (p_msg1r+DEG_2, 0, 0);
#endif
                TYPE vContr = VECTOR_SUB(vNoeud, vMessg);
                TYPE cSign  = VECTOR_GET_SIGN_BIT(vContr);
                sign        = VECTOR_XOR(sign, cSign);
                TYPE vAbs   = VECTOR_ABS( vContr );
                tab_vContr[j] = vContr;
                TYPE vTemp = min1;
                min1       = VECTOR_MIN_1(vAbs, min1);
                min2       = VECTOR_MIN_2(vAbs, vTemp, min2);
                p_indice_nod1 += 1;
                p_msg1r       += 1;
            }
#ifdef _PREFETCH_
            for(int j=0; j<DEG_2; j++){
                __builtin_prefetch (&var_nodes[p_indice_nod1[j]], 0, 3);
            }
#endif
            TYPE cste_1   = VECTOR_MIN( VECTOR_SBU(min2, VECTOR_SET1(offset)), max_msg);
            TYPE cste_2   = VECTOR_MIN( VECTOR_SBU(min1, VECTOR_SET1(offset)), max_msg);

            for(int j=0 ; j<DEG_2 ; j++) {
                    TYPE vContr = tab_vContr[j];
                    TYPE vAbs   = VECTOR_ABS    (vContr);
                    TYPE vRes   = VECTOR_CMOV   (vAbs, min1, cste_1, cste_2);
                    vRes        = VECTOR_MIN(vRes, max_msg); // BLG
                    TYPE vSig   = VECTOR_XOR    (sign, VECTOR_GET_SIGN_BIT(vContr));
                    TYPE v2St   = VECTOR_invSIGN2(vRes, vSig);
                    TYPE v2Sr   = VECTOR_ADD(vContr, v2St);
                    VECTOR_STORE( p_msg1w,                      v2St);
                    VECTOR_STORE( &var_nodes[(*p_indice_nod2)], v2Sr);
                    p_msg1w        += 1;
                    p_indice_nod2  += 1;
            }
        }
#endif
/////////////////////////////////////////////////////////////////////////////////
#if NB_DEGRES > 2
    printf("The number of DEGREE(Cn) IS HIGHER THAN 5. YOU NEED TO PERFORM A COPY PASTE IN SOURCE CODE...\n");
    exit( 0 );
#endif
    }

    {
        TYPE *p_msg1r                      = var_mesgs;
        const unsigned short *p_indice_nod1   = PosNoeudsVariable;
        const unsigned short *p_indice_nod2   = PosNoeudsVariable;

//        const TYPE min_var = VECTOR_SET1( -127 );
        const TYPE max_msg = VECTOR_SET1(   31 );

#if NB_DEGRES >= 1
        for (int i=0; i<DEG_1_COMPUTATIONS; i++){

            TYPE tab_vContr[DEG_1];
            TYPE sign = VECTOR_ZERO;
            TYPE min1 = VECTOR_SET1(vSAT_POS_VAR);
            TYPE min2 = min1;

#ifdef _PREFETCH_
            __builtin_prefetch (p_indice_nod1 + DEG_1, 0, 3);
#endif
            for(int j=0; j<DEG_1; j++){
                TYPE vNoeud = VECTOR_LOAD(&var_nodes[(*p_indice_nod1)]);
                TYPE vMessg = VECTOR_LOAD(p_msg1r);
#ifdef _PREFETCH_
                if( (j & 0x01) == 0 ) __builtin_prefetch (p_msg1r+DEG_1, 0, 0);
#endif
                TYPE vContr = VECTOR_SUB(vNoeud, vMessg);
                TYPE cSign  = VECTOR_GET_SIGN_BIT(vContr);
                sign        = VECTOR_XOR(sign, cSign);
                TYPE vAbs   = VECTOR_ABS( vContr );
                tab_vContr[j] = vContr;
                TYPE vTemp = min1;
                min1       = VECTOR_MIN_1(vAbs, min1);
                min2       = VECTOR_MIN_2(vAbs, vTemp, min2);
                p_indice_nod1 += 1;
                p_msg1r       += 1;
            }
#ifdef _PREFETCH_
            for(int j=0; j<DEG_1; j++){
                __builtin_prefetch (&var_nodes[p_indice_nod1[j]], 0, 3);
            }
#endif
            TYPE cste_1   = VECTOR_MIN( VECTOR_SBU(min2, VECTOR_SET1(offset)), max_msg);
            TYPE cste_2   = VECTOR_MIN( VECTOR_SBU(min1, VECTOR_SET1(offset)), max_msg);

            for(int j=0 ; j<DEG_1 ; j++) {
                    TYPE vContr = tab_vContr[j];
                    TYPE vAbs   = VECTOR_ABS    (vContr);
                    TYPE vRes   = VECTOR_CMOV   (vAbs, min1, cste_1, cste_2);
                    vRes        = VECTOR_MIN(vRes, max_msg); // BLG
                    TYPE vSig   = VECTOR_XOR    (sign, VECTOR_GET_SIGN_BIT(vContr));
                    TYPE v2St   = VECTOR_invSIGN2(vRes, vSig);
                    TYPE v2Sr   = VECTOR_ADD(vContr, v2St);
                    VECTOR_STORE( &var_nodes[(*p_indice_nod2)], v2Sr);
                    p_indice_nod2  += 1;
            }
        }
#endif
/////////////////////////////////////////////////////////////////////////////////
#if NB_DEGRES >= 2
        for (int i=0; i<DEG_2_COMPUTATIONS; i++){

            TYPE tab_vContr[DEG_2];
            TYPE sign = VECTOR_ZERO;
            TYPE min1 = VECTOR_SET1(vSAT_POS_VAR);
            TYPE min2 = min1;

#ifdef _PREFETCH_
            __builtin_prefetch (p_indice_nod1 + DEG_2, 0, 3);
#endif
            for(int j=0; j<DEG_2; j++){
                TYPE vNoeud = VECTOR_LOAD(&var_nodes[(*p_indice_nod1)]);
                TYPE vMessg = VECTOR_LOAD(p_msg1r);
#ifdef _PREFETCH_
                if( (j & 0x01) == 0 ) __builtin_prefetch (p_msg1r+DEG_2, 0, 0);
#endif
                TYPE vContr = VECTOR_SUB(vNoeud, vMessg);
                TYPE cSign  = VECTOR_GET_SIGN_BIT(vContr);
                sign        = VECTOR_XOR(sign, cSign);
                TYPE vAbs   = VECTOR_ABS( vContr );
                tab_vContr[j] = vContr;
                TYPE vTemp = min1;
                min1       = VECTOR_MIN_1(vAbs, min1);
                min2       = VECTOR_MIN_2(vAbs, vTemp, min2);
                p_indice_nod1 += 1;
                p_msg1r       += 1;
            }
#ifdef _PREFETCH_
            for(int j=0; j<DEG_1; j++){
                __builtin_prefetch (&var_nodes[p_indice_nod1[j]], 0, 3);
            }
#endif
            TYPE cste_1   = VECTOR_MIN( VECTOR_SBU(min2, VECTOR_SET1(offset)), max_msg);
            TYPE cste_2   = VECTOR_MIN( VECTOR_SBU(min1, VECTOR_SET1(offset)), max_msg);

            for(int j=0 ; j<DEG_2 ; j++) {
                    TYPE vContr = tab_vContr[j];
                    TYPE vAbs   = VECTOR_ABS    (vContr);
                    TYPE vRes   = VECTOR_CMOV   (vAbs, min1, cste_1, cste_2);
                    vRes        = VECTOR_MIN(vRes, max_msg); // BLG
                    TYPE vSig   = VECTOR_XOR    (sign, VECTOR_GET_SIGN_BIT(vContr));
                    TYPE v2St   = VECTOR_invSIGN2(vRes, vSig);
                    TYPE v2Sr   = VECTOR_ADD(vContr, v2St);
                    VECTOR_STORE( &var_nodes[(*p_indice_nod2)], v2Sr);
                    p_indice_nod2  += 1;
            }
        }
#endif
/////////////////////////////////////////////////////////////////////////////////
#if NB_DEGRES > 2
    printf("The number of DEGREE(Cn) IS HIGHER THAN 5. YOU NEED TO PERFORM A COPY PASTE IN SOURCE CODE...\n");
    exit( 0 );
#endif
    }


    ////////////////////////////////////////////////////////////////////////////
    //
    // ON REMET EN FORME LES DONNEES DE SORTIE POUR LA SUITE DU PROCESS
    //
    if( NOEUD%16 == 0  ){
        uchar_itranspose_neon((trans_TYPE*)var_nodes, (trans_TYPE*)Rprime_fix, NOEUD);
    }else{
        signed char* ptr = (signed char*) var_nodes;
        for (int i=0; i<NOEUD; i+=1){
            for (int j=0; j<16; j+=1){
                Rprime_fix[j*NOEUD +i] = (ptr[16*i+j] > 0);
            }
        }
    }
    //
    ////////////////////////////////////////////////////////////////////////////

    return 0;
}