|
@@ -101,8 +101,14 @@ int _starpu_select_src_node(starpu_data_handle_t handle, unsigned destination)
|
|
{
|
|
{
|
|
/* Could estimate through cost, return that */
|
|
/* Could estimate through cost, return that */
|
|
STARPU_ASSERT(handle->per_node[src_node].allocated);
|
|
STARPU_ASSERT(handle->per_node[src_node].allocated);
|
|
- STARPU_ASSERT(handle->per_node[src_node].initialized);
|
|
|
|
- return src_node;
|
|
|
|
|
|
+ if (handle->per_node[src_node].initialized)
|
|
|
|
+ {
|
|
|
|
+ return src_node;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
int i_ram = -1;
|
|
int i_ram = -1;
|
|
@@ -165,7 +171,10 @@ int _starpu_select_src_node(starpu_data_handle_t handle, unsigned destination)
|
|
|
|
|
|
STARPU_ASSERT(src_node != -1);
|
|
STARPU_ASSERT(src_node != -1);
|
|
STARPU_ASSERT(handle->per_node[src_node].allocated);
|
|
STARPU_ASSERT(handle->per_node[src_node].allocated);
|
|
- STARPU_ASSERT(handle->per_node[src_node].initialized);
|
|
|
|
|
|
+ if (!handle->per_node[src_node].initialized)
|
|
|
|
+ {
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
return src_node;
|
|
return src_node;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -578,7 +587,25 @@ struct _starpu_data_request *_starpu_create_request_to_fetch_data(starpu_data_ha
|
|
if (dst_replicate && mode & STARPU_R)
|
|
if (dst_replicate && mode & STARPU_R)
|
|
{
|
|
{
|
|
if (dst_replicate->state == STARPU_INVALID)
|
|
if (dst_replicate->state == STARPU_INVALID)
|
|
|
|
+ {
|
|
src_node = _starpu_select_src_node(handle, requesting_node);
|
|
src_node = _starpu_select_src_node(handle, requesting_node);
|
|
|
|
+ if (src_node == -1 && requesting_node == STARPU_MAIN_RAM && !nwait)
|
|
|
|
+ {
|
|
|
|
+ /* And this is the main RAM, really no need for a
|
|
|
|
+ * request, just allocate */
|
|
|
|
+ if (_starpu_allocate_memory_on_node(handle, dst_replicate, is_prefetch) == 0)
|
|
|
|
+ {
|
|
|
|
+ _starpu_update_data_state(handle, dst_replicate, mode);
|
|
|
|
+
|
|
|
|
+ _starpu_spin_unlock(&handle->header_lock);
|
|
|
|
+
|
|
|
|
+ if (callback_func)
|
|
|
|
+ callback_func(callback_arg);
|
|
|
|
+ _STARPU_LOG_OUT_TAG("data immediately allocated");
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
else
|
|
else
|
|
src_node = requesting_node;
|
|
src_node = requesting_node;
|
|
if (src_node < 0)
|
|
if (src_node < 0)
|