Explorar o código

replace 0 with macro

Corentin Salingue %!s(int64=12) %!d(string=hai) anos
pai
achega
132d1723a2

+ 2 - 3
doc/doxygen/chapters/advanced_examples.doxy

@@ -201,7 +201,7 @@ int vector[NX];
 starpu_data_handle_t handle;
 
 /* Declare data to StarPU */
-starpu_vector_data_register(&handle, 0, (uintptr_t)vector,
+starpu_vector_data_register(&handle, STARPU_MAIN_RAM, (uintptr_t)vector,
                             NX, sizeof(vector[0]));
 
 /* Partition the vector in PARTS sub-vectors */
@@ -1106,8 +1106,7 @@ Complex data interfaces can then be registered to StarPU.
 
 \code{.c}
 double real = 45.0;
-double imaginary = 12.0;
-starpu_complex_data_register(&handle1, 0, &real, &imaginary, 1);
+double imaginary = 12.0;starpu_complex_data_register(&handle1, STARPU_MAIN_RAM, &real, &imaginary, 1);
 starpu_insert_task(&cl_display, STARPU_R, handle1, 0);
 \endcode
 

+ 4 - 4
doc/doxygen/chapters/api/data_interfaces.doxy

@@ -212,7 +212,7 @@ Here an example of how to use the function.
 \code{.c}
 float var;
 starpu_data_handle_t var_handle;
-starpu_variable_data_register(&var_handle, 0, (uintptr_t)&var, sizeof(var));
+starpu_variable_data_register(&var_handle, STARPU_MAIN_RAM, (uintptr_t)&var, sizeof(var));
 \endcode
 
 \fn void starpu_vector_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t nx, size_t elemsize)
@@ -223,7 +223,7 @@ Here an example of how to use the function.
 \code{.c}
 float vector[NX];
 starpu_data_handle_t vector_handle;
-starpu_vector_data_register(&vector_handle, 0, (uintptr_t)vector, NX, sizeof(vector[0]));
+starpu_vector_data_register(&vector_handle, STARPU_MAIN_RAM, (uintptr_t)vector, NX, sizeof(vector[0]));
 \endcode
 
 \fn void starpu_matrix_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t ld, uint32_t nx, uint32_t ny, size_t elemsize)
@@ -238,7 +238,7 @@ Here an example of how to use the function.
 float *matrix;
 starpu_data_handle_t matrix_handle;
 matrix = (float*)malloc(width * height * sizeof(float));
-starpu_matrix_data_register(&matrix_handle, 0, (uintptr_t)matrix, width, width, height, sizeof(float));
+starpu_matrix_data_register(&matrix_handle, STARPU_MAIN_RAM, (uintptr_t)matrix, width, width, height, sizeof(float));
 \endcode
 
 \fn void starpu_block_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t ldy, uint32_t ldz, uint32_t nx, uint32_t ny, uint32_t nz, size_t elemsize)
@@ -252,7 +252,7 @@ Here an example of how to use the function.
 float *block;
 starpu_data_handle_t block_handle;
 block = (float*)malloc(nx*ny*nz*sizeof(float));
-starpu_block_data_register(&block_handle, 0, (uintptr_t)block, nx, nx*ny, nx, ny, nz, sizeof(float));
+starpu_block_data_register(&block_handle, STARPU_MAIN_RAM, (uintptr_t)block, nx, nx*ny, nx, ny, nz, sizeof(float));
 \endcode
 
 \fn void starpu_bcsr_data_register(starpu_data_handle_t *handle, unsigned home_node, uint32_t nnz, uint32_t nrow, uintptr_t nzval, uint32_t *colind, uint32_t *rowptr, uint32_t firstentry, uint32_t r, uint32_t c, size_t elemsize)

+ 2 - 2
doc/doxygen/chapters/basic_examples.doxy

@@ -444,14 +444,14 @@ The following lines show how to declare an array of <c>NX</c> elements of type
 float vector[NX];
 
 starpu_data_handle_t vector_handle;
-starpu_vector_data_register(&vector_handle, 0, (uintptr_t)vector, NX,
+starpu_vector_data_register(&vector_handle, STARPU_MAIN_RAM, (uintptr_t)vector, NX,
                             sizeof(vector[0]));
 \endcode
 
 The first argument, called the <b>data handle</b>, is an opaque pointer which
 designates the array in StarPU. This is also the structure which is used to
 describe which data is used by a task. The second argument is the node number
-where the data originally resides. Here it is 0 since the array <c>vector</c> is in
+where the data originally resides. Here it is STARPU_MAIN_RAM since the array <c>vector</c> is in
 the main memory. Then comes the pointer <c>vector</c> where the data can be found in main memory,
 the number of elements in the vector and the size of each element.
 The following shows how to construct a StarPU task that will manipulate the

+ 2 - 15
doc/doxygen/chapters/code/disk_copy.c

@@ -63,28 +63,15 @@ int main(int argc, char **argv)
 		F[j] = -j;
 	}
 
-	/* Tell StaPU to associate the "vector" vector with the "vector_handle"
-	 * identifier. When a task needs to access a piece of data, it should
-	 * refer to the handle that is associated to it.
-	 * In the case of the "vector" data interface:
-	 *  - the first argument of the registration method is a pointer to the
-	 *    handle that should describe the data
-	 *  - the second argument is the memory node where the data (ie. "vector")
-	 *    resides initially: 0 stands for an address in main memory, as
-	 *    opposed to an adress on a GPU for instance.
-	 *  - the third argument is the adress of the vector in RAM
-	 *  - the fourth argument is the number of elements in the vector
-	 *  - the fifth argument is the size of each element.
-	 */
 	starpu_data_handle_t vector_handleA, vector_handleB, vector_handleC, vector_handleD, vector_handleE, vector_handleF;
 
 	/* register vector in starpu */
-	starpu_vector_data_register(&vector_handleA, 0, (uintptr_t)A, NX, sizeof(double));
+	starpu_vector_data_register(&vector_handleA, STARPU_MAIN_RAM, (uintptr_t)A, NX, sizeof(double));
 	starpu_vector_data_register(&vector_handleB, -1, (uintptr_t) NULL, NX, sizeof(double));	
 	starpu_vector_data_register(&vector_handleC, -1, (uintptr_t) NULL, NX, sizeof(double));
 	starpu_vector_data_register(&vector_handleD, -1, (uintptr_t) NULL, NX, sizeof(double));
 	starpu_vector_data_register(&vector_handleE, -1, (uintptr_t) NULL, NX, sizeof(double));
-	starpu_vector_data_register(&vector_handleF, 0, (uintptr_t)F, NX, sizeof(double));
+	starpu_vector_data_register(&vector_handleF, STARPU_MAIN_RAM, (uintptr_t)F, NX, sizeof(double));
 
 	/* copy vector A->B, B->C... */
 	starpu_data_cpy(vector_handleB, vector_handleA, 0, NULL, NULL);

+ 2 - 2
doc/doxygen/chapters/code/vector_scal_c.c

@@ -79,14 +79,14 @@ int main(int argc, char **argv)
      *  - the first argument of the registration method is a pointer to the
      *    handle that should describe the data
      *  - the second argument is the memory node where the data (ie. "vector")
-     *    resides initially: 0 stands for an address in main memory, as
+     *    resides initially: STARPU_MAIN_RAM stands for an address in main memory, as
      *    opposed to an adress on a GPU for instance.
      *  - the third argument is the adress of the vector in RAM
      *  - the fourth argument is the number of elements in the vector
      *  - the fifth argument is the size of each element.
      */
     starpu_data_handle_t vector_handle;
-    starpu_vector_data_register(&vector_handle, 0, (uintptr_t)vector,
+    starpu_vector_data_register(&vector_handle, STARPU_MAIN_RAM, (uintptr_t)vector,
                                 NX, sizeof(vector[0]));
 
     float factor = 3.14;

+ 1 - 1
doc/doxygen/chapters/introduction.doxy

@@ -145,7 +145,7 @@ simply replace calling the function with submitting a task.
 A \b codelet records pointers to various implementations of the same
 theoretical function.
 
-A <b>memory node</b> can be either the main RAM or GPU-embedded memory.
+A <b>memory node</b> can be either the main RAM, GPU-embedded memory or a disk memory.
 
 A \b bus is a link between memory nodes.
 

+ 1 - 1
doc/doxygen/chapters/mpi_support.doxy

@@ -52,7 +52,7 @@ int main(int argc, char **argv)
     starpu_init(NULL);
     starpu_mpi_initialize_extended(&rank, &size);
 
-    starpu_vector_data_register(&token_handle, 0, (uintptr_t)&token, 1, sizeof(unsigned));
+    starpu_vector_data_register(&token_handle, STARPU_MAIN_RAM, (uintptr_t)&token, 1, sizeof(unsigned));
 
     unsigned nloops = NITER;
     unsigned loop;

+ 3 - 16
tests/disk/disk_copy.c

@@ -60,29 +60,16 @@ int main(int argc, char **argv)
 		A[j] = j;
 		F[j] = -j;
 	}
-
-	/* Tell StaPU to associate the "vector" vector with the "vector_handle"
-	 * identifier. When a task needs to access a piece of data, it should
-	 * refer to the handle that is associated to it.
-	 * In the case of the "vector" data interface:
-	 *  - the first argument of the registration method is a pointer to the
-	 *    handle that should describe the data
-	 *  - the second argument is the memory node where the data (ie. "vector")
-	 *    resides initially: 0 stands for an address in main memory, as
-	 *    opposed to an adress on a GPU for instance.
-	 *  - the third argument is the adress of the vector in RAM
-	 *  - the fourth argument is the number of elements in the vector
-	 *  - the fifth argument is the size of each element.
-	 */
+	
 	starpu_data_handle_t vector_handleA, vector_handleB, vector_handleC, vector_handleD, vector_handleE, vector_handleF;
 
 	/* register vector in starpu */
-	starpu_vector_data_register(&vector_handleA, 0, (uintptr_t)A, NX, sizeof(double));
+	starpu_vector_data_register(&vector_handleA, STARPU_MAIN_RAM, (uintptr_t)A, NX, sizeof(double));
 	starpu_vector_data_register(&vector_handleB, -1, (uintptr_t) NULL, NX, sizeof(double));	
 	starpu_vector_data_register(&vector_handleC, -1, (uintptr_t) NULL, NX, sizeof(double));
 	starpu_vector_data_register(&vector_handleD, -1, (uintptr_t) NULL, NX, sizeof(double));
 	starpu_vector_data_register(&vector_handleE, -1, (uintptr_t) NULL, NX, sizeof(double));
-	starpu_vector_data_register(&vector_handleF, 0, (uintptr_t)F, NX, sizeof(double));
+	starpu_vector_data_register(&vector_handleF, STARPU_MAIN_RAM, (uintptr_t)F, NX, sizeof(double));
 
 	/* copy vector A->B, B->C... */
 	starpu_data_cpy(vector_handleB, vector_handleA, 0, NULL, NULL);