Unverified Commit 605524ab authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1406 from akohlmey/fix-some-64-bit-integer-issues

Fix some 64 bit integer issues
parents 968ac3d8 50427ce0
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -637,14 +637,14 @@ void FixPIMD::comm_exec(double **ptr)
    if(nsend > max_nsend)
    {
      max_nsend = nsend+200;
      tag_send = (int*) memory->srealloc(tag_send, sizeof(int)*max_nsend, "FixPIMD:tag_send");
      tag_send = (tagint*) memory->srealloc(tag_send, sizeof(tagint)*max_nsend, "FixPIMD:tag_send");
      buf_send = (double*) memory->srealloc(buf_send, sizeof(double)*max_nsend*3, "FixPIMD:x_send");
    }

    // send tags

    MPI_Sendrecv( atom->tag, nlocal, MPI_INT, plan_send[iplan], 0,
                  tag_send,  nsend,  MPI_INT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE);
    MPI_Sendrecv( atom->tag, nlocal, MPI_LMP_TAGINT, plan_send[iplan], 0,
                  tag_send,  nsend,  MPI_LMP_TAGINT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE);

    // wrap positions

+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ class FixPIMD : public Fix {
  /* inter-partition communication */

  int max_nsend;
  int* tag_send;
  tagint* tag_send;
  double *buf_send;

  int max_nlocal;
+21 −11
Original line number Diff line number Diff line
@@ -23,6 +23,16 @@
# endif
#endif

// declaration to indicate intended fallthrough cases in switch statements
// and thus silence the warnings produced by g++ -Wextra

#if defined(__GNUC__)
#define _fallthrough  __attribute__ ((fallthrough))
#else
#define _fallthrough
#endif


#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))

/*
@@ -291,17 +301,17 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
    /*-------------------------------- last block: affect all 32 bits of (c) */
    switch(length)                   /* all the case statements fall through */
    {
    case 12: c+=((uint32_t)k[11])<<24;
    case 11: c+=((uint32_t)k[10])<<16;
    case 10: c+=((uint32_t)k[9])<<8;
    case 9 : c+=k[8];
    case 8 : b+=((uint32_t)k[7])<<24;
    case 7 : b+=((uint32_t)k[6])<<16;
    case 6 : b+=((uint32_t)k[5])<<8;
    case 5 : b+=k[4];
    case 4 : a+=((uint32_t)k[3])<<24;
    case 3 : a+=((uint32_t)k[2])<<16;
    case 2 : a+=((uint32_t)k[1])<<8;
    case 12: c+=((uint32_t)k[11])<<24; _fallthrough;
    case 11: c+=((uint32_t)k[10])<<16; _fallthrough;
    case 10: c+=((uint32_t)k[9])<<8;   _fallthrough;
    case 9 : c+=k[8];                  _fallthrough;
    case 8 : b+=((uint32_t)k[7])<<24;  _fallthrough;
    case 7 : b+=((uint32_t)k[6])<<16;  _fallthrough;
    case 6 : b+=((uint32_t)k[5])<<8;   _fallthrough;
    case 5 : b+=k[4];                  _fallthrough;
    case 4 : a+=((uint32_t)k[3])<<24;  _fallthrough;
    case 3 : a+=((uint32_t)k[2])<<16;  _fallthrough;
    case 2 : a+=((uint32_t)k[1])<<8;   _fallthrough;
    case 1 : a+=k[0];
             break;
    case 0 : return c;
+1 −8
Original line number Diff line number Diff line
@@ -921,7 +921,7 @@ void Irregular::exchange_data(char *sendbuf, int nbytes, char *recvbuf)

  // post all receives, starting after self copies

  bigint offset = num_self*nbytes;
  bigint offset = num_self*(bigint)nbytes;
  for (int irecv = 0; irecv < nrecv_proc; irecv++) {
    MPI_Irecv(&recvbuf[offset],num_recv[irecv]*nbytes,MPI_CHAR,
              proc_recv[irecv],0,world,&request[irecv]);
@@ -964,13 +964,6 @@ void Irregular::exchange_data(char *sendbuf, int nbytes, char *recvbuf)
  // wait on all incoming messages

  if (nrecv_proc) MPI_Waitall(nrecv_proc,request,status);

  // approximate memory tally
  // DEBUG lines

  //bigint irregular_bytes = 2*nprocs*sizeof(int);
  //irregular_bytes += maxindex*sizeof(int);
  //irregular_bytes += maxbuf;
}

/* ----------------------------------------------------------------------
+117 −104
Original line number Diff line number Diff line
@@ -821,6 +821,7 @@ void Special::angle_trim()

    int nsend = 0;
    for (i = 0; i < nlocal; i++) {
      if (num_angle) {
        for (j = 0; j < num_angle[i]; j++) {
          if (tag[i] != angle_atom2[i][j]) continue;
          m = atom->map(angle_atom1[i][j]);
@@ -828,6 +829,9 @@ void Special::angle_trim()
          m = atom->map(angle_atom3[i][j]);
          if (m < 0 || m >= nlocal) nsend++;
        }
      }

      if (num_dihedral) {
        for (j = 0; j < num_dihedral[i]; j++) {
          if (tag[i] != dihedral_atom2[i][j]) continue;
          m = atom->map(dihedral_atom1[i][j]);
@@ -838,6 +842,7 @@ void Special::angle_trim()
          if (m < 0 || m >= nlocal) nsend++;
        }
      }
    }

    int *proclist;
    memory->create(proclist,nsend,"special:proclist");
@@ -852,6 +857,7 @@ void Special::angle_trim()

    nsend = 0;
    for (i = 0; i < nlocal; i++) {
      if (num_angle) {
        for (j = 0; j < num_angle[i]; j++) {
          if (tag[i] != angle_atom2[i][j]) continue;

@@ -871,7 +877,9 @@ void Special::angle_trim()
            nsend++;
          }
        }
      }

      if (num_dihedral) {
        for (j = 0; j < num_dihedral[i]; j++) {
          if (tag[i] != dihedral_atom2[i][j]) continue;

@@ -900,6 +908,7 @@ void Special::angle_trim()
          }
        }
      }
    }

    // perform rendezvous operation

@@ -932,6 +941,7 @@ void Special::angle_trim()
    // output datums = pairs of atoms that are 1-3 neighbors

    for (i = 0; i < nlocal; i++) {
      if (num_angle) {
        for (j = 0; j < num_angle[i]; j++) {
          if (tag[i] != angle_atom2[i][j]) continue;

@@ -953,7 +963,9 @@ void Special::angle_trim()
              }
          }
        }
      }

      if (num_dihedral) {
        for (j = 0; j < num_dihedral[i]; j++) {
          if (tag[i] != dihedral_atom2[i][j]) continue;

@@ -985,6 +997,7 @@ void Special::angle_trim()
          }
        }
      }
    }

    for (m = 0; m < nreturn; m++) {
      i = atom->map(outbuf[m].atomID);