NAMD
Priorities.h
Go to the documentation of this file.
1 
7 #ifndef PRIORITIES_H
8 #define PRIORITIES_H
9 
10 // pass PRIORITY_SIZE as last argument to new when allocating message
11 // e.g., MyMsg *msg = new (len1, len2, PRIORITY_SIZE) MyMsg;
12 
13 #define PRIORITY_SIZE ((int) sizeof(int)*8)
14 
15 // total priority is sequence + type + patch
16 // always use lowest (most urgent) patch priority applicable
17 
18 #define SET_PRIORITY(MSG,SEQ,PRIO) { \
19  CkSetQueueing(MSG, CK_QUEUEING_IFIFO); \
20  *((int*) CkPriorityPtr(MSG)) = (((SEQ)&0xffff)<<15) + (PRIO); }
21 // sequence priority is 16 bits shifted by 15 to leave sign bit 0
22 
23 // patch priorities in range [1,252]
24 // reserve 0 for tuples, use prime to randomize neighbors
25 #define PATCH_PRIORITY(PID) (((PID)%251)+1)
26 
27 // the following are in order of decreasing urgency
28 
29 #define PME_PRIORITY (2<<8)
30 #define PME_GRID_PRIORITY (PME_PRIORITY+1)
31 #define PME_TRANS_PRIORITY (PME_PRIORITY+2)
32 #define PME_TRANS2_PRIORITY (PME_PRIORITY+3)
33 #define PME_UNTRANS_PRIORITY (PME_PRIORITY+4)
34 #define PME_UNTRANS2_PRIORITY (PME_PRIORITY+5)
35 
36 #define MSM_PRIORITY PME_PRIORITY
37 
38 #if defined(NAMD_CUDA) || defined(NAMD_HIP) || defined(NAMD_MIC)
39 // higher priority so offloaded work can overlap
40 #define PROXY_DATA_PRIORITY (1<<8)
41 #define PME_OFFLOAD_PRIORITY 0
42 #define PME_OFFLOAD_UNGRID_PRIORITY (3<<8)
43 #else
44 #define PROXY_DATA_PRIORITY (3<<8)
45 #endif
46 
47 //used in HomePatch::positionsReady
48 //gbis positions distributed with normal PROXY_DATA_PRIORITY
49 //compute priorities are inited in ComputePatch* and added in Compute.C
50 
51 //use in Compute::patchReady DONE
52 #define GB1_COMPUTE_PROXY_PRIORITY (4<<8)
53 //use in ProxyPatch::boxClosed DONE
54 #define GB1_PROXY_RESULTS_PRIORITY (5<<8)
55 //use in Compute::patchReady DONE
56 #define GB1_COMPUTE_HOME_PRIORITY (6<<8)
57 //used in HomePatch::gbisP2Ready DONE
58 #define GB2_PROXY_DATA_PRIORITY (7<<8)
59 //use in Compute::gbisP2PatchReady DONE
60 #define GB2_COMPUTE_PROXY_PRIORITY (8<<8)
61 //use in ProxyPatch::boxClosed DONE
62 #define GB2_PROXY_RESULTS_PRIORITY (9<<8)
63 //use in Compute::patchReady DONE
64 #define GB2_COMPUTE_HOME_PRIORITY (10<<8)
65 //used in HomePatch::gbisP3Ready DONE
66 #define GB3_PROXY_DATA_PRIORITY (11<<8)
67 
68 
69 // from here on GB computes use normal compute priorities
70 //use in Compute::gbisP3PatchReady DONE
71 #define COMPUTE_PROXY_PRIORITY (12<<8)
72 //use in ProxyPatch::send
73 #define PROXY_RESULTS_PRIORITY (13<<8) // DONE
74 #define PME_UNGRID_PRIORITY (14<<8)
75 //use in Compute::patchReady DONE
76 #define COMPUTE_HOME_PRIORITY (15<<8)
77 //end gbis
78 
79 #endif // PRIORITIES_H
80