Add bitmask type
[alexxy/gromacs.git] / src / gromacs / mdlib / nbnxn_pairlist.h
index 413af358019c353bd972b3573bb6aad13a163ad5..4558266bc39a2c899a9ad0c763ee9edea58510b8 100644 (file)
@@ -42,6 +42,7 @@
 
 #include "gromacs/legacyheaders/types/nblist.h"
 #include "gromacs/math/vectypes.h"
+#include "gromacs/mdlib/bitmask.h"
 #include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/real.h"
 
@@ -207,21 +208,16 @@ typedef struct {
 #define NBNXN_BUFFERFLAG_SIZE  16
 #endif
 
-/* We currently store the reduction flags as bits in an unsigned int.
- * In most cases this limits the number of flags to 32.
- * The reduction will automatically disable the flagging and do a full
- * reduction when the flags won't fit, but this will lead to very slow
- * reduction. As we anyhow don't expect reasonable performance with
- * more than 32 threads, we put in this hard limit.
- * You can increase this number, but the reduction will be very slow.
+/* We store the reduction flags as gmx_bitmask_t.
+ * This limits the number of flags to BITMASK_SIZE.
  */
-#define NBNXN_BUFFERFLAG_MAX_THREADS  32
+#define NBNXN_BUFFERFLAG_MAX_THREADS  (BITMASK_SIZE)
 
 /* Flags for telling if threads write to force output buffers */
 typedef struct {
-    int           nflag;       /* The number of flag blocks                         */
-    unsigned int *flag;        /* Bit i is set when thread i writes to a cell-block */
-    int           flag_nalloc; /* Allocation size of cxy_flag                       */
+    int               nflag;       /* The number of flag blocks                         */
+    gmx_bitmask_t    *flag;        /* Bit i is set when thread i writes to a cell-block */
+    int               flag_nalloc; /* Allocation size of cxy_flag                       */
 } nbnxn_buffer_flags_t;
 
 /* LJ combination rules: geometric, Lorentz-Berthelot, none */