Permalink
Browse files

enhance parallel statuses in VsgPRTrees

  • Loading branch information...
pigay committed Oct 22, 2013
1 parent 1d71137 commit b58dee6ddf7ff88ed51292c584640bfa2c2c5d2c
@@ -54,9 +54,12 @@ vsgprtree-common
</para>
-@VSG_PARALLEL_SHARED:
-@VSG_PARALLEL_LOCAL:
-@VSG_PARALLEL_REMOTE:
+@VSG_PARALLEL_PRIVATE_LOCAL:
+@VSG_PARALLEL_SHARED_MASK:
+@VSG_PARALLEL_SHARED_LOCAL:
+@VSG_PARALLEL_REMOTE_MASK:
+@VSG_PARALLEL_PRIVATE_REMOTE:
+@VSG_PARALLEL_SHARED_REMOTE:
<!-- ##### MACRO VSG_PARALLEL_STATUS_IS_LOCAL ##### -->
<para>
View
@@ -56,19 +56,25 @@ typedef void (*VsgChildrenOrderFunc) (gpointer key, gint *children,
/**
* VsgParallelStorage:
- * @VSG_PARALLEL_SHARED: data is shared among all processors.
- * @VSG_PARALLEL_LOCAL: data is local to current processor (the default in sequential programs).
- * @VSG_PARALLEL_REMOTE: data is stored on some remote processor.
+ * @VSG_PARALLEL_SHARED_LOCAL: data is shared among several processors,
+ * including current one.
+ * @VSG_PARALLEL_SHARED_REMOTE: data is shared among several processors,
+ * xcluding current one.
+ * @VSG_PARALLEL_PRIVATE_LOCAL: data is local to current processor (the default in sequential programs).
+ * @VSG_PARALLEL_PRIVATE_REMOTE: data is stored on some remote processor.
*
* Parallel storage of some data: shared between all processors, local
* to only one processor or stored on some remote processor.
*
* In a non parallel program, data is supposed to be %VSG_PARALLEL_LOCAL.
*/
typedef enum {
- VSG_PARALLEL_SHARED,
- VSG_PARALLEL_LOCAL,
- VSG_PARALLEL_REMOTE
+ VSG_PARALLEL_PRIVATE_LOCAL = 0,
+ VSG_PARALLEL_SHARED_MASK = 1 << 0,
+ VSG_PARALLEL_SHARED_LOCAL = VSG_PARALLEL_SHARED_MASK,
+ VSG_PARALLEL_REMOTE_MASK = 1 << 1,
+ VSG_PARALLEL_PRIVATE_REMOTE = VSG_PARALLEL_REMOTE_MASK,
+ VSG_PARALLEL_SHARED_REMOTE = VSG_PARALLEL_SHARED_MASK | VSG_PARALLEL_REMOTE_MASK,
} VsgParallelStorage;
/**
@@ -87,22 +93,22 @@ struct _VsgParallelStatus {
};
/**
- * vsg_parallel_status_local:
+ * vsg_parallel_status_private_local:
*
- * #VsgParallelStatus constant representing local data.
+ * #VsgParallelStatus constant representing private-local data.
*/
-static const VsgParallelStatus vsg_parallel_status_local = {
- VSG_PARALLEL_LOCAL,
+static const VsgParallelStatus vsg_parallel_status_private_local = {
+ VSG_PARALLEL_PRIVATE_LOCAL,
0,
};
/**
- * vsg_parallel_status_shared:
+ * vsg_parallel_status_shared_local:
*
- * #VsgParallelStatus constant representing shared data.
+ * #VsgParallelStatus constant representing shared-local data.
*/
-static const VsgParallelStatus vsg_parallel_status_shared = {
- VSG_PARALLEL_SHARED,
+static const VsgParallelStatus vsg_parallel_status_shared_local = {
+ VSG_PARALLEL_SHARED_LOCAL,
-1,
};
@@ -114,8 +120,35 @@ static const VsgParallelStatus vsg_parallel_status_shared = {
*
* Returns: #TRUE if @status is equal to #VSG_PARALLEL_REMOTE
*/
-#define VSG_PARALLEL_STATUS_IS_REMOTE(status) ( \
-(status).storage == VSG_PARALLEL_REMOTE \
+#define VSG_PARALLEL_STORAGE_IS_REMOTE(storage) ( \
+(storage) & VSG_PARALLEL_REMOTE_MASK \
+)
+
+#define VSG_PARALLEL_STORAGE_IS_LOCAL(storage) ( \
+! VSG_PARALLEL_STORAGE_IS_REMOTE (storage) \
+)
+
+#define VSG_PARALLEL_STORAGE_IS_SHARED(storage) ( \
+(storage) & VSG_PARALLEL_SHARED_MASK \
+)
+#define VSG_PARALLEL_STORAGE_IS_PRIVATE(storage) ( \
+! VSG_PARALLEL_STORAGE_IS_SHARED (storage) \
+)
+
+#define VSG_PARALLEL_STORAGE_IS_PRIVATE_LOCAL(storage) ( \
+(storage) == VSG_PARALLEL_PRIVATE_LOCAL \
+)
+
+#define VSG_PARALLEL_STORAGE_IS_SHARED_LOCAL(storage) ( \
+(storage) == VSG_PARALLEL_SHARED_LOCAL \
+)
+
+#define VSG_PARALLEL_STORAGE_IS_PRIVATE_REMOTE(storage) ( \
+(storage) == VSG_PARALLEL_PRIVATE_REMOTE \
+)
+
+#define VSG_PARALLEL_STORAGE_IS_SHARED_REMOTE(storage) ( \
+(storage) == VSG_PARALLEL_SHARED_REMOTE \
)
/**
@@ -124,10 +157,24 @@ static const VsgParallelStatus vsg_parallel_status_shared = {
*
* Convenience macro for questioning about @status storage type.
*
- * Returns: #TRUE if @status is equal to #VSG_PARALLEL_LOCAL
+ * Returns: #TRUE if @status is equal to #VSG_PARALLEL_SHARED_LOCAL or
+ * #VSG_PARALLEL_PRIVATE_LOCAL.
*/
#define VSG_PARALLEL_STATUS_IS_LOCAL(status) ( \
-(status).storage == VSG_PARALLEL_LOCAL \
+VSG_PARALLEL_STORAGE_IS_LOCAL ((status).storage) \
+)
+
+/**
+ * VSG_PARALLEL_STATUS_IS_REMOTE:
+ * @status: a #VsgParallelStatus
+ *
+ * Convenience macro for questioning about @status storage type.
+ *
+ * Returns: #TRUE if @status is equal to #VSG_PARALLEL_SHARED_REMOTE or
+ * #VSG_PARALLEL_PRIVATE_REMOTE.
+ */
+#define VSG_PARALLEL_STATUS_IS_REMOTE(status) ( \
+VSG_PARALLEL_STORAGE_IS_REMOTE ((status).storage) \
)
/**
@@ -139,7 +186,26 @@ static const VsgParallelStatus vsg_parallel_status_shared = {
* Returns: #TRUE if @status is equal to #VSG_PARALLEL_SHARED
*/
#define VSG_PARALLEL_STATUS_IS_SHARED(status) ( \
-(status).storage == VSG_PARALLEL_SHARED \
+VSG_PARALLEL_STORAGE_IS_SHARED ((status).storage) \
+)
+#define VSG_PARALLEL_STATUS_IS_PRIVATE(status) ( \
+VSG_PARALLEL_STORAGE_IS_PRIVATE ((status).storage) \
+)
+
+#define VSG_PARALLEL_STATUS_IS_PRIVATE_LOCAL(status) ( \
+VSG_PARALLEL_STORAGE_IS_PRIVATE_LOCAL ((status).storage) \
+)
+
+#define VSG_PARALLEL_STATUS_IS_SHARED_LOCAL(status) ( \
+VSG_PARALLEL_STORAGE_IS_SHARED_LOCAL ((status).storage) \
+)
+
+#define VSG_PARALLEL_STATUS_IS_PRIVATE_REMOTE(status) ( \
+VSG_PARALLEL_STORAGE_IS_PRIVATE_REMOTE ((status).storage) \
+)
+
+#define VSG_PARALLEL_STATUS_IS_SHARED_REMOTE(status) ( \
+VSG_PARALLEL_STORAGE_IS_SHARED_REMOTE ((status).storage) \
)
/**
@@ -154,7 +220,6 @@ static const VsgParallelStatus vsg_parallel_status_shared = {
(status).proc \
)
-
G_END_DECLS;
View
@@ -200,12 +200,14 @@ static gboolean _check_and_execute_semifar_func (VsgNFConfig2@t@ *nfc,
if (one_info->point_count == 0) return FALSE;
+ // *** ???
if (VSG_PRTREE2@T@_NODE_INFO_IS_SHARED (other_info))
{
/* if one_info is a visiting node, then semifar was already applied
* in source proc.
*/
- if (VSG_PRTREE2@T@_NODE_INFO_IS_REMOTE (one_info))
+ // *** PRIVATE-REMOTE
+ if (VSG_PRTREE2@T@_NODE_INFO_IS_PRIVATE_REMOTE (one_info))
return TRUE;
}
else
@@ -224,12 +226,14 @@ static gboolean _check_and_execute_semifar_func (VsgNFConfig2@t@ *nfc,
if (other_info->point_count == 0) return FALSE;
+ // *** ???
if (VSG_PRTREE2@T@_NODE_INFO_IS_SHARED (one_info))
{
/* if other_info is a visiting node, then semifar was already applied
* in source proc.
*/
- if (VSG_PRTREE2@T@_NODE_INFO_IS_REMOTE (other_info))
+ // *** PRIVATE-REMOTE
+ if (VSG_PRTREE2@T@_NODE_INFO_IS_PRIVATE_REMOTE (other_info))
return TRUE;
}
else
@@ -271,6 +275,7 @@ static void recursive_near_func (VsgPRTree2@t@Node *one,
VsgPRTree2@t@NodeInfo one_child_info;
#ifdef VSG_HAVE_MPI
+ // *** *-REMOTE
if (PRTREE2@T@NODE_IS_REMOTE (one_child)) continue;
#endif
@@ -289,6 +294,7 @@ static void recursive_near_func (VsgPRTree2@t@Node *one,
VsgPRTree2@t@NodeInfo other_child_info;
#ifdef VSG_HAVE_MPI
+ // *** *-REMOTE
if (PRTREE2@T@NODE_IS_REMOTE (other_child)) continue;
#endif
@@ -319,8 +325,9 @@ void vsg_prtree2@t@node_recursive_near_func (VsgPRTree2@t@Node *one,
}
#ifdef VSG_HAVE_MPI
+// *** PRIVATE-LOCAL
#define _NODE_IS_EMPTY(node) ( \
- (node)->point_count == 0 && PRTREE2@T@NODE_IS_LOCAL (node) \
+ (node)->point_count == 0 && PRTREE2@T@NODE_IS_PRIVATE_LOCAL (node) \
)
#else
#define _NODE_IS_EMPTY(node) ( \
@@ -365,7 +372,8 @@ _sub_neighborhood_near_far_traversal (VsgNFConfig2@t@ *nfc,
VsgPRTree2@t@NodeInfo one_child_info;
#ifdef VSG_HAVE_MPI
- if (PRTREE2@T@NODE_IS_REMOTE (one_child)) continue;
+ // *** PRIVATE-REMOTE
+ if (PRTREE2@T@NODE_IS_PRIVATE_REMOTE (one_child)) continue;
#endif
_vsg_prtree2@t@node_get_info (one_child, &one_child_info,
@@ -381,7 +389,8 @@ _sub_neighborhood_near_far_traversal (VsgNFConfig2@t@ *nfc,
VsgPRTree2@t@NodeInfo other_child_info;
#ifdef VSG_HAVE_MPI
- if (PRTREE2@T@NODE_IS_REMOTE (other_child)) continue;
+ // *** PRIVATE-REMOTE
+ if (PRTREE2@T@NODE_IS_PRIVATE_REMOTE (other_child)) continue;
#endif
_vsg_prtree2@t@node_get_info (other_child,
@@ -402,6 +411,7 @@ _sub_neighborhood_near_far_traversal (VsgNFConfig2@t@ *nfc,
#ifdef VSG_HAVE_MPI
/* in parallel, only one of the processors has to do a
shared/shared far interaction */
+ // *** SHARED-* && SHARED-*
if (PRTREE2@T@NODE_IS_SHARED (one_child) &&
PRTREE2@T@NODE_IS_SHARED (other_child) &&
PRTREE2@T@NODE_PROC (one_child) != nfc->rk)
@@ -416,8 +426,7 @@ _sub_neighborhood_near_far_traversal (VsgNFConfig2@t@ *nfc,
nfc->user_data);
}
}
- else
- {
+ else {
gint8 newx = _SUB_INTERACTION (i, j, x, _X);
gint8 newy = _SUB_INTERACTION (i, j, y, _Y);
@@ -452,7 +461,9 @@ vsg_prtree2@t@node_near_far_traversal (VsgNFConfig2@t@ *nfc,
VsgPRTree2@t@NodeInfo node_info;
#ifdef VSG_HAVE_MPI
- if (PRTREE2@T@NODE_IS_REMOTE (node)) return;
+ // *** PRIVATE-REMOTE
+ if (PRTREE2@T@NODE_IS_PRIVATE_REMOTE (node)) return;
+
#endif
if (_NODE_IS_EMPTY (node)) return;
@@ -489,7 +500,8 @@ vsg_prtree2@t@node_near_far_traversal (VsgNFConfig2@t@ *nfc,
VsgPRTree2@t@NodeInfo one_child_info;
#ifdef VSG_HAVE_MPI
- if (PRTREE2@T@NODE_IS_REMOTE (one_child)) continue;
+ // *** PRIVATE-REMOTE
+ if (PRTREE2@T@NODE_IS_PRIVATE_REMOTE (one_child)) continue;
#endif
_vsg_prtree2@t@node_get_info (one_child, &one_child_info,
@@ -502,7 +514,8 @@ vsg_prtree2@t@node_near_far_traversal (VsgNFConfig2@t@ *nfc,
gint8 x, y;
#ifdef VSG_HAVE_MPI
- if (PRTREE2@T@NODE_IS_REMOTE (other_child)) continue;
+ // *** PRIVATE-REMOTE
+ if (PRTREE2@T@NODE_IS_PRIVATE_REMOTE (other_child)) continue;
#endif
x = _AXIS_DIFF (i, j, _X);
Oops, something went wrong.

0 comments on commit b58dee6

Please sign in to comment.