瀏覽代碼

use starpu_ssize_t instead of ssize_t to be windows-able

Nathalie Furmento 12 年之前
父節點
當前提交
2cb9fcd148

+ 2 - 2
include/starpu_data_interfaces.h

@@ -128,7 +128,7 @@ struct starpu_data_interface_ops
 	struct starpu_multiformat_data_interface_ops* (*get_mf_ops)(void *data_interface);
 
 	/* Pack the data handle into a contiguous buffer at the address ptr and store the size of the buffer in count */
-	int (*pack_data)(starpu_data_handle_t handle, unsigned node, void **ptr, ssize_t *count);
+	int (*pack_data)(starpu_data_handle_t handle, unsigned node, void **ptr, starpu_ssize_t *count);
 	/* Unpack the data handle from the contiguous buffer at the address ptr */
 	int (*unpack_data)(starpu_data_handle_t handle, unsigned node, void *ptr, size_t count);
 };
@@ -426,7 +426,7 @@ void starpu_multiformat_data_register(starpu_data_handle_t *handle, unsigned hom
 
 enum starpu_data_interface_id starpu_handle_get_interface_id(starpu_data_handle_t handle);
 
-int starpu_handle_pack_data(starpu_data_handle_t handle, void **ptr, ssize_t *count);
+int starpu_handle_pack_data(starpu_data_handle_t handle, void **ptr, starpu_ssize_t *count);
 int starpu_handle_unpack_data(starpu_data_handle_t handle, void *ptr, size_t count);
 size_t starpu_handle_get_size(starpu_data_handle_t handle);
 

+ 1 - 1
include/starpu_stdlib.h

@@ -36,7 +36,7 @@ int starpu_free(void *A);
 int starpu_malloc_flags(void **A, size_t dim, int flags);
 int starpu_free_flags(void *A, size_t dim, int flags);
 
-ssize_t starpu_memory_get_available(unsigned node);
+starpu_ssize_t starpu_memory_get_available(unsigned node);
 
 #ifdef __cplusplus
 }

+ 3 - 3
src/datawizard/interfaces/bcsr_interface.c

@@ -39,7 +39,7 @@ static const struct starpu_data_copy_methods bcsr_copy_data_methods_s =
 };
 
 static void register_bcsr_handle(starpu_data_handle_t handle, unsigned home_node, void *data_interface);
-static ssize_t allocate_bcsr_buffer_on_node(void *data_interface, unsigned dst_node);
+static starpu_ssize_t allocate_bcsr_buffer_on_node(void *data_interface, unsigned dst_node);
 static void free_bcsr_buffer_on_node(void *data_interface, unsigned node);
 static size_t bcsr_interface_get_size(starpu_data_handle_t handle);
 static int bcsr_compare(void *data_interface_a, void *data_interface_b);
@@ -236,10 +236,10 @@ static size_t bcsr_interface_get_size(starpu_data_handle_t handle)
 /* memory allocation/deallocation primitives for the BLAS interface */
 
 /* returns the size of the allocated area */
-static ssize_t allocate_bcsr_buffer_on_node(void *data_interface_, unsigned dst_node)
+static starpu_ssize_t allocate_bcsr_buffer_on_node(void *data_interface_, unsigned dst_node)
 {
 	uintptr_t addr_nzval, addr_colind, addr_rowptr;
-	ssize_t allocated_memory;
+	starpu_ssize_t allocated_memory;
 
 	/* we need the 3 arrays to be allocated */
 	struct starpu_bcsr_interface *bcsr_interface = (struct starpu_bcsr_interface *) data_interface_;

+ 3 - 3
src/datawizard/interfaces/block_interface.c

@@ -67,7 +67,7 @@ static const struct starpu_data_copy_methods block_copy_data_methods_s =
 
 static void register_block_handle(starpu_data_handle_t handle, unsigned home_node, void *data_interface);
 static void *block_handle_to_pointer(starpu_data_handle_t data_handle, unsigned node);
-static ssize_t allocate_block_buffer_on_node(void *data_interface_, unsigned dst_node);
+static starpu_ssize_t allocate_block_buffer_on_node(void *data_interface_, unsigned dst_node);
 static void free_block_buffer_on_node(void *data_interface, unsigned node);
 static size_t block_interface_get_size(starpu_data_handle_t handle);
 static uint32_t footprint_block_interface_crc32(starpu_data_handle_t handle);
@@ -274,7 +274,7 @@ size_t starpu_block_get_elemsize(starpu_data_handle_t handle)
 /* memory allocation/deallocation primitives for the BLOCK interface */
 
 /* returns the size of the allocated area */
-static ssize_t allocate_block_buffer_on_node(void *data_interface_, unsigned dst_node)
+static starpu_ssize_t allocate_block_buffer_on_node(void *data_interface_, unsigned dst_node)
 {
 	uintptr_t addr = 0, handle;
 
@@ -285,7 +285,7 @@ static ssize_t allocate_block_buffer_on_node(void *data_interface_, unsigned dst
 	uint32_t nz = dst_block->nz;
 	size_t elemsize = dst_block->elemsize;
 
-	ssize_t allocated_memory;
+	starpu_ssize_t allocated_memory;
 
 	handle = starpu_malloc_on_node(dst_node, nx*ny*nz*elemsize);
 

+ 1 - 1
src/datawizard/interfaces/coo_interface.c

@@ -96,7 +96,7 @@ register_coo_handle(starpu_data_handle_t handle, unsigned home_node,
 	}
 }
 
-static ssize_t
+static starpu_ssize_t
 allocate_coo_buffer_on_node(void *data_interface, unsigned dst_node)
 {
 	uint32_t *addr_columns = NULL;

+ 3 - 3
src/datawizard/interfaces/csr_interface.c

@@ -36,7 +36,7 @@ static const struct starpu_data_copy_methods csr_copy_data_methods_s =
 };
 
 static void register_csr_handle(starpu_data_handle_t handle, unsigned home_node, void *data_interface);
-static ssize_t allocate_csr_buffer_on_node(void *data_interface_, unsigned dst_node);
+static starpu_ssize_t allocate_csr_buffer_on_node(void *data_interface_, unsigned dst_node);
 static void free_csr_buffer_on_node(void *data_interface, unsigned node);
 static size_t csr_interface_get_size(starpu_data_handle_t handle);
 static int csr_compare(void *data_interface_a, void *data_interface_b);
@@ -207,11 +207,11 @@ static size_t csr_interface_get_size(starpu_data_handle_t handle)
 /* memory allocation/deallocation primitives for the BLAS interface */
 
 /* returns the size of the allocated area */
-static ssize_t allocate_csr_buffer_on_node(void *data_interface_, unsigned dst_node)
+static starpu_ssize_t allocate_csr_buffer_on_node(void *data_interface_, unsigned dst_node)
 {
 	uintptr_t addr_nzval = 0;
 	uint32_t *addr_colind = NULL, *addr_rowptr = NULL;
-	ssize_t allocated_memory;
+	starpu_ssize_t allocated_memory;
 
 	/* we need the 3 arrays to be allocated */
 	struct starpu_csr_interface *csr_interface = (struct starpu_csr_interface *) data_interface_;

+ 1 - 1
src/datawizard/interfaces/data_interface.c

@@ -693,7 +693,7 @@ int starpu_data_interface_get_next_id(void)
 	return _data_interface_number-1;
 }
 
-int starpu_handle_pack_data(starpu_data_handle_t handle, void **ptr, ssize_t *count)
+int starpu_handle_pack_data(starpu_data_handle_t handle, void **ptr, starpu_ssize_t *count)
 {
 	STARPU_ASSERT(handle->ops->pack_data);
 	return handle->ops->pack_data(handle, _starpu_memory_node_get_local_key(), ptr, count);

+ 3 - 3
src/datawizard/interfaces/matrix_interface.c

@@ -80,7 +80,7 @@ static const struct starpu_data_copy_methods matrix_copy_data_methods_s =
 
 static void register_matrix_handle(starpu_data_handle_t handle, unsigned home_node, void *data_interface);
 static void *matrix_handle_to_pointer(starpu_data_handle_t data_handle, unsigned node);
-static ssize_t allocate_matrix_buffer_on_node(void *data_interface_, unsigned dst_node);
+static starpu_ssize_t allocate_matrix_buffer_on_node(void *data_interface_, unsigned dst_node);
 static void free_matrix_buffer_on_node(void *data_interface, unsigned node);
 static size_t matrix_interface_get_size(starpu_data_handle_t handle);
 static uint32_t footprint_matrix_interface_crc32(starpu_data_handle_t handle);
@@ -252,7 +252,7 @@ size_t starpu_matrix_get_elemsize(starpu_data_handle_t handle)
 /* memory allocation/deallocation primitives for the matrix interface */
 
 /* returns the size of the allocated area */
-static ssize_t allocate_matrix_buffer_on_node(void *data_interface_, unsigned dst_node)
+static starpu_ssize_t allocate_matrix_buffer_on_node(void *data_interface_, unsigned dst_node)
 {
 	uintptr_t addr = 0, handle;
 
@@ -263,7 +263,7 @@ static ssize_t allocate_matrix_buffer_on_node(void *data_interface_, unsigned ds
 	uint32_t ld = nx; // by default
 	size_t elemsize = matrix_interface->elemsize;
 
-	ssize_t allocated_memory;
+	starpu_ssize_t allocated_memory;
 
 	handle = starpu_malloc_on_node(dst_node, nx*ny*elemsize);
 

+ 3 - 3
src/datawizard/interfaces/multiformat_interface.c

@@ -68,7 +68,7 @@ static const struct starpu_data_copy_methods multiformat_copy_data_methods_s =
 };
 
 static void register_multiformat_handle(starpu_data_handle_t handle, unsigned home_node, void *data_interface);
-static ssize_t allocate_multiformat_buffer_on_node(void *data_interface_, unsigned dst_node);
+static starpu_ssize_t allocate_multiformat_buffer_on_node(void *data_interface_, unsigned dst_node);
 static void *multiformat_handle_to_pointer(starpu_data_handle_t data_handle, unsigned node);
 static void free_multiformat_buffer_on_node(void *data_interface, unsigned node);
 static size_t multiformat_interface_get_size(starpu_data_handle_t handle);
@@ -233,12 +233,12 @@ uint32_t starpu_multiformat_get_nx(starpu_data_handle_t handle)
 	return multiformat_interface->nx;
 }
 
-static ssize_t allocate_multiformat_buffer_on_node(void *data_interface_, unsigned dst_node)
+static starpu_ssize_t allocate_multiformat_buffer_on_node(void *data_interface_, unsigned dst_node)
 {
 	struct starpu_multiformat_interface *multiformat_interface;
 	multiformat_interface = (struct starpu_multiformat_interface *) data_interface_;
 	uintptr_t addr = 0;
-	ssize_t allocated_memory = 0;
+	starpu_ssize_t allocated_memory = 0;
 	size_t size;
 
 	size = multiformat_interface->nx * multiformat_interface->ops->cpu_elemsize;

+ 2 - 2
src/datawizard/interfaces/variable_interface.c

@@ -33,7 +33,7 @@ static const struct starpu_data_copy_methods variable_copy_data_methods_s =
 };
 
 static void register_variable_handle(starpu_data_handle_t handle, unsigned home_node, void *data_interface);
-static ssize_t allocate_variable_buffer_on_node(void *data_interface_, unsigned dst_node);
+static starpu_ssize_t allocate_variable_buffer_on_node(void *data_interface_, unsigned dst_node);
 static void *variable_handle_to_pointer(starpu_data_handle_t data_handle, unsigned node);
 static void free_variable_buffer_on_node(void *data_interface, unsigned node);
 static size_t variable_interface_get_size(starpu_data_handle_t handle);
@@ -146,7 +146,7 @@ size_t starpu_variable_get_elemsize(starpu_data_handle_t handle)
 /* memory allocation/deallocation primitives for the variable interface */
 
 /* returns the size of the allocated area */
-static ssize_t allocate_variable_buffer_on_node(void *data_interface_, unsigned dst_node)
+static starpu_ssize_t allocate_variable_buffer_on_node(void *data_interface_, unsigned dst_node)
 {
 	struct starpu_variable_interface *variable_interface = (struct starpu_variable_interface *) data_interface_;
 	size_t elemsize = variable_interface->elemsize;

+ 3 - 3
src/datawizard/interfaces/vector_interface.c

@@ -33,7 +33,7 @@ static const struct starpu_data_copy_methods vector_copy_data_methods_s =
 };
 
 static void register_vector_handle(starpu_data_handle_t handle, unsigned home_node, void *data_interface);
-static ssize_t allocate_vector_buffer_on_node(void *data_interface_, unsigned dst_node);
+static starpu_ssize_t allocate_vector_buffer_on_node(void *data_interface_, unsigned dst_node);
 static void *vector_handle_to_pointer(starpu_data_handle_t data_handle, unsigned node);
 static void free_vector_buffer_on_node(void *data_interface, unsigned node);
 static size_t vector_interface_get_size(starpu_data_handle_t handle);
@@ -178,7 +178,7 @@ size_t starpu_vector_get_elemsize(starpu_data_handle_t handle)
 /* memory allocation/deallocation primitives for the vector interface */
 
 /* returns the size of the allocated area */
-static ssize_t allocate_vector_buffer_on_node(void *data_interface_, unsigned dst_node)
+static starpu_ssize_t allocate_vector_buffer_on_node(void *data_interface_, unsigned dst_node)
 {
 	uintptr_t addr = 0, handle;
 
@@ -187,7 +187,7 @@ static ssize_t allocate_vector_buffer_on_node(void *data_interface_, unsigned ds
 	uint32_t nx = vector_interface->nx;
 	size_t elemsize = vector_interface->elemsize;
 
-	ssize_t allocated_memory;
+	starpu_ssize_t allocated_memory;
 
 	handle = starpu_malloc_on_node(dst_node, nx*elemsize);
 	if (!handle)

+ 3 - 3
src/datawizard/interfaces/void_interface.c

@@ -33,7 +33,7 @@ static const struct starpu_data_copy_methods void_copy_data_methods_s =
 };
 
 static void register_void_handle(starpu_data_handle_t handle, unsigned home_node, void *data_interface);
-static ssize_t allocate_void_buffer_on_node(void *data_interface_, unsigned dst_node);
+static starpu_ssize_t allocate_void_buffer_on_node(void *data_interface_, unsigned dst_node);
 static void free_void_buffer_on_node(void *data_interface, unsigned node);
 static size_t void_interface_get_size(starpu_data_handle_t handle);
 static uint32_t footprint_void_interface_crc32(starpu_data_handle_t handle);
@@ -94,8 +94,8 @@ static size_t void_interface_get_size(starpu_data_handle_t handle STARPU_ATTRIBU
 /* memory allocation/deallocation primitives for the void interface */
 
 /* returns the size of the allocated area */
-static ssize_t allocate_void_buffer_on_node(void *data_interface STARPU_ATTRIBUTE_UNUSED,
-					unsigned dst_node STARPU_ATTRIBUTE_UNUSED)
+static starpu_ssize_t allocate_void_buffer_on_node(void *data_interface STARPU_ATTRIBUTE_UNUSED,
+						   unsigned dst_node STARPU_ATTRIBUTE_UNUSED)
 {
 	/* Successfuly allocated 0 bytes */
 	return 0;

+ 4 - 4
src/datawizard/memalloc.c

@@ -749,10 +749,10 @@ void _starpu_request_mem_chunk_removal(starpu_data_handle_t handle, struct _star
  *
  */
 
-static ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, unsigned dst_node, unsigned is_prefetch)
+static starpu_ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, unsigned dst_node, unsigned is_prefetch)
 {
 	unsigned attempts = 0;
-	ssize_t allocated_memory;
+	starpu_ssize_t allocated_memory;
 	int ret;
 
 	_starpu_spin_checklocked(&handle->header_lock);
@@ -770,7 +770,7 @@ static ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, struct _s
 	{
 		_STARPU_PTHREAD_RWLOCK_UNLOCK(&mc_rwlock[dst_node]);
 		_starpu_allocation_cache_hit(dst_node);
-		ssize_t data_size = _starpu_data_get_size(handle);
+		starpu_ssize_t data_size = _starpu_data_get_size(handle);
 		return data_size;
 	}
 
@@ -840,7 +840,7 @@ static ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, struct _s
 
 int _starpu_allocate_memory_on_node(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, unsigned is_prefetch)
 {
-	ssize_t allocated_memory;
+	starpu_ssize_t allocated_memory;
 
 	unsigned dst_node = replicate->memory_node;
 

+ 1 - 1
src/datawizard/memory_manager.c

@@ -79,7 +79,7 @@ void _starpu_memory_manager_deallocate_size(size_t size, unsigned node)
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&lock_nodes[node]);
 }
 
-ssize_t starpu_memory_get_available(unsigned node)
+starpu_ssize_t starpu_memory_get_available(unsigned node)
 {
 	if (global_size[node] == 0)
 		return -1;

+ 1 - 1
src/drivers/cpu/driver_cpu.c

@@ -192,7 +192,7 @@ _starpu_get_worker_from_driver(struct starpu_driver *d)
 static size_t _starpu_cpu_get_global_mem_size(int devid, struct _starpu_machine_config *config)
 {
 	size_t global_mem;
-	ssize_t limit;
+	starpu_ssize_t limit;
 
 	limit = starpu_get_env_number("STARPU_LIMIT_CPU_MEM");
 #ifdef STARPU_DEVEL

+ 1 - 1
src/drivers/cuda/driver_cuda.c

@@ -73,7 +73,7 @@ _starpu_cuda_discover_devices (struct _starpu_machine_config *config)
  */
 static void _starpu_cuda_limit_gpu_mem_if_needed(unsigned devid)
 {
-	ssize_t limit;
+	starpu_ssize_t limit;
 	size_t STARPU_ATTRIBUTE_UNUSED totalGlobalMem = 0;
 	size_t STARPU_ATTRIBUTE_UNUSED to_waste = 0;
 	char name[30];

+ 1 - 1
src/drivers/opencl/driver_opencl.c

@@ -61,7 +61,7 @@ _starpu_opencl_discover_devices(struct _starpu_machine_config *config)
 
 static void _starpu_opencl_limit_gpu_mem_if_needed(unsigned devid)
 {
-	ssize_t limit;
+	starpu_ssize_t limit;
 	size_t STARPU_ATTRIBUTE_UNUSED totalGlobalMem = 0;
 	size_t STARPU_ATTRIBUTE_UNUSED to_waste = 0;
 	char name[30];