Bläddra i källkod

remove directories from merge

Simon Archipoff 12 år sedan
förälder
incheckning
24dc8aa37d

+ 0 - 120
src/drivers/mic/driver_mic_common.c

@@ -1,120 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#include <starpu.h>
-#include <drivers/mp_common/mp_common.h>
-#include <drivers/mic/driver_mic_common.h>
-
-
-void _starpu_mic_common_report_scif_error(const char *func, const char *file, const int line, const int status)
-{
-	const char *errormsg = strerror(status);
-	printf("Common: oops in %s (%s:%u)... %d: %s \n", func, file, line, status, errormsg);
-	STARPU_ASSERT(0);
-}
-
-/* Handles the error so the caller (which must be generic) doesn't have to
- * care about it.
- */
-
-void _starpu_mic_common_send(const struct _starpu_mp_node *node, void *msg, int len)
-{
-	if ((scif_send(node->mp_connection.mic_endpoint, msg, len, SCIF_SEND_BLOCK)) < 0)
-		STARPU_MP_COMMON_REPORT_ERROR(node, errno);
-}
-
-/* Handles the error so the caller (which must be generic) doesn't have to
- * care about it.
- */
-
-void _starpu_mic_common_recv(const struct _starpu_mp_node *node, void *msg, int len)
-{
-	if ((scif_recv(node->mp_connection.mic_endpoint, msg, len, SCIF_RECV_BLOCK)) < 0)
-		STARPU_MP_COMMON_REPORT_ERROR(node, errno);
-}
-
-/* Handles the error so the caller (which must be generic) doesn't have to
- * care about it.
- */
-void _starpu_mic_common_dt_send(const struct _starpu_mp_node *mp_node, void *msg, int len)
-{
-	if ((scif_send(mp_node->host_sink_dt_connection.mic_endpoint, msg, len, SCIF_SEND_BLOCK)) < 0)
-		STARPU_MP_COMMON_REPORT_ERROR(mp_node, errno);
-}
-
-/* Handles the error so the caller (which must be generic) doesn't have to
- * care about it.
- */
-void _starpu_mic_common_dt_recv(const struct _starpu_mp_node *mp_node, void *msg, int len)
-{
-	if ((scif_recv(mp_node->host_sink_dt_connection.mic_endpoint, msg, len, SCIF_SEND_BLOCK)) < 0)
-		STARPU_MP_COMMON_REPORT_ERROR(mp_node, errno);
-}
-
-void _starpu_mic_common_connect(scif_epd_t *endpoint, uint16_t remote_node,
-				uint16_t local_port_number, uint16_t remote_port_number)
-{
-	/* Endpoint only useful for the initialization of the connection */
-	struct scif_portID portID;
-
-	portID.node = remote_node;
-	portID.port = remote_port_number;
-
-	if ((*endpoint = scif_open()) < 0)
-		STARPU_MIC_COMMON_REPORT_SCIF_ERROR(errno);
-
-	if ((scif_bind(*endpoint, local_port_number)) < 0)
-		STARPU_MIC_COMMON_REPORT_SCIF_ERROR(errno);
-
-	_STARPU_DEBUG("Connecting to MIC %d on %d:%d...\n", remote_node, local_port_number, remote_port_number);
-	while (scif_connect(*endpoint, &portID) == -1)
-	{
-		if (errno != ECONNREFUSED)
-			STARPU_MIC_COMMON_REPORT_SCIF_ERROR(errno);
-	}
-	_STARPU_DEBUG("done\n");
-}
-
-/* Wait and accept the connection from the wanted device on the port PORT_NUMBER
- * and then initialize the connection, the resutling endpoint is stored in ENDPOINT */
-void _starpu_mic_common_accept(scif_epd_t *endpoint, uint16_t port_number)
-{
-	/* Unused variables, only useful to make scif_accept don't cause
-	 * a seg fault when trying to access PEER parameter */
-	struct scif_portID portID;
-
-	/* Endpoint only useful for the initialization of the connection */
-	int init_epd;
-
-	if ((init_epd = scif_open()) < 0)
-		STARPU_MIC_COMMON_REPORT_SCIF_ERROR(errno);
-
-	if ((scif_bind(init_epd, port_number)) < 0)
-		STARPU_MIC_COMMON_REPORT_SCIF_ERROR(errno);
-
-	/* We fix the maximum number of request to 1 as we
-	 * only need one connection, more would be an error */
-	if ((scif_listen(init_epd, 1)) < 0)
-		STARPU_MIC_COMMON_REPORT_SCIF_ERROR(errno);
-
-	_STARPU_DEBUG("MIC accepting connection on %u...\n", port_number);
-	if ((scif_accept(init_epd, &portID, endpoint, SCIF_ACCEPT_SYNC)) < 0)
-		STARPU_MIC_COMMON_REPORT_SCIF_ERROR(errno);
-	_STARPU_DEBUG("done\n", init_epd);
-
-	scif_close(init_epd);
-}

+ 0 - 70
src/drivers/mic/driver_mic_common.h

@@ -1,70 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#ifndef __DRIVER_MIC_COMMON_H__
-#define __DRIVER_MIC_COMMON_H__
-
-
-#include <common/config.h>
-
-
-#ifdef STARPU_USE_MIC
-
-#define STARPU_TO_MIC_ID(id) ((id) + 1)
-
-/* TODO: rather allocate ports on the host and pass them as parameters to the device process */
-#define STARPU_MIC_PORTS_BEGIN 1099
-
-#define STARPU_MIC_SOURCE_PORT_NUMBER STARPU_MIC_PORTS_BEGIN
-#define STARPU_MIC_SINK_PORT_NUMBER(id) ((id) + STARPU_MIC_PORTS_BEGIN + 1)
-
-#define STARPU_MIC_SOURCE_DT_PORT_NUMBER (STARPU_MAXMICDEVS + STARPU_MIC_PORTS_BEGIN + 1)
-#define STARPU_MIC_SINK_DT_PORT_NUMBER(id) ((id) + STARPU_MAXMICDEVS + STARPU_MIC_PORTS_BEGIN + 2)
-
-#define STARPU_MIC_SINK_SINK_DT_PORT_NUMBER(me, peer_id) \
-((me) * STARPU_MAXMICDEVS + (peer_id) +  2 * STARPU_MAXMICDEVS + STARPU_MIC_PORTS_BEGIN + 2)
-
-#define STARPU_MIC_PAGE_SIZE 0x1000
-#define STARPU_MIC_GET_PAGE_SIZE_MULTIPLE(size) \
-(((size) % STARPU_MIC_PAGE_SIZE == 0) ? (size) : (((size) / STARPU_MIC_PAGE_SIZE + 1) * STARPU_MIC_PAGE_SIZE))
-
-#define STARPU_MIC_COMMON_REPORT_SCIF_ERROR(status) \
-	_starpu_mic_common_report_scif_error(__starpu_func__, __FILE__, __LINE__, status)
-
-struct _starpu_mic_free_command
-{
-	void *addr;
-	size_t size;
-};
-
-void _starpu_mic_common_report_scif_error(const char *func, const char *file, int line, const int status);
-
-void _starpu_mic_common_send(const struct _starpu_mp_node *node, void *msg, int len);
-
-void _starpu_mic_common_recv(const struct _starpu_mp_node *node, void *msg, int len);
-
-void _starpu_mic_common_dt_send(const struct _starpu_mp_node *node, void *msg, int len);
-
-void _starpu_mic_common_dt_recv(const struct _starpu_mp_node *node, void *msg, int len);
-
-void _starpu_mic_common_connect(scif_epd_t *endpoint, uint16_t remote_node, 
-				uint16_t local_port_number, uint16_t remote_port_number);
-void _starpu_mic_common_accept(scif_epd_t *endpoint, uint16_t port_number);
-
-#endif /* STARPU_USE_MIC */
-
-#endif /* __DRIVER_MIC_COMMON_H__ */

+ 0 - 135
src/drivers/mic/driver_mic_sink.c

@@ -1,135 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#include <errno.h>
-
-#include <common/COISysInfo_common.h>
-
-#include <starpu.h>
-#include <drivers/mp_common/mp_common.h>
-#include <drivers/mp_common/sink_common.h>
-
-#include "driver_mic_common.h"
-#include "driver_mic_sink.h"
-
-/* Initialize the MIC sink, initializing connection to the source
- * and to the other devices (not implemented yet).
- */
-
-void _starpu_mic_sink_init(struct _starpu_mp_node *node)
-{
-	//unsigned int i;
-	
-	/* Initialize connection with the source */
-	_starpu_mic_common_accept(&node->mp_connection.mic_endpoint,
-					 STARPU_MIC_SOURCE_PORT_NUMBER);
-
-	_starpu_mic_common_accept(&node->host_sink_dt_connection.mic_endpoint,
-									 STARPU_MIC_SOURCE_DT_PORT_NUMBER);
-
-	//node->sink_sink_dt_connections = malloc(node->nb_mp_sinks * sizeof(union _starpu_mp_connection));
-
-	//for (i = 0; i < (unsigned int)node->devid; ++i)
-	//	_starpu_mic_common_connect(&node->sink_sink_dt_connections[i].mic_endpoint,
-	//								STARPU_TO_MIC_ID(i),
-	//								STARPU_MIC_SINK_SINK_DT_PORT_NUMBER(node->devid, i),	
-	//								STARPU_MIC_SINK_SINK_DT_PORT_NUMBER(i, node->devid));
-
-	//for (i = node->devid + 1; i < node->nb_mp_sinks; ++i)
-	//	_starpu_mic_common_accept(&node->sink_sink_dt_connections[i].mic_endpoint,
-	//								STARPU_MIC_SINK_SINK_DT_PORT_NUMBER(node->devid, i));
-}
-
-/* Deinitialize the MIC sink, close all the connections.
- */
-
-void _starpu_mic_sink_deinit(struct _starpu_mp_node *node)
-{
-	//unsigned int i;
-
-	//for (i = 0; i < node->nb_mp_sinks; ++i)
-	//{
-	//	if (i != (unsigned int)node->devid)
-	//		scif_close(node->sink_sink_dt_connections[i].mic_endpoint);
-	//}
-
-	//free(node->sink_sink_dt_connections);
-
-	scif_close(node->host_sink_dt_connection.mic_endpoint);
-	scif_close(node->mp_connection.mic_endpoint);
-}
-
-/* Report an error which occured when using a MIC device
- * and print this error in a human-readable style
- */
-
-void _starpu_mic_sink_report_error(const char *func, const char *file, const int line, const int status)
-{
-	const char *errormsg = strerror(status);
-	printf("SINK: oops in %s (%s:%u)... %d: %s \n", func, file, line, status, errormsg);
-	STARPU_ASSERT(0);
-}
-
-/* Return the number of cores on the callee, a MIC device or Processor Xeon
- */
-unsigned int _starpu_mic_sink_get_nb_core(void)
-{
-	return (unsigned int) COISysGetCoreCount();
-}
-
-/* Allocate memory on the MIC.
- * Memory is register for remote direct access. */
-void _starpu_mic_sink_allocate(const struct _starpu_mp_node *mp_node, void *arg, int arg_size)
-{
-	STARPU_ASSERT(arg_size == sizeof(size_t));
-
-	void *addr = NULL;
-	size_t size = *(size_t *)(arg);
-	
-	if (posix_memalign(&addr, STARPU_MIC_PAGE_SIZE, size) != 0)
-		_starpu_mp_common_send_command(mp_node, STARPU_ERROR_ALLOCATE, NULL, 0);
-
-#ifndef STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY
-	scif_epd_t epd = mp_node->host_sink_dt_connection.mic_endpoint;
-	size_t window_size = STARPU_MIC_GET_PAGE_SIZE_MULTIPLE(size);
-
-	if (scif_register(epd, addr, window_size, (off_t)addr, SCIF_PROT_READ | SCIF_PROT_WRITE, SCIF_MAP_FIXED) < 0)
-	{
-		free(addr);
-		_starpu_mp_common_send_command(mp_node, STARPU_ERROR_ALLOCATE, NULL, 0);
-	}
-#endif
-	
-	_starpu_mp_common_send_command(mp_node, STARPU_ANSWER_ALLOCATE, &addr, sizeof(addr));
-}
-
-/* Unregister and free memory. */
-void _starpu_mic_sink_free(const struct _starpu_mp_node *mp_node STARPU_ATTRIBUTE_UNUSED, void *arg, int arg_size)
-{
-	STARPU_ASSERT(arg_size == sizeof(struct _starpu_mic_free_command));
-
-	void *addr = ((struct _starpu_mic_free_command *)arg)->addr;
-	
-#ifndef STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY
-	scif_epd_t epd = mp_node->host_sink_dt_connection.mic_endpoint;
-	size_t size = ((struct _starpu_mic_free_command *)arg)->size;
-	size_t window_size = STARPU_MIC_GET_PAGE_SIZE_MULTIPLE(size);
-
-	scif_unregister(epd, (off_t)addr, window_size);
-#endif
-	free(addr);
-}

+ 0 - 48
src/drivers/mic/driver_mic_sink.h

@@ -1,48 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#ifndef __DRIVER_MIC_SINK_H__
-#define __DRIVER_MIC_SINK_H__
-
-#include <common/config.h>
-
-#ifdef STARPU_USE_MIC
-
-#include <scif.h>
-
-#include <drivers/mp_common/mp_common.h>
-#include <drivers/mp_common/sink_common.h>
-
-
-#define STARPU_MIC_SINK_REPORT_ERROR(status) \
-	_starpu_mic_sink_report_error(__starpu_func__, __FILE__, __LINE__, status)
-
-
-void _starpu_mic_sink_report_error(const char *func, const char *file, const int line, const int status);
-
-void _starpu_mic_sink_init(struct _starpu_mp_node *node);
-
-void _starpu_mic_sink_deinit(struct _starpu_mp_node *node);
-
-unsigned int _starpu_mic_sink_get_nb_core(void);
-
-void _starpu_mic_sink_allocate(const struct _starpu_mp_node *mp_node, void *arg, int arg_size);
-void _starpu_mic_sink_free(const struct _starpu_mp_node *mp_node STARPU_ATTRIBUTE_UNUSED, void *arg, int arg_size);
-
-#endif /* STARPU_USE_MIC */
-
-
-#endif /* __DRIVER_MIC_SINK_H__ */

+ 0 - 713
src/drivers/mic/driver_mic_source.c

@@ -1,713 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <stdio.h>
-
-#include <scif.h>
-
-#include <starpu.h>
-#include <starpu_profiling.h>
-#include <core/sched_policy.h>
-#include <common/uthash.h>
-
-#include <drivers/driver_common/driver_common.h>
-#include <drivers/mp_common/source_common.h>
-
-#include "driver_mic_common.h"
-#include "driver_mic_source.h"
-
-
-/* Array of structures containing all the informations useful to send
- * and receive informations with devices */
-struct _starpu_mp_node *mic_nodes[STARPU_MAXMICDEVS];
-
-static COIENGINE handles[STARPU_MAXMICDEVS];
-
-/* Structure used by host to store informations about a kernel executable on
- * a MIC device : its name, and its address on each device.
- * If a kernel has been initialized, then a lookup has already been achieved and the
- * device knows how to call it, else the host still needs to do a lookup.
- */
-struct _starpu_mic_kernel
-{
-	UT_hash_handle hh;
-	char *name;
-	starpu_mic_kernel_t func[STARPU_MAXMICDEVS];
-} *kernels;
-
-/* Mutex for concurrent access to the table.
- */
-starpu_pthread_mutex_t htbl_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-/* Number of MIC worker initialized.
- */
-unsigned int nb_mic_worker_init = 0;
-starpu_pthread_mutex_t nb_mic_worker_init_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-/* Returns the ID of the MIC device controlled by the caller.
- * if the worker doesn't control a MIC device -ENODEV is returned
- */
-
-//static int _starpu_mic_get_devid(void)
-//{
-//	struct _starpu_machine_config *config = _starpu_get_machine_config();
-//	int workerid = starpu_worker_get_id();
-//
-//	if (config->workers[workerid].arch != STARPU_MIC_WORKER)
-//		return -ENODEV;
-//
-//	return config->workers[workerid].devid;
-//}
-
-const struct _starpu_mp_node *_starpu_mic_src_get_actual_thread_mp_node()
-{
-	struct _starpu_worker *actual_worker = _starpu_get_local_worker_key();
-	STARPU_ASSERT(actual_worker);
-
-	int nodeid = actual_worker->mp_nodeid;
-	STARPU_ASSERT(nodeid >= 0 && nodeid < STARPU_MAXMICDEVS);
-
-	return mic_nodes[nodeid];
-}
-
-const struct _starpu_mp_node *_starpu_mic_src_get_mp_node_from_memory_node(int memory_node)
-{
-	int nodeid = _starpu_memory_node_get_devid(memory_node);
-	STARPU_ASSERT_MSG(nodeid >= 0 && nodeid < STARPU_MAXMICDEVS, "bogus nodeid %d for memory node %d\n", nodeid, memory_node);
-
-	return mic_nodes[nodeid];
-}
-
-static void _starpu_mic_src_free_kernel(void *kernel)
-{
-	struct _starpu_mic_kernel *k = kernel;
-
-	free(k->name);
-	free(kernel);
-}
-
-void _starpu_mic_clear_kernels(void)
-{
-	struct _starpu_mic_kernel *kernel, *tmp;
-	HASH_ITER(hh, kernels, kernel, tmp)
-	{
-		HASH_DEL(kernels, kernel);
-		free(kernel);
-	}
-}
-
-static int
-_starpu_mic_src_finalize_job (struct _starpu_job *j, struct _starpu_worker *worker)
-{
-	uint32_t mask = 0;
-	int profiling = starpu_profiling_status_get();
-	struct timespec codelet_end;
-
-	_starpu_driver_end_job(worker, j, worker->perf_arch, &codelet_end, 0,
-			       profiling);
-
-	_starpu_driver_update_job_feedback(j, worker, worker->perf_arch,
-					   &j->cl_start, &codelet_end,
-					   profiling);
-
-	_starpu_push_task_output (j, mask);
-
-	_starpu_handle_job_termination(j);
-
-	return 0;
-}
-
-static int
-_starpu_mic_src_process_completed_job (struct _starpu_worker_set *workerset)
-{
-	struct _starpu_mp_node *node = mic_nodes[workerset->workers[0].mp_nodeid];
-	enum _starpu_mp_command answer;
-	void *arg;
-	int arg_size;
-
-	answer = _starpu_mp_common_recv_command (node, &arg, &arg_size);
-	STARPU_ASSERT (answer == STARPU_EXECUTION_COMPLETED);
-
-	void *arg_ptr = arg;
-	int coreid;
-
-	coreid = *(int *) arg_ptr;
-	arg_ptr += sizeof (coreid); // Useless.
-
-	struct _starpu_worker *worker = &workerset->workers[coreid];
-	struct starpu_task *task = worker->current_task;
-	struct _starpu_job *j = _starpu_get_job_associated_to_task (task);
-
-	_starpu_mic_src_finalize_job (j, worker);
-
-	worker->current_task = NULL;
-
-	return 0;
-}
-
-
-static int _starpu_mic_src_execute_job(struct _starpu_job *j, struct _starpu_worker *args)
-{
-	int ret;
-	uint32_t mask = 0;
-
-	STARPU_ASSERT(j);
-	struct starpu_task *task = j->task;
-
-	//struct timespec codelet_end;
-
-	int profiling = starpu_profiling_status_get();
-	unsigned calibrate_model = 0;
-
-	STARPU_ASSERT(task);
-	struct starpu_codelet *cl = task->cl;
-	STARPU_ASSERT(cl);
-
-	if (cl->model && cl->model->benchmarking)
-		calibrate_model = 1;
-
-	ret = _starpu_fetch_task_input(j, mask);
-	if (ret != 0)
-	{
-		/* there was not enough memory, so the input of
-		 * the codelet cannot be fetched ... put the
-		 * codelet back, and try it later */
-		return -EAGAIN;
-	}
-
-
-	starpu_mic_kernel_t kernel = _starpu_mic_src_get_kernel_from_codelet(j->task->cl, j->nimpl);
-
-	_starpu_driver_start_job (args, j, &j->cl_start, 0, profiling);
-
-	_starpu_src_common_execute_kernel_from_task(mic_nodes[args->mp_nodeid],
-						    (void (*)(void)) kernel, args->devid, task);
-
-	return 0;
-}
-
-int _starpu_mic_src_register_kernel(starpu_mic_func_symbol_t *symbol, const char *func_name)
-{
-	unsigned int func_name_size = (strlen(func_name) + 1) * sizeof(char);
-
-	STARPU_PTHREAD_MUTEX_LOCK(&htbl_mutex);
-	struct _starpu_mic_kernel *kernel;
-	
-	HASH_FIND_STR(kernels, func_name, kernel);
-
-	if (kernel != NULL)
-	{
-		STARPU_PTHREAD_MUTEX_UNLOCK(&htbl_mutex);
-		// Function already in the table.
-		*symbol = kernel;
-		return 0;
-	}
-
-	kernel = malloc(sizeof(*kernel));
-	if (kernel == NULL)
-	{
-		STARPU_PTHREAD_MUTEX_UNLOCK(&htbl_mutex);
-		return -ENOMEM;
-	}
-
-	kernel->name = malloc(func_name_size);
-	if (kernel->name == NULL)
-	{
-		STARPU_PTHREAD_MUTEX_UNLOCK(&htbl_mutex);
-		free(kernel);
-		return -ENOMEM;
-	}
-
-	memcpy(kernel->name, func_name, func_name_size);
-
-	HASH_ADD_STR(kernels, name, kernel);
-
-	unsigned int nb_mic_devices = _starpu_mic_src_get_device_count();
-	unsigned int i;
-	for (i = 0; i < nb_mic_devices; ++i)
-		kernel->func[i] = NULL;
-
-	STARPU_PTHREAD_MUTEX_UNLOCK(&htbl_mutex);
-
-	*symbol = kernel;
-
-	return 0;
-}
-
-starpu_mic_kernel_t _starpu_mic_src_get_kernel(starpu_mic_func_symbol_t symbol)
-{
-	int workerid = starpu_worker_get_id();
-	/* This function has to be called in the codelet only, by the thread
-	 * which will handle the task */
-	if (workerid < 0)
-		return NULL;
-
-	int nodeid = starpu_worker_get_mp_nodeid(workerid);
-
-	struct _starpu_mic_kernel *kernel = symbol;
-
-	if (kernel->func[nodeid] == NULL)
-	{
-		struct _starpu_mp_node *node = mic_nodes[nodeid];
-		int ret = _starpu_src_common_lookup(node, (void (**)(void))&kernel->func[nodeid], kernel->name);
-		if (ret)
-			return NULL;
-	}
-
-	return kernel->func[nodeid];
-}
-
-/* Report an error which occured when using a MIC device
- * and print this error in a human-readable style.
- * It hanbles errors occuring when using COI.
- */
-
-void _starpu_mic_src_report_coi_error(const char *func, const char *file,
-				      const int line, const COIRESULT status)
-{
-	const char *errormsg = COIResultGetName(status);
-	printf("SRC: oops in %s (%s:%u)... %d: %s \n", func, file, line, status, errormsg);
-	STARPU_ASSERT(0);
-}
-
-/* Report an error which occured when using a MIC device
- * and print this error in a human-readable style.
- * It hanbles errors occuring when using SCIF.
- */
-
-void _starpu_mic_src_report_scif_error(const char *func, const char *file, const int line, const int status)
-{
-	const char *errormsg = strerror(status);
-	printf("SRC: oops in %s (%s:%u)... %d: %s \n", func, file, line, status, errormsg);
-	STARPU_ASSERT(0);
-}
-
-/* Return the number of MIC devices in the system.
- * If the number of devices is already known, we use the cached value
- * without calling again COI. */
-
-unsigned _starpu_mic_src_get_device_count(void)
-{
-	static unsigned short cached = 0;
-	static unsigned nb_devices = 0;
-
-	/* We don't need to call the COI API again if we already
-	 * have the result in cache */
-	if (!cached)
-	{
-		COIRESULT res;
-		res = COIEngineGetCount(COI_ISA_MIC, &nb_devices);
-
-		/* If something is wrong with the COI engine, we shouldn't
-		 * use MIC devices (if there is any...) */
-		if (res != COI_SUCCESS)
-			nb_devices = 0;
-
-		cached = 1;
-	}
-
-	return nb_devices;
-}
-
-unsigned starpu_mic_device_get_count(void)
-{
-    // Return the number of configured MIC devices.
-    struct _starpu_machine_config *config = _starpu_get_machine_config ();
-    struct starpu_machine_topology *topology = &config->topology;
-
-    return topology->nmicdevices;
-}
-
-starpu_mic_kernel_t _starpu_mic_src_get_kernel_from_codelet(struct starpu_codelet *cl, unsigned nimpl)
-{
-	starpu_mic_kernel_t kernel = NULL;
-
-	starpu_mic_func_t func = _starpu_task_get_mic_nth_implementation(cl, nimpl);
-	if (func)
-	{
-		/* We execute the function contained in the codelet, it must return a
-		 * pointer to the function to execute on the device, either specified
-		 * directly by the user or by a call to starpu_mic_get_func().
-		 */
-		kernel = func();
-	}
-	else
-	{
-		/* If user dont define any starpu_mic_fun_t in cl->mic_func we try to use
-		 * cpu_func_name.
-		 */
-		char *func_name = _starpu_task_get_cpu_name_nth_implementation(cl, nimpl);
-		if (func_name)
-		{
-			starpu_mic_func_symbol_t symbol;
-
-			_starpu_mic_src_register_kernel(&symbol, func_name);
-
-			kernel = _starpu_mic_src_get_kernel(symbol);
-		}
-	}
-	STARPU_ASSERT(kernel);
-
-	return kernel;
-}
-
-/* Initialize the node structure describing the MIC source.
- */
-void _starpu_mic_src_init(struct _starpu_mp_node *node)
-{
-	/* Let's initialize the connection with the peered sink device */
-	_starpu_mic_common_connect(&node->mp_connection.mic_endpoint,
-					    STARPU_TO_MIC_ID(node->peer_id),
-					    STARPU_MIC_SINK_PORT_NUMBER(node->peer_id),
-					    STARPU_MIC_SOURCE_PORT_NUMBER);
-
-	_starpu_mic_common_connect(&node->host_sink_dt_connection.mic_endpoint,
-				   STARPU_TO_MIC_ID(node->peer_id),
-				   STARPU_MIC_SINK_DT_PORT_NUMBER(node->peer_id),
-				   STARPU_MIC_SOURCE_DT_PORT_NUMBER);
-}
-
-/* Deinitialize the MIC sink, close all the connections.
- */
-void _starpu_mic_src_deinit(struct _starpu_mp_node *node)
-{
-	scif_close(node->host_sink_dt_connection.mic_endpoint);
-	scif_close(node->mp_connection.mic_endpoint);
-}
-
-/* Get infos of the MIC associed to memory_node */
-static void _starpu_mic_get_engine_info(COI_ENGINE_INFO *info, int devid)
-{
-	STARPU_ASSERT(devid >= 0 && devid < STARPU_MAXMICDEVS);
-
-	if (COIEngineGetInfo(handles[devid], sizeof(*info), info) != COI_SUCCESS)
-		STARPU_MIC_SRC_REPORT_COI_ERROR(errno);
-}
-
-/* TODO: call _starpu_memory_manager_set_global_memory_size instead */
-/* Return the size of the memory on the MIC associed to memory_node */
-size_t _starpu_mic_get_global_mem_size(int devid)
-{
-	COI_ENGINE_INFO infos;
-	_starpu_mic_get_engine_info(&infos, devid);
-
-	return infos.PhysicalMemory;
-}
-
-/* Return the size of the free memory on the MIC associed to memory_node */
-size_t _starpu_mic_get_free_mem_size(int devid)
-{
-	COI_ENGINE_INFO infos;
-	_starpu_mic_get_engine_info(&infos, devid);
-
-	return infos.PhysicalMemoryFree;
-}
-
-/* Allocate memory on MIC.
- * Return 0 if OK or 1 if not.
- */
-int _starpu_mic_allocate_memory(void **addr, size_t size, unsigned memory_node)
-{
-	/* We check we have (1.25 * size) free space in the MIC because
-	 * transfert with scif is not possible when the MIC
-	 * doesn't have enought free memory.
-	 * In this cas we can't tell any things to the host. */
-	//int devid = _starpu_memory_node_get_devid(memory_node);
-	//if (_starpu_mic_get_free_mem_size(devid) < size * 1.25)
-	//	return 1;
-
-	const struct _starpu_mp_node *mp_node = _starpu_mic_src_get_mp_node_from_memory_node(memory_node);
-
-	return _starpu_src_common_allocate(mp_node, addr, size);
-}
-
-/* Free memory on MIC.
- * Mic need size to free memory for use the function scif_unregister.
- */
-void _starpu_mic_free_memory(void *addr, size_t size, unsigned memory_node)
-{
-	const struct _starpu_mp_node *mp_node = _starpu_mic_src_get_mp_node_from_memory_node(memory_node);
-	struct _starpu_mic_free_command cmd = {addr, size};
-
-	return _starpu_mp_common_send_command(mp_node, STARPU_FREE, &cmd, sizeof(cmd));
-}
-
-/* Transfert SIZE bytes from the address pointed by SRC in the SRC_NODE memory
- * node to the address pointed by DST in the DST_NODE memory node
- */
-int _starpu_mic_copy_ram_to_mic(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size)
-{
-	const struct _starpu_mp_node *mp_node = _starpu_mic_src_get_mp_node_from_memory_node(dst_node);
-
-	return _starpu_src_common_copy_host_to_sink(mp_node, src, dst, size);
-}
-
-/* Transfert SIZE bytes from the address pointed by SRC in the SRC_NODE memory
- * node to the address pointed by DST in the DST_NODE memory node
- */
-int _starpu_mic_copy_mic_to_ram(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size)
-{
-	const struct _starpu_mp_node *mp_node = _starpu_mic_src_get_mp_node_from_memory_node(src_node);
-
-	return _starpu_src_common_copy_sink_to_host(mp_node, src, dst, size);
-}
-
-/* Asynchronous transfers */
-int _starpu_mic_copy_ram_to_mic_async(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size)
-{
-	const struct _starpu_mp_node *mp_node = _starpu_mic_src_get_mp_node_from_memory_node(dst_node);
-
-	if (scif_vwriteto(mp_node->host_sink_dt_connection.mic_endpoint, src, size, (off_t)dst, 0) < 0)
-		STARPU_MIC_SRC_REPORT_SCIF_ERROR(errno);
-
-	return 0;
-}
-
-int _starpu_mic_copy_mic_to_ram_async(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size)
-{
-	const struct _starpu_mp_node *mp_node = _starpu_mic_src_get_mp_node_from_memory_node(src_node);
-
-	if (scif_vreadfrom(mp_node->host_sink_dt_connection.mic_endpoint, dst, size, (off_t)src, 0) < 0)
-		STARPU_MIC_SRC_REPORT_SCIF_ERROR(errno);
-
-	return 0;
-}
-
-/* Initialize a _starpu_mic_async_event. */
-int _starpu_mic_init_event(struct _starpu_mic_async_event *event, unsigned memory_node)
-{
-	const struct _starpu_mp_node *mp_node = _starpu_mic_src_get_mp_node_from_memory_node(memory_node);
-	scif_epd_t epd = mp_node->host_sink_dt_connection.mic_endpoint;
-
-	event->memory_node = memory_node;
-
-	/* Address of allocation must be multiple of the page size. */
-	if (posix_memalign((void **)&(event->signal), 0x1000, sizeof(*(event->signal))) != 0)
-		return -ENOMEM;
-	*(event->signal) = 0;
-
-	/* The size pass to scif_register is 0x1000 because it should be a multiple of the page size. */
-	if (scif_register(epd, event->signal, 0x1000, (off_t)(event->signal), SCIF_PROT_WRITE, SCIF_MAP_FIXED) < 0)
-		STARPU_MIC_SRC_REPORT_SCIF_ERROR(errno);
-
-	/* Mark for a futur wait. */
-	if (scif_fence_mark(epd, SCIF_FENCE_INIT_SELF, &(event->mark)) < 0)
-		STARPU_MIC_SRC_REPORT_SCIF_ERROR(errno);
-
-	/* Tell to scif to write STARPU_MIC_REQUEST_COMPLETE in event->signal when the transfer is complete.
-	 * We use this for test the end of a transfer. */
-	if (scif_fence_signal(epd, (off_t)event->signal, STARPU_MIC_REQUEST_COMPLETE, 0, 0, SCIF_FENCE_INIT_SELF | SCIF_SIGNAL_LOCAL) < 0)
-		STARPU_MIC_SRC_REPORT_SCIF_ERROR(errno);
-
-	return 0;
-}
-
-/* Wait the end of the asynchronous request */
-void _starpu_mic_wait_request_completion(struct _starpu_mic_async_event *event)
-{
-	if (event->signal != NULL)
-	{
-		const struct _starpu_mp_node *mp_node = _starpu_mic_src_get_mp_node_from_memory_node(event->memory_node);
-		scif_epd_t epd = mp_node->host_sink_dt_connection.mic_endpoint;
-
-		if (scif_fence_wait(epd, event->mark) < 0)
-			STARPU_MIC_SRC_REPORT_SCIF_ERROR(errno);
-
-		if (scif_unregister(epd, (off_t)(event->signal), 0x1000) < 0)
-			STARPU_MIC_SRC_REPORT_SCIF_ERROR(errno);
-
-		free(event->signal);
-		event->signal = NULL;
-	}
-}
-
-/* Test if a asynchronous request is end.
- * Return 1 if is end, 0 else. */
-int _starpu_mic_request_is_complete(struct _starpu_mic_async_event *event)
-{
-	if (event->signal != NULL && *(event->signal) != STARPU_MIC_REQUEST_COMPLETE)
-		return 0;
-
-	const struct _starpu_mp_node *mp_node = _starpu_mic_src_get_mp_node_from_memory_node(event->memory_node);
-	scif_epd_t epd = mp_node->host_sink_dt_connection.mic_endpoint;
-
-	if (scif_unregister(epd, (off_t)(event->signal), 0x1000) < 0)
-		STARPU_MIC_SRC_REPORT_SCIF_ERROR(errno);
-
-	free(event->signal);
-	event->signal = NULL;
-	return 1;
-}
-
-void *_starpu_mic_src_worker(void *arg)
-{
-	struct _starpu_worker_set *args = arg;
-	/* As all workers of a set share common data, we just use the first
-	 * one for intializing the following stuffs. */
-	struct _starpu_worker *baseworker = &args->workers[0];
-	struct _starpu_machine_config *config = baseworker->config;
-	unsigned baseworkerid = baseworker - config->workers;
-	unsigned mp_nodeid = baseworker->mp_nodeid;
-	unsigned i;
-
-	unsigned memnode = baseworker->memory_node;
-
-	_starpu_worker_init(baseworker, _STARPU_FUT_MIC_KEY);
-
-	// Current task for a thread managing a worker set has no sense.
-	_starpu_set_current_task(NULL);
-
-	for (i = 0; i < config->topology.nmiccores[mp_nodeid]; i++)
-	{
-		struct _starpu_worker *worker = &config->workers[baseworkerid+i];
-		snprintf(worker->name, sizeof(worker->name), "MIC %d core %u", mp_nodeid, i);
-	}
-
-	baseworker->status = STATUS_UNKNOWN;
-
-	_STARPU_TRACE_WORKER_INIT_END;
-
-	/* tell the main thread that this one is ready */
-	STARPU_PTHREAD_MUTEX_LOCK(&args->mutex);
-	args->set_is_initialized = 1;
-	STARPU_PTHREAD_COND_SIGNAL(&args->ready_cond);
-	STARPU_PTHREAD_MUTEX_UNLOCK(&args->mutex);
-
-
-	while (_starpu_machine_is_running())
-	{
-		int res;
-		struct starpu_task *task = NULL;
-		struct _starpu_job * j;
-		unsigned micworkerid = 0;
-
-		_STARPU_TRACE_START_PROGRESS(memnode);
-		_starpu_datawizard_progress(memnode, 1);
-		_STARPU_TRACE_END_PROGRESS(memnode);
-
-		STARPU_PTHREAD_MUTEX_LOCK(&baseworker->sched_mutex);
-
-		/* We pop tasklists of each worker in the set and process the
-		 * first non-empty list. */
-		for (micworkerid = 0 ; (micworkerid < args->nworkers) && (task == NULL); micworkerid++)
-		    task = _starpu_pop_task (&args->workers[micworkerid]);
-
-		if (task != NULL) {
-			micworkerid--;
-			goto task_found;
-		}
-
-#if 0 // XXX: synchronous execution for now
-		/* No task to submit, so we can poll the MIC device for
-		 * completed jobs. */
-		struct pollfd fd = {
-		    .fd = mic_nodes[baseworker->mp_nodeid]->mp_connection.mic_endpoint,
-		    .events = POLLIN
-		};
-
-		if (0 < poll (&fd, 1, 0)) {
-		    _starpu_mic_src_process_completed_job (args);
-		    goto restart_loop;
-		}
-#endif
-
-		/* At this point, there is really nothing to do for the thread
-		 * so we can block.
-		 * XXX: blocking drivers is in fact broken. DO NOT USE IT ! */
-		if (_starpu_worker_get_status(baseworkerid) != STATUS_SLEEPING)
-		{
-			_STARPU_TRACE_WORKER_SLEEP_START;
-			_starpu_worker_restart_sleeping(baseworkerid);
-			_starpu_worker_set_status(baseworkerid, STATUS_SLEEPING);
-		}
-
-		if (_starpu_worker_can_block(memnode))
-			STARPU_PTHREAD_COND_WAIT(&baseworker->sched_cond, &baseworker->sched_mutex);
-		else
-		{
-			if (_starpu_machine_is_running())
-				STARPU_UYIELD();
-		}
-
-		if (_starpu_worker_get_status(baseworkerid) == STATUS_SLEEPING)
-		{
-			_STARPU_TRACE_WORKER_SLEEP_END;
-			_starpu_worker_stop_sleeping(baseworkerid);
-			_starpu_worker_set_status(baseworkerid, STATUS_UNKNOWN);
-		}
-
-	restart_loop:
-		STARPU_PTHREAD_MUTEX_UNLOCK(&baseworker->sched_mutex);
-		continue;
-
-	task_found:
-		/* If the MIC core associated to `micworkerid' is already
-		 * processing a job, we push back this one in the worker task
-		 * list. */
-		STARPU_PTHREAD_MUTEX_UNLOCK(&baseworker->sched_mutex);
-
-		if (args->workers[micworkerid].current_task) {
-		    _starpu_push_task_to_workers(task);
-		    continue;
-		}
-
-		STARPU_ASSERT(task);
-		j = _starpu_get_job_associated_to_task(task);
-
-		/* can a MIC device do that task ? */
-		if (!_STARPU_MIC_MAY_PERFORM(j))
-		{
-			/* this isn't a mic task */
-			_starpu_push_task_to_workers(task);
-			continue;
-		}
-
-		args->workers[micworkerid].current_task = j->task;
-
-		res = _starpu_mic_src_execute_job (j, &args->workers[micworkerid]);
-
-		if (res)
-		{
-			switch (res)
-			{
-				case -EAGAIN:
-					_STARPU_DISP("ouch, put the codelet %p back ... \n", j);
-					_starpu_push_task_to_workers(task);
-					STARPU_ABORT();
-					continue;
-				default:
-					STARPU_ASSERT(0);
-			}
-		}
-
-		/* XXX: synchronous execution for now */
-		_starpu_mic_src_process_completed_job (args);
-	}
-
-	_STARPU_TRACE_WORKER_DEINIT_START;
-
-	_starpu_handle_all_pending_node_data_requests(memnode);
-
-	/* In case there remains some memory that was automatically
-	 * allocated by StarPU, we release it now. Note that data
-	 * coherency is not maintained anymore at that point ! */
-	_starpu_free_all_automatically_allocated_buffers(memnode);
-
-	_STARPU_TRACE_WORKER_DEINIT_END(_STARPU_FUT_CUDA_KEY);
-
-	return NULL;
-
-}

+ 0 - 80
src/drivers/mic/driver_mic_source.h

@@ -1,80 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#ifndef __DRIVER_MIC_SOURCE_H__
-#define __DRIVER_MIC_SOURCE_H__
-
-#include <starpu_mic.h>
-#include <common/config.h>
-
-#ifdef STARPU_USE_MIC
-
-#include <source/COIProcess_source.h>
-#include <source/COIEngine_source.h>
-
-#include <drivers/mp_common/mp_common.h>
-
-/* Array of structures containing all the informations useful to send
- * and receive informations with devices */
-extern struct _starpu_mp_node *mic_nodes[STARPU_MAXMICDEVS];
-
-struct _starpu_mic_async_event *event;
-
-#define STARPU_MIC_REQUEST_COMPLETE 42
-
-#define STARPU_MIC_SRC_REPORT_COI_ERROR(status) \
-	_starpu_mic_src_report_coi_error(__starpu_func__, __FILE__, __LINE__, status)
-
-#define STARPU_MIC_SRC_REPORT_SCIF_ERROR(status) \
-	_starpu_mic_src_report_scif_error(__starpu_func__, __FILE__, __LINE__, status)
-
-const struct _starpu_mp_node *_starpu_mic_src_get_actual_thread_mp_node();
-const struct _starpu_mp_node *_starpu_mic_src_get_mp_node_from_memory_node(int memory_node);
-
-int _starpu_mic_src_register_kernel(starpu_mic_func_symbol_t *symbol, const char *func_name);
-starpu_mic_kernel_t _starpu_mic_src_get_kernel(starpu_mic_func_symbol_t symbol);
-
-void _starpu_mic_src_report_coi_error(const char *func, const char *file, int line, const COIRESULT status);
-void _starpu_mic_src_report_scif_error(const char *func, const char *file, int line, const int status);
-
-unsigned _starpu_mic_src_get_device_count(void);
-starpu_mic_kernel_t _starpu_mic_src_get_kernel_from_codelet(struct starpu_codelet *cl, unsigned nimpl);
-
-void _starpu_mic_src_init(struct _starpu_mp_node *node);
-void _starpu_mic_clear_kernels(void);
-void _starpu_mic_src_deinit(struct _starpu_mp_node *node);
-
-size_t _starpu_mic_get_global_mem_size(int devid);
-size_t _starpu_mic_get_free_mem_size(int devid);
-
-int _starpu_mic_allocate_memory(void **addr, size_t size, unsigned memory_node);
-void _starpu_mic_free_memory(void *addr, size_t size, unsigned memory_node);
-
-int _starpu_mic_copy_ram_to_mic(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size);
-int _starpu_mic_copy_mic_to_ram(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size);
-int _starpu_mic_copy_ram_to_mic_async(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size);
-int _starpu_mic_copy_mic_to_ram_async(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size);
-
-int _starpu_mic_init_event(struct _starpu_mic_async_event *event, unsigned memory_node);
-void _starpu_mic_wait_request_completion(struct _starpu_mic_async_event *event);
-int _starpu_mic_request_is_complete(struct _starpu_mic_async_event *event);
-
-void *_starpu_mic_src_worker(void *arg);
-
-#endif /* STARPU_USE_MIC */
-
-
-#endif /* __DRIVER_MIC_SOURCE_H__ */

+ 0 - 45
src/drivers/mic/driver_mic_utils.c

@@ -1,45 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#include <starpu.h>
-#include <starpu_mic.h>
-#include <common/config.h>
-
-#include <drivers/mp_common/source_common.h>
-#include <drivers/mic/driver_mic_source.h>
-
-
-/* Initiate a lookup on each MIC device to find the adress of the function
- * named FUNC_NAME, store them in the global array kernels and return
- * the index in the array through SYMBOL.
- * If success, returns 0. If the user has registered too many kernels (more
- * than STARPU_MAXMICDEVS) returns -ENOMEM
- */
-int starpu_mic_register_kernel(starpu_mic_func_symbol_t *symbol,
-			       const char *func_name)
-{
-	return _starpu_mic_src_register_kernel(symbol, func_name);
-}
-
-/* If success, return the pointer to the function defined by SYMBOL on the
- * device linked to the called 
- * device.
- */
-starpu_mic_kernel_t starpu_mic_get_kernel(starpu_mic_func_symbol_t symbol)
-{
-	return _starpu_mic_src_get_kernel(symbol);
-}

+ 0 - 234
src/drivers/mp_common/mp_common.c

@@ -1,234 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-
-#include <drivers/mp_common/mp_common.h>
-#include <drivers/mp_common/sink_common.h>
-#include <drivers/mic/driver_mic_common.h>
-#include <drivers/mic/driver_mic_source.h>
-#include <drivers/mic/driver_mic_sink.h>
-#include <drivers/scc/driver_scc_common.h>
-#include <drivers/scc/driver_scc_source.h>
-#include <drivers/scc/driver_scc_sink.h>
-
-/* Allocate and initialize the sink structure, when the function returns
- * all the pointer of functions are linked to the right ones.
- */
-struct _starpu_mp_node * __attribute__((malloc))
-    _starpu_mp_common_node_create(enum _starpu_mp_node_kind node_kind,
-				  int peer_id)
-{
-	struct _starpu_mp_node *node;
-
-	node = (struct _starpu_mp_node *) malloc(sizeof(struct _starpu_mp_node));
-
-	node->kind = node_kind;
-
-	node->peer_id = peer_id;
-
-	switch(node->kind)
-	{
-#ifdef STARPU_USE_MIC
-		case STARPU_MIC_SOURCE:
-			{
-				node->nb_mp_sinks = starpu_mic_worker_get_count();
-				node->devid = peer_id;
-
-				node->init = _starpu_mic_src_init;
-				node->deinit = _starpu_mic_src_deinit;
-				node->report_error = _starpu_mic_src_report_scif_error;
-
-				node->mp_send = _starpu_mic_common_send;
-				node->mp_recv = _starpu_mic_common_recv;
-				node->dt_send = _starpu_mic_common_dt_send;
-				node->dt_recv = _starpu_mic_common_dt_recv;
-
-				node->execute = NULL;
-				node->nbcores = NULL;
-				node->allocate = NULL;
-				node->free = NULL;
-
-				/* A source node is only working on one core,
-				 * there is no need for this function */
-				node->get_nb_core = NULL;
-			}
-			break;
-
-		case STARPU_MIC_SINK:
-			{
-				node->devid = atoi(getenv("DEVID"));;
-				node->nb_mp_sinks = atoi(getenv("NB_MIC"));
-
-				node->init = _starpu_mic_sink_init;
-				node->deinit = _starpu_mic_sink_deinit;
-				node->report_error = _starpu_mic_sink_report_error;
-
-				node->mp_send = _starpu_mic_common_send;
-				node->mp_recv = _starpu_mic_common_recv;
-				node->dt_send = _starpu_mic_common_dt_send;
-				node->dt_recv = _starpu_mic_common_dt_recv;
-
-				node->execute = _starpu_sink_common_execute;
-				node->nbcores = _starpu_sink_nbcores;
-				node->allocate = _starpu_mic_sink_allocate;
-				node->free = _starpu_mic_sink_free;
-
-				node->get_nb_core = _starpu_mic_sink_get_nb_core;
-			}
-			break;
-#endif /* STARPU_USE_MIC */
-
-#ifdef STARPU_USE_SCC
-		case STARPU_SCC_SOURCE:
-			{
-				node->init = _starpu_scc_src_init;
-				node->deinit = NULL;
-				node->report_error = _starpu_scc_common_report_rcce_error;
-
-				node->mp_send = _starpu_scc_common_send;
-				node->mp_recv = _starpu_scc_common_recv;
-				node->dt_send = _starpu_scc_common_send;
-				node->dt_recv = _starpu_scc_common_recv;
-				node->dt_send_to_device = NULL;
-				node->dt_recv_from_device = NULL;
-
-				node->execute = NULL;
-				node->allocate = NULL;
-				node->free = NULL;
-
-				node->get_nb_core = NULL;
-			}
-			break;
-
-		case STARPU_SCC_SINK:
-			{
-				node->init = _starpu_scc_sink_init;
-				node->deinit = _starpu_scc_sink_deinit;
-				node->report_error = _starpu_scc_common_report_rcce_error;
-
-				node->mp_send = _starpu_scc_common_send;
-				node->mp_recv = _starpu_scc_common_recv;
-				node->dt_send = _starpu_scc_common_send;
-				node->dt_recv = _starpu_scc_common_recv;
-				node->dt_send_to_device = _starpu_scc_sink_send_to_device;
-				node->dt_recv_from_device = _starpu_scc_sink_recv_from_device;
-
-				node->execute = _starpu_scc_sink_execute;
-				node->allocate = _starpu_sink_common_allocate;
-				node->free = _starpu_sink_common_free;
-
-				node->get_nb_core = NULL;
-			}
-			break;
-#endif /* STARPU_USE_SCC */
-
-#ifdef STARPU_USE_MPI
-		case STARPU_MPI_SOURCE:
-			STARPU_ABORT();
-			break;
-
-		case STARPU_MPI_SINK:
-			STARPU_ABORT();
-			break;
-#endif /* STARPU_USE_MPI */
-
-		default:
-			STARPU_ASSERT(0);
-	}
-
-	/* Let's allocate the buffer, we want it to be big enough to contain
-	 * a command, an argument and the argument size */
-	node->buffer = (void *) malloc(BUFFER_SIZE);
-
-	if (node->init)
-		node->init(node);
-
-	return node;
-}
-
-/* Deinitialize the sink structure and release the structure */
-
-void _starpu_mp_common_node_destroy(struct _starpu_mp_node *node)
-{
-	if (node->deinit)
-		node->deinit(node);
-
-	free(node->buffer);
-
-	free(node);
-}
-
-/* Send COMMAND to RECIPIENT, along with ARG if ARG_SIZE is non-zero */
-
-void _starpu_mp_common_send_command(const struct _starpu_mp_node *node,
-				    const enum _starpu_mp_command command,
-				    void *arg, int arg_size)
-{
-	STARPU_ASSERT(arg_size <= BUFFER_SIZE);
-
-	/* MIC and MPI sizes are given through a int */
-	int command_size = sizeof(enum _starpu_mp_command);
-	int arg_size_size = sizeof(int);
-
-	/* Let's copy the data into the command line buffer */
-	memcpy(node->buffer, &command, command_size);
-	memcpy(node->buffer + command_size, &arg_size, arg_size_size);
-
-	node->mp_send(node, node->buffer, command_size + arg_size_size);
-
-	if (arg_size)
-		node->mp_send(node, arg, arg_size);
-}
-
-/* Return the command received from SENDER. In case SENDER sent an argument
- * beside the command, an address to a copy of this argument is returns in arg.
- * There is no need to free this address as it's not allocated at this time.
- * However, the data pointed by arg shouldn't be relied on after a new call to
- * STARPU_MP_COMMON_RECV_COMMAND as it might corrupt it.
- */
-
-enum _starpu_mp_command _starpu_mp_common_recv_command(const struct _starpu_mp_node *node,
-						       void **arg, int *arg_size)
-{
-	enum _starpu_mp_command command;
-
-	/* MIC and MPI sizes are given through a int */
-	int command_size = sizeof(enum _starpu_mp_command);
-	int arg_size_size = sizeof(int);
-
-	node->mp_recv(node, node->buffer, command_size + arg_size_size);
-
-	command = *((enum _starpu_mp_command *) node->buffer);
-	*arg_size = *((int *) (node->buffer + command_size));
-
-	/* If there is no argument (ie. arg_size == 0),
-	 * let's return the command right now */
-	if (!(*arg_size))
-	{
-		*arg = NULL;
-		return command;
-	}
-
-	STARPU_ASSERT(*arg_size <= BUFFER_SIZE);
-
-	node->mp_recv(node, node->buffer, *arg_size);
-
-	*arg = node->buffer;
-
-	return command;
-}

+ 0 - 178
src/drivers/mp_common/mp_common.h

@@ -1,178 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#ifndef __MP_COMMON_H__
-#define __MP_COMMON_H__
-
-#include <pthread.h>
-
-#include <starpu.h>
-#include <common/config.h>
-
-
-#ifdef STARPU_USE_MP
-
-#ifdef STARPU_USE_MIC
-#include <scif.h>
-#endif /* STARPU_USE_MIC */
-
-#define BUFFER_SIZE 256
-
-#define STARPU_MP_SRC_NODE 0
-#define STARPU_MP_SINK_NODE(a) ((a) + 1)
-
-#define STARPU_MP_COMMON_REPORT_ERROR(node, status) \
-	(node)->report_error(__starpu_func__, __FILE__, __LINE__, (status))
-
-
-enum _starpu_mp_command
-{
-	STARPU_EXIT = 0x00,
-	STARPU_EXECUTE = 0x01,
-	STARPU_ERROR_EXECUTE = 0x02,
-	STARPU_LOOKUP = 0X03,
-	STARPU_ANSWER_LOOKUP = 0X04,
-	STARPU_ERROR_LOOKUP = 0X05,
-	STARPU_ALLOCATE = 0x06,
-	STARPU_ANSWER_ALLOCATE = 0x07,
-	STARPU_ERROR_ALLOCATE = 0x08,
-	STARPU_FREE = 0x09,
-	STARPU_RECV_FROM_HOST = 0x10,
-	STARPU_SEND_TO_HOST = 0x11,
-	STARPU_RECV_FROM_SINK = 0x12,
-	STARPU_SEND_TO_SINK = 0x13,
-	STARPU_TRANSFER_COMPLETE = 0x14,
-	STARPU_SINK_NBCORES = 0x15,
-	STARPU_ANSWER_SINK_NBCORES = 0x16,
-	STARPU_EXECUTION_SUBMITTED = 0x17,
-	STARPU_EXECUTION_COMPLETED = 0x18
-};
-
-enum _starpu_mp_node_kind
-{
-	STARPU_MIC_SINK,
-	STARPU_MIC_SOURCE,
-	STARPU_SCC_SINK,
-	STARPU_SCC_SOURCE,
-	STARPU_MPI_SINK,
-	STARPU_MPI_SOURCE,
-	STARPU_INVALID_KIND
-};
-
-union _starpu_mp_connection
-{
-#ifdef STARPU_USE_MIC
-	scif_epd_t mic_endpoint;
-#endif
-#ifdef STARPU_USE_SCC
-	int scc_nodeid;
-#endif
-	int mpi_nodeid;
-};
-
-struct _starpu_mp_transfer_command
-{
-	size_t size;
-	void *addr;
-};
-
-struct _starpu_mp_transfer_command_to_device
-{
-	int devid;
-	size_t size;
-	void *addr;
-};
-
-/* Message-passing working node, whether source
- * or sink */
-struct _starpu_mp_node
-{
-	enum _starpu_mp_node_kind kind;
-
-	/* Buffer used for scif data transfers, allocated
-	 * during node initialization.
-	 * Size : BUFFER_SIZE */
-	void *buffer;
-
-	/* For sink : -1.
-	 * For host : index of the sink = devid.
-	 */
-	int peer_id;
-
-	/* Only MIC use this for now !!
-	 * This is the devid both for the sink and the host. */
-	int devid;
-
-	/* Only MIC use this for now !!
-	*  Is the number ok MIC on the system. */
-	unsigned int nb_mp_sinks;
-
-	/* Connection used for command passing between the host thread and the
-	 * sink it controls */
-	union _starpu_mp_connection mp_connection;
-
-	/* Only MIC use this for now !!
-	 * Connection used for data transfers between the host and his sink. */
-	union _starpu_mp_connection host_sink_dt_connection;
-
-	/* Only MIC use this for now !!
-	 * Only sink use this for now !!
-	 * Connection used for data transfer between devices.
-	 * A sink opens a connection with each other sink,
-	 * thus each sink can directly send data to each other.
-	 * For sink :
-	 *  - sink_sink_dt_connections[i] is the connection to the sink number i.
-	 *  - sink_sink_dt_connections[j] is not initialized for the sink number j. */
-	union _starpu_mp_connection *sink_sink_dt_connections;
-
-	/* Node general functions */
-	void (*init)(struct _starpu_mp_node *node);
-	void (*deinit)(struct _starpu_mp_node *node);
-	void (*report_error)(const char *, const char *, const int, const int);
-
-	/* Message passing */
-	void (*mp_send)(const struct _starpu_mp_node *, void *, int);
-	void (*mp_recv)(const struct _starpu_mp_node *, void *, int);
-
-	/* Data transfers */
-	void (*dt_send)(const struct _starpu_mp_node *, void *, int);
-	void (*dt_recv)(const struct _starpu_mp_node *, void *, int);
-	void (*dt_send_to_device)(const struct _starpu_mp_node *, int, void *, int);
-	void (*dt_recv_from_device)(const struct _starpu_mp_node *, int, void *, int);
-
-	void (*execute)(const struct _starpu_mp_node *, void *, int);
-	void (*nbcores)(const struct _starpu_mp_node *);
-	void (*allocate)(const struct _starpu_mp_node *, void *, int);
-	void (*free)(const struct _starpu_mp_node *, void *, int);
-
-	unsigned int (*get_nb_core)(void);
-};
-
-struct _starpu_mp_node * _starpu_mp_common_node_create(enum _starpu_mp_node_kind node_kind, int peer_devid);
-
-void _starpu_mp_common_node_destroy(struct _starpu_mp_node *node);
-
-void _starpu_mp_common_send_command(const struct _starpu_mp_node *node,
-				    const enum _starpu_mp_command command,
-				    void *arg, int arg_size);
-
-enum _starpu_mp_command _starpu_mp_common_recv_command(const struct _starpu_mp_node *node,
-						    void **arg, int *arg_size);
-
-
-#endif /* STARPU_USE_MP */
-
-#endif /* __MP_COMMON_H__ */

+ 0 - 283
src/drivers/mp_common/sink_common.c

@@ -1,283 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#include <dlfcn.h>
-
-#ifdef STARPU_USE_MIC
-#include <common/COISysInfo_common.h>
-#endif
-
-#include <starpu.h>
-#include <common/config.h>
-#include <common/utils.h>
-#include <drivers/mp_common/mp_common.h>
-
-#include "sink_common.h"
-
-/* Return the sink kind of the running process, based on the value of the
- * STARPU_SINK environment variable.
- * If there is no valid value retrieved, return STARPU_INVALID_KIND
- */
-static enum _starpu_mp_node_kind _starpu_sink_common_get_kind(void)
-{
-	/* Environment varible STARPU_SINK must be defined when running on sink
-	 * side : let's use it to get the kind of node we're running on */
-	char *node_kind = getenv("STARPU_SINK");
-	STARPU_ASSERT(node_kind);
-
-	if (!strcmp(node_kind, "STARPU_MIC"))
-		return STARPU_MIC_SINK;
-	else if (!strcmp(node_kind, "STARPU_SCC"))
-		return STARPU_SCC_SINK;
-	else if (!strcmp(node_kind, "STARPU_MPI"))
-		return STARPU_MPI_SINK;
-	else
-		return STARPU_INVALID_KIND;
-}
-
-void
-_starpu_sink_nbcores (const struct _starpu_mp_node *node)
-{
-    // Process packet received from `_starpu_src_common_sink_cores'.
-    int nbcores = 1;
-
-#ifdef STARPU_USE_MIC
-    // XXX I currently only support MIC for now.
-    if (STARPU_MIC_SINK == _starpu_sink_common_get_kind ())
-	nbcores = COISysGetCoreCount();
-#endif
-
-    _starpu_mp_common_send_command (node, STARPU_ANSWER_SINK_NBCORES,
-				    &nbcores, sizeof (int));
-}
-
-
-/* Receive paquet from _starpu_src_common_execute_kernel in the form below :
- * [Function pointer on sink, number of interfaces, interfaces
- * (union _starpu_interface), cl_arg]
- * Then call the function given, passing as argument an array containing the
- * addresses of the received interfaces
- */
-void _starpu_sink_common_execute(const struct _starpu_mp_node *node,
-					void *arg, int arg_size)
-{
-	unsigned id = 0;
-
-	void *arg_ptr = arg;
-	void (*kernel)(void **, void *) = NULL;
-	unsigned coreid = 0;
-	unsigned nb_interfaces = 0;
-	void *interfaces[STARPU_NMAXBUFS];
-	void *cl_arg;
-
-	kernel = *(void(**)(void **, void *)) arg_ptr;
-	arg_ptr += sizeof(kernel);
-
-	coreid = *(unsigned *) arg_ptr;
-	arg_ptr += sizeof(coreid);
-
-	nb_interfaces = *(unsigned *) arg_ptr;
-	arg_ptr += sizeof(nb_interfaces);
-
-	/* The function needs an array pointing to each interface it needs
-	 * during execution. As in sink-side there is no mean to know which
-	 * kind of interface to expect, the array is composed of unions of
-	 * interfaces, thus we expect the same size anyway */
-	for (id = 0; id < nb_interfaces; id++)
-	{
-		interfaces[id] = arg_ptr;
-		arg_ptr += sizeof(union _starpu_interface);
-	}
-
-	/* Was cl_arg sent ? */
-	if (arg_size > arg_ptr - arg)
-		cl_arg = arg_ptr;
-	else
-		cl_arg = NULL;
-
-	//_STARPU_DEBUG("telling host that we have submitted the task %p.\n", kernel);
-	/* XXX: in the future, we will not have to directly execute the kernel
-	 * but submit it to the correct local worker. */
-	_starpu_mp_common_send_command(node, STARPU_EXECUTION_SUBMITTED,
-				       NULL, 0);
-
-	//_STARPU_DEBUG("executing the task %p\n", kernel);
-	/* XXX: we keep the synchronous execution model on the sink side for
-	 * now. */
-	kernel(interfaces, cl_arg);
-
-	//_STARPU_DEBUG("telling host that we have finished the task %p.\n", kernel);
-	_starpu_mp_common_send_command(node, STARPU_EXECUTION_COMPLETED,
-				       &coreid, sizeof(coreid));
-}
-
-
-static void _starpu_sink_common_lookup(const struct _starpu_mp_node *node,
-				       char *func_name)
-{
-	void (*func)(void);
-	void *dl_handle = dlopen(NULL, RTLD_NOW);
-	func = dlsym(dl_handle, func_name);
-
-	//_STARPU_DEBUG("Looked up %s, got %p\n", func_name, func);
-
-	/* If we couldn't find the function, let's send an error to the host.
-	 * The user probably made a mistake in the name */
-	if (func)
-		_starpu_mp_common_send_command(node, STARPU_ANSWER_LOOKUP,
-					       &func, sizeof(func));
-	else
-		_starpu_mp_common_send_command(node, STARPU_ERROR_LOOKUP,
-					       NULL, 0);
-}
-
-void _starpu_sink_common_allocate(const struct _starpu_mp_node *mp_node,
-				  void *arg, int arg_size)
-{
-    STARPU_ASSERT(arg_size == sizeof(size_t));
-
-    void *addr = malloc(*(size_t *)(arg));
-
-    /* If the allocation fail, let's send an error to the host.
-     */
-    if (addr)
-	_starpu_mp_common_send_command(mp_node, STARPU_ANSWER_ALLOCATE,
-				       &addr, sizeof(addr));
-    else
-	_starpu_mp_common_send_command(mp_node, STARPU_ERROR_ALLOCATE,
-				       NULL, 0);
-}
-
-void _starpu_sink_common_free(const struct _starpu_mp_node *mp_node STARPU_ATTRIBUTE_UNUSED,
-			      void *arg, int arg_size)
-{
-	STARPU_ASSERT(arg_size == sizeof(void *));
-
-	free(*(void **)(arg));
-}
-
-static void _starpu_sink_common_copy_from_host(const struct _starpu_mp_node *mp_node,
-					       void *arg, int arg_size)
-{
-    STARPU_ASSERT(arg_size == sizeof(struct _starpu_mp_transfer_command));
-
-    struct _starpu_mp_transfer_command *cmd = (struct _starpu_mp_transfer_command *)arg;
-
-    mp_node->dt_recv(mp_node, cmd->addr, cmd->size);
-}
-
-static void _starpu_sink_common_copy_to_host(const struct _starpu_mp_node *mp_node,
-					     void *arg, int arg_size)
-{
-    STARPU_ASSERT(arg_size == sizeof(struct _starpu_mp_transfer_command));
-
-    struct _starpu_mp_transfer_command *cmd = (struct _starpu_mp_transfer_command *)arg;
-
-    mp_node->dt_send(mp_node, cmd->addr, cmd->size);
-}
-
-static void _starpu_sink_common_copy_from_sink(const struct _starpu_mp_node *mp_node,
-					       void *arg, int arg_size)
-{
-    STARPU_ASSERT(arg_size == sizeof(struct _starpu_mp_transfer_command_to_device));
-
-    struct _starpu_mp_transfer_command_to_device *cmd = (struct _starpu_mp_transfer_command_to_device *)arg;
-
-    mp_node->dt_recv_from_device(mp_node, cmd->devid, cmd->addr, cmd->size);
-
-    _starpu_mp_common_send_command(mp_node, STARPU_TRANSFER_COMPLETE, NULL, 0);
-}
-
-static void _starpu_sink_common_copy_to_sink(const struct _starpu_mp_node *mp_node,
-					     void *arg, int arg_size)
-{
-    STARPU_ASSERT(arg_size == sizeof(struct _starpu_mp_transfer_command_to_device));
-
-    struct _starpu_mp_transfer_command_to_device *cmd = (struct _starpu_mp_transfer_command_to_device *)arg;
-
-    mp_node->dt_send_to_device(mp_node, cmd->devid, cmd->addr, cmd->size);
-}
-
-/* Function looping on the sink, waiting for tasks to execute.
- * If the caller is the host, don't do anything.
- */
-
-void _starpu_sink_common_worker(void)
-{
-	struct _starpu_mp_node *node = NULL;
-	enum _starpu_mp_command command = STARPU_EXIT;
-	int arg_size = 0;
-	void *arg = NULL;
-
-	enum _starpu_mp_node_kind node_kind = _starpu_sink_common_get_kind();
-
-	if (node_kind == STARPU_INVALID_KIND)
-		_STARPU_ERROR("No valid sink kind retrieved, use the"
-			      "STARPU_SINK environment variable to specify"
-			      "this\n");
-
-	/* Create and initialize the node */
-	node = _starpu_mp_common_node_create(node_kind, -1);
-
-	while ((command = _starpu_mp_common_recv_command(node, &arg, &arg_size)) != STARPU_EXIT)
-	{
-		switch(command)
-		{
-			case STARPU_EXECUTE:
-				node->execute(node, arg, arg_size);
-				break;
-			case STARPU_SINK_NBCORES:
-				node->nbcores (node);
-				break;
-			case STARPU_LOOKUP:
-				_starpu_sink_common_lookup(node, (char *) arg);
-				break;
-
-			case STARPU_ALLOCATE:
-				node->allocate(node, arg, arg_size);
-				break;
-
-			case STARPU_FREE:
-				node->free(node, arg, arg_size);
-				break;
-
-			case STARPU_RECV_FROM_HOST:
-				_starpu_sink_common_copy_from_host(node, arg, arg_size);
-				break;
-
-			case STARPU_SEND_TO_HOST:
-				_starpu_sink_common_copy_to_host(node, arg, arg_size);
-				break;
-
-			case STARPU_RECV_FROM_SINK:
-				_starpu_sink_common_copy_from_sink(node, arg, arg_size);
-				break;
-
-			case STARPU_SEND_TO_SINK:
-				_starpu_sink_common_copy_to_sink(node, arg, arg_size);
-				break;
-
-			default:
-				printf("Oops, command %x unrecognized\n", command);
-		}
-	}
-
-	/* Deinitialize the node and release it */
-	_starpu_mp_common_node_destroy(node);
-
-	exit(0);
-}

+ 0 - 39
src/drivers/mp_common/sink_common.h

@@ -1,39 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#ifndef __SINK_COMMON_H__
-#define __SINK_COMMON_H__
-
-#include <common/config.h>
-
-
-#ifdef STARPU_USE_MP
-
-#include <drivers/mp_common/mp_common.h>
-
-void _starpu_sink_common_worker(void);
-
-void _starpu_sink_common_execute(const struct _starpu_mp_node *node, void *arg, int arg_size);
-void _starpu_sink_nbcores (const struct _starpu_mp_node *node);
-
-void _starpu_sink_common_allocate(const struct _starpu_mp_node *mp_node, void *arg, int arg_size);
-void _starpu_sink_common_free(const struct _starpu_mp_node *mp_node STARPU_ATTRIBUTE_UNUSED, void *arg, int arg_size);
-
-#endif /* STARPU_USE_MP */
-
-
-#endif /* __SINK_COMMON_H__ */

+ 0 - 373
src/drivers/mp_common/source_common.c

@@ -1,373 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#include <string.h>
-#include <pthread.h>
-
-#include <starpu.h>
-#include <datawizard/coherency.h>
-#include <drivers/mp_common/mp_common.h>
-
-int
-_starpu_src_common_sink_nbcores (const struct _starpu_mp_node *node, int *buf)
-{
-    // Send a request to the sink NODE for the number of cores on it.
-
-    enum _starpu_mp_command answer;
-    void *arg;
-    int arg_size = sizeof (int);
-
-    _starpu_mp_common_send_command (node, STARPU_SINK_NBCORES, NULL, 0);
-
-    answer = _starpu_mp_common_recv_command (node, &arg, &arg_size);
-
-    STARPU_ASSERT (answer == STARPU_ANSWER_SINK_NBCORES && arg_size == sizeof (int));
-
-    memcpy (buf, arg, arg_size);
-
-    return 0;
-}
-
-/* Send a request to the sink linked to NODE for the pointer to the
- * function defined by FUNC_NAME.
- * In case of success, it returns 0 and FUNC_PTR contains the pointer ;
- * else it returns -ESPIPE if the function was not found.
- */
-int _starpu_src_common_lookup(struct _starpu_mp_node *node,
-			      void (**func_ptr)(void), const char *func_name)
-{
-	enum _starpu_mp_command answer;
-	void *arg;
-	int arg_size;
-
-	/* strlen ignore the terminating '\0' */
-	arg_size = (strlen(func_name) + 1) * sizeof(char);
-
-	//_STARPU_DEBUG("Looking up %s\n", func_name);
-	_starpu_mp_common_send_command(node, STARPU_LOOKUP, (void *) func_name,
-				       arg_size);
-	answer = _starpu_mp_common_recv_command(node, (void **) &arg,
-						&arg_size);
-
-	if (answer == STARPU_ERROR_LOOKUP) {
-		_STARPU_DISP("Error looking up %s\n", func_name);
-		return -ESPIPE;
-	}
-
-	/* We have to be sure the device answered the right question and the
-	 * answer has the right size */
-	STARPU_ASSERT(answer == STARPU_ANSWER_LOOKUP &&
-		      arg_size == sizeof(*func_ptr));
-
-	memcpy(func_ptr, arg, arg_size);
-
-	//_STARPU_DEBUG("got %p\n", *func_ptr);
-
-	return 0;
-}
-
- /* Send a message to the sink to execute a kernel.
- * The message sent has the form below :
- * [Function pointer on sink, number of interfaces, interfaces
- * (union _starpu_interface), cl_arg]
- */
-int _starpu_src_common_execute_kernel(const struct _starpu_mp_node *node,
-				      void (*kernel)(void), unsigned coreid,
-				      starpu_data_handle_t *handles,
-				      void **interfaces,
-				      unsigned nb_interfaces,
-				      void *cl_arg, size_t cl_arg_size)
-{
-	unsigned id;
-	void *buffer, *buffer_ptr, *arg = NULL;
-	int buffer_size = 0, arg_size = 0;
-
-	/* If the user didn't give any cl_arg, there is no need to send it */
-	buffer_size =
-	    sizeof(kernel) + sizeof(coreid) + sizeof(nb_interfaces) +
-	    nb_interfaces * sizeof(union _starpu_interface);
-	if (cl_arg)
-	{
-		STARPU_ASSERT(cl_arg_size);
-		buffer_size += cl_arg_size;
-	}
-
-	/* We give to send_command a buffer we just allocated, which contains
-	 * a pointer to the function (sink-side), core on which execute this
-	 * function (sink-side), number of interfaces we send,
-	 * an array of generic (union) interfaces and the value of cl_arg */
-	buffer_ptr = buffer = (void *) malloc(buffer_size);
-
-	*(void(**)(void)) buffer = kernel;
-	buffer_ptr += sizeof(kernel);
-
-	*(unsigned *) buffer_ptr = coreid;
-	buffer_ptr += sizeof(coreid);
-
-	*(unsigned *) buffer_ptr = nb_interfaces;
-	buffer_ptr += sizeof(nb_interfaces);
-
-	/* Message-passing execution is a particular case as the codelet is
-	 * executed on a sink with a different memory, whereas a codelet is
-	 * executed on the host part for the other accelerators.
-	 * Thus we need to send a copy of each interface on the MP device */
-	for (id = 0; id < nb_interfaces; id++)
-	{
-		starpu_data_handle_t handle = handles[id];
-		memcpy (buffer_ptr, interfaces[id],
-			handle->ops->interface_size);
-		/* The sink side has no mean to get the type of each
-		 * interface, we use a union to make it generic and permit the
-		 * sink to go through the array */
-		buffer_ptr += sizeof(union _starpu_interface);
-	}
-
-	if (cl_arg)
-		memcpy(buffer_ptr, cl_arg, cl_arg_size);
-
-	_starpu_mp_common_send_command(node, STARPU_EXECUTE, buffer, buffer_size);
-	enum _starpu_mp_command answer = _starpu_mp_common_recv_command(node, &arg, &arg_size);
-
-	if (answer == STARPU_ERROR_EXECUTE)
-		return -EINVAL;
-
-	STARPU_ASSERT(answer == STARPU_EXECUTION_SUBMITTED);
-
-	free(buffer);
-
-	return 0;
-
-}
-
-/* Launch the execution of the function KERNEL points to on the sink linked
- * to NODE. Returns 0 in case of success, -EINVAL if kernel is an invalid
- * pointer.
- * Data interfaces in task are send to the sink.
- */
-int _starpu_src_common_execute_kernel_from_task(const struct _starpu_mp_node *node,
-						void (*kernel)(void), unsigned coreid,
-						struct starpu_task *task)
-{
-    return _starpu_src_common_execute_kernel(node, kernel, coreid,
-					     task->handles, task->interfaces, task->cl->nbuffers,
-					     task->cl_arg, task->cl_arg_size);
-}
-
-/* Send a request to the sink linked to the MP_NODE to allocate SIZE bytes on
- * the sink.
- * In case of success, it returns 0 and *ADDR contains the address of the
- * allocated area ;
- * else it returns 1 if the allocation fail.
- */
-int _starpu_src_common_allocate(const struct _starpu_mp_node *mp_node,
-								void **addr, size_t size)
-{
-	enum _starpu_mp_command answer;
-	void *arg;
-	int arg_size;
-
-	_starpu_mp_common_send_command(mp_node, STARPU_ALLOCATE, &size,
-								   sizeof(size));
-
-	answer = _starpu_mp_common_recv_command(mp_node, &arg, &arg_size);
-
-	if (answer == STARPU_ERROR_ALLOCATE)
-		return 1;
-
-	STARPU_ASSERT(answer == STARPU_ANSWER_ALLOCATE &&
-				  arg_size == sizeof(*addr));
-
-	memcpy(addr, arg, arg_size);
-
-	return 0;
-}
-
-/* Send a request to the sink linked to the MP_NODE to deallocate the memory
- * area pointed by ADDR.
- */
-void _starpu_src_common_free(const struct _starpu_mp_node *mp_node,
-							 void *addr)
-{
-	_starpu_mp_common_send_command(mp_node, STARPU_FREE, &addr, sizeof(addr));
-}
-
-/* Send SIZE bytes pointed by SRC to DST on the sink linked to the MP_NODE.
- */
-int _starpu_src_common_copy_host_to_sink(const struct _starpu_mp_node *mp_node,
-										 void *src, void *dst, size_t size)
-{
-	struct _starpu_mp_transfer_command cmd = {size, dst};
-
-	_starpu_mp_common_send_command(mp_node, STARPU_RECV_FROM_HOST, &cmd, sizeof(cmd));
-	mp_node->dt_send(mp_node, src, size);
-
-	return 0;
-}
-
-/* Receive SIZE bytes pointed by SRC on the sink linked to the MP_NODE and store them in DST.
- */
-int _starpu_src_common_copy_sink_to_host(const struct _starpu_mp_node *mp_node,
-										 void *src, void *dst, size_t size)
-{
-	struct _starpu_mp_transfer_command cmd = {size, src};
-
-	_starpu_mp_common_send_command(mp_node, STARPU_SEND_TO_HOST, &cmd, sizeof(cmd));
-	mp_node->dt_recv(mp_node, dst, size);
-
-	return 0;
-}
-
-/* Tell the sink linked to SRC_NODE to send SIZE bytes of data pointed by SRC
- * to the sink linked to DST_NODE. The latter store them in DST.
- */
-int _starpu_src_common_copy_sink_to_sink(const struct _starpu_mp_node *src_node,
-		const struct _starpu_mp_node *dst_node, void *src, void *dst, size_t size)
-{
-	enum _starpu_mp_command answer;
-	void *arg;
-	int arg_size;
-
-	struct _starpu_mp_transfer_command_to_device cmd = {dst_node->peer_id, size, src};
-
-	/* Tell source to send data to dest. */
-	_starpu_mp_common_send_command(src_node, STARPU_SEND_TO_SINK, &cmd, sizeof(cmd));
-
-	cmd.devid = src_node->peer_id;
-	cmd.size = size;
-	cmd.addr = dst;
-
-	/* Tell dest to receive data from source. */
-	_starpu_mp_common_send_command(dst_node, STARPU_RECV_FROM_SINK, &cmd, sizeof(cmd));
-
-	/* Wait for answer from dest to know wether transfer is finished. */
-	answer = _starpu_mp_common_recv_command(dst_node, &arg, &arg_size);
-
-	STARPU_ASSERT(answer == STARPU_TRANSFER_COMPLETE);
-
-	return 0;
-}
-
-/* 5 functions to determine the executable to run on the device (MIC, SCC,
- * MPI).
- */
-static void _starpu_src_common_cat_3(char *final, const char *first, const char *second,
-										  const char *third)
-{
-	strcpy(final, first);
-	strcat(final, second);
-	strcat(final, third);
-}
-
-static void _starpu_src_common_cat_2(char *final, const char *first, const char *second)
-{
-	_starpu_src_common_cat_3(final, first, second, "");
-}
-
-static void _starpu_src_common_dir_cat(char *final, const char *dir, const char *file)
-{
-	if (file[0] == '/')
-		++file;
-
-	size_t size = strlen(dir);
-	if (dir[size - 1] == '/')
-		_starpu_src_common_cat_2(final, dir, file);
-	else
-		_starpu_src_common_cat_3(final, dir, "/", file);
-}
-
-static int _starpu_src_common_test_suffixes(char *located_file_name, const char *base, const char **suffixes)
-{
-	unsigned int i;
-	for (i = 0; suffixes[i] != NULL; ++i)
-	{
-		_starpu_src_common_cat_2(located_file_name, base, suffixes[i]);
-		if (access(located_file_name, R_OK) == 0)
-			return 0;
-	}
-
-	return 1;
-}
-
-int _starpu_src_common_locate_file(char *located_file_name,
-							const char *env_file_name, const char *env_mic_path,
-							const char *config_file_name, const char *actual_file_name,
-							const char **suffixes)
-{
-	if (env_file_name != NULL)
-	{
-		if (access(env_file_name, R_OK) == 0)
-		{
-			strcpy(located_file_name, env_file_name);
-			return 0;
-		}
-		else if(env_mic_path != NULL)
-		{
-			_starpu_src_common_dir_cat(located_file_name, env_mic_path, env_file_name);
-
-			return access(located_file_name, R_OK);
-		}
-	}
-	else if (config_file_name != NULL)
-	{
-		if (access(config_file_name, R_OK) == 0)
-		{
-			strcpy(located_file_name, config_file_name);
-			return 0;
-		}
-		else if (env_mic_path != NULL)
-		{
-			_starpu_src_common_dir_cat(located_file_name, env_mic_path, config_file_name);
-
-			return access(located_file_name, R_OK);
-		}
-	}
-	else if (actual_file_name != NULL)
-	{
-		if (_starpu_src_common_test_suffixes(located_file_name, actual_file_name, suffixes) == 0)
-			return 0;
-
-		if (env_mic_path != NULL)
-		{
-			char actual_cpy[1024];
-			strcpy(actual_cpy, actual_file_name);
-
-			char *last =  strrchr(actual_cpy, '/');
-			while (last != NULL)
-			{
-				char tmp[1024];
-
-				_starpu_src_common_dir_cat(tmp, env_mic_path, last);
-
-				if (access(tmp, R_OK) == 0)
-				{
-					strcpy(located_file_name, tmp);
-					return 0;
-				}
-
-				if (_starpu_src_common_test_suffixes(located_file_name, tmp, suffixes) == 0)
-					return 0;
-
-				*last = '\0';
-				char *last_tmp = strrchr(actual_cpy, '/');
-				*last = '/';
-				last = last_tmp;
-			}
-		}
-	}
-
-	return 1;
-}

+ 0 - 63
src/drivers/mp_common/source_common.h

@@ -1,63 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#ifndef __SOURCE_COMMON_H__
-#define __SOURCE_COMMON_H__
-
-
-#ifdef STARPU_USE_MP
-
-#include <drivers/mp_common/mp_common.h>
-
-int _starpu_src_common_sink_nbcores (const struct _starpu_mp_node *node, int *buf);
-
-int _starpu_src_common_lookup(const struct _starpu_mp_node *node,
-			      void (**func_ptr)(void), const char *func_name);
-
-int _starpu_src_common_execute_kernel(const struct _starpu_mp_node *node,
-				      void (*kernel)(void), unsigned coreid,
-				      starpu_data_handle_t *handles, void **interfaces, unsigned nb_interfaces,
-				      void *cl_arg, size_t cl_arg_size);
-
-int _starpu_src_common_execute_kernel_from_task(const struct _starpu_mp_node *node,
-						void (*kernel)(void), unsigned coreid,
-						struct starpu_task *task);
-
-int _starpu_src_common_allocate(const struct _starpu_mp_node *mp_node,
-				void **addr, size_t size);
-
-void _starpu_src_common_free(const struct _starpu_mp_node *mp_node,
-			     void *addr);
-
-int _starpu_src_common_copy_host_to_sink(const struct _starpu_mp_node *mp_node,
-					 void *src, void *dst, size_t size);
-
-int _starpu_src_common_copy_sink_to_host(const struct _starpu_mp_node *mp_node,
-					 void *src, void *dst, size_t size);
-
-int _starpu_src_common_copy_sink_to_sink(const struct _starpu_mp_node *src_node,
-					 const struct _starpu_mp_node *dst_node, void *src, void *dst, size_t size);
-
-int _starpu_src_common_locate_file(char *located_file_name,
-				   const char *env_file_name, const char *env_mic_path,
-				   const char *config_file_name, const char *actual_file_name,
-				   const char **suffixes);
-
-#endif /* STARPU_USE_MP */
-
-
-#endif /* __SOURCE_COMMON_H__ */

+ 0 - 174
src/drivers/scc/driver_scc_common.c

@@ -1,174 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <sys/mman.h>
-#include <fcntl.h>
-
-#include <core/workers.h>
-
-#include <drivers/mp_common/mp_common.h>
-#include <drivers/scc/driver_scc_common.h>
-
-#include <RCCE_lib.h>
-#include <SCC_API.h>
-
-static int rcce_initialized;
-
-static int src_node_id;
-
-static t_vcharp rckncm_map;
-static t_vcharp shm_addr;
-
-
-static void _starpu_scc_set_src_node_id()
-{
-	int node_id = starpu_get_env_number("STARPU_SCC_MASTER_NODE");
-
-	if (node_id != -1)
-	{
-		if (node_id < RCCE_num_ues())
-		{
-			src_node_id = node_id;
-			return;
-		}
-		else if (RCCE_ue() == 0)
-		{
-			/* Only node 0 print the error message. */
-			fprintf(stderr, "The node you specify to be the master is "
-					"greater than the total number of nodes.\n"
-					"Taking node 0 (core %d) by default...\n", RC_COREID[0]);
-		}
-	}
-
-	/* Node 0 by default. */
-	src_node_id = 0;
-}
-
-/* Try to init the RCCE API.
- * return: 	1 on success
- * 			0 on failure
- */
-int _starpu_scc_common_mp_init()
-{
-	int rckncm_fd;
-
-	/* "/dev/rckncm" is to access shared memory on SCC. */
-	if ((rckncm_fd = open("/dev/rckncm", O_RDWR | O_SYNC)) < 0)
-	{
-		/* It seems that we're not on a SCC system. */
-		return (rcce_initialized = 0);
-	}
-
-	int page_size = getpagesize();
-	unsigned int aligne_addr = (SHM_ADDR) & (~(page_size - 1));
-	if ((rckncm_map = (t_vcharp)mmap(NULL, SHMSIZE, PROT_WRITE | PROT_READ, MAP_SHARED,
-					rckncm_fd, aligne_addr)) == MAP_FAILED)
-	{
-		perror("mmap");
-		close(rckncm_fd);
-		return (rcce_initialized = 0);
-	}
-
-	int *argc = _starpu_get_argc();
-	char ***argv = _starpu_get_argv();
-
-	/* We can't initialize RCCE without argc and argv. */
-	if (!argc || *argc <= 1 || !argv || (RCCE_init(argc, argv) != RCCE_SUCCESS))
-	{
-		close(rckncm_fd);
-		munmap((void*)rckncm_map, SHMSIZE);
-		return (rcce_initialized = 0);
-	}
-
-	unsigned int page_offset = (SHM_ADDR) - aligne_addr;
-	shm_addr = rckncm_map + page_offset;
-
-	RCCE_shmalloc_init(shm_addr, RCCE_SHM_SIZE_MAX);
-
-	/* Which core of the SCC will be the master one? */
-	_starpu_scc_set_src_node_id();
-
-	close(rckncm_fd);
-
-	return (rcce_initialized = 1);
-}
-
-void *_starpu_scc_common_get_shared_memory_addr()
-{
-	return (void*)shm_addr;
-}
-
-void _starpu_scc_common_unmap_shared_memory()
-{
-	munmap((void*)rckncm_map, SHMSIZE);
-}
-
-/* To know if the pointer "ptr" points into the shared memory map */
-int _starpu_scc_common_is_in_shared_memory(void *ptr)
-{
-	return (void*)shm_addr <= ptr && ptr < (void*)shm_addr + SHMSIZE;
-}
-
-int _starpu_scc_common_is_mp_initialized()
-{
-	return rcce_initialized;
-}
-
-int _starpu_scc_common_get_src_node_id()
-{
-	return src_node_id;
-}
-
-int _starpu_scc_common_is_src_node()
-{
-	return RCCE_ue() == src_node_id;
-}
-
-void _starpu_scc_common_send(const struct _starpu_mp_node *node, void *msg, int len)
-{
-	int ret;
-
-	/* There are potentially 48 threads running on the master core and RCCE_send write
-	 * data in the MPB associated to this core. It's not thread safe, so we have to protect it.
-	 * RCCE_acquire_lock uses a test&set register on SCC. */
-	RCCE_acquire_lock(RCCE_ue());
-
-	if ((ret = RCCE_send(msg, len, node->mp_connection.scc_nodeid)) != RCCE_SUCCESS)
-	{
-		RCCE_release_lock(RCCE_ue());
-		STARPU_MP_COMMON_REPORT_ERROR(node, ret);
-	}
-
-	RCCE_release_lock(RCCE_ue());
-}
-
-void _starpu_scc_common_recv(const struct _starpu_mp_node *node, void *msg, int len)
-{
-	int ret;
-	if ((ret = RCCE_recv(msg, len, node->mp_connection.scc_nodeid)) != RCCE_SUCCESS)
-		STARPU_MP_COMMON_REPORT_ERROR(node, ret);
-}
-
-void _starpu_scc_common_report_rcce_error(const char *func, const char *file, const int line, const int err_no)
-{
-	char error_string[RCCE_MAX_ERROR_STRING];
-	int error_string_length;
-
-	RCCE_error_string(err_no, error_string, &error_string_length); 
-
-	fprintf(stderr, "RCCE error in %s (%s:%d): %s\n", func, file, line, error_string); 
-	STARPU_ABORT();
-}

+ 0 - 50
src/drivers/scc/driver_scc_common.h

@@ -1,50 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#ifndef __DRIVER_SCC_COMMON_H__
-#define __DRIVER_SCC_COMMON_H__
-
-#include <common/config.h>
-
-
-#ifdef STARPU_USE_SCC
-
-#include <RCCE_lib.h>
-
-#include <drivers/mp_common/mp_common.h>
-
-#define STARPU_TO_SCC_SINK_ID(id) (id) < RCCE_ue() ? (id) : ((id) + 1)
-
-int _starpu_scc_common_mp_init();
-
-void *_starpu_scc_common_get_shared_memory_addr();
-void _starpu_scc_common_unmap_shared_memory();
-int _starpu_scc_common_is_in_shared_memory(void *ptr);
-
-int _starpu_scc_common_is_mp_initialized();
-
-int _starpu_scc_common_get_src_node_id();
-int _starpu_scc_common_is_src_node();
-
-void _starpu_scc_common_send(const struct _starpu_mp_node *node, void *msg, int len);
-void _starpu_scc_common_recv(const struct _starpu_mp_node *node, void *msg, int len);
-
-void _starpu_scc_common_report_rcce_error(const char *func, const char *file, const int line, const int err_no);
-
-#endif /* STARPU_USE_SCC */
-
-
-#endif /* __DRIVER_SCC_COMMON_H__ */

+ 0 - 125
src/drivers/scc/driver_scc_sink.c

@@ -1,125 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#include <RCCE.h>
-
-#include <drivers/mp_common/sink_common.h>
-#include <drivers/scc/driver_scc_common.h>
-#include <drivers/scc/driver_scc_sink.h>
-
-
-
-void _starpu_scc_sink_init(struct _starpu_mp_node *node)
-{
-	node->mp_connection.scc_nodeid = _starpu_scc_common_get_src_node_id();
-}
-
-void _starpu_scc_sink_deinit(struct _starpu_mp_node *node)
-{
-	(void)node;
-
-	_starpu_scc_common_unmap_shared_memory();
-	RCCE_finalize();
-}
-
-void _starpu_scc_sink_send_to_device(const struct _starpu_mp_node *node, int dst_devid, void *msg, int len)
-{
-	int ret;
-	if ((ret = RCCE_send(msg, len, STARPU_TO_SCC_SINK_ID(dst_devid))) != RCCE_SUCCESS)
-		STARPU_MP_COMMON_REPORT_ERROR(node, ret);
-}
-
-void _starpu_scc_sink_recv_from_device(const struct _starpu_mp_node *node, int src_devid, void *msg, int len)
-{
-	int ret;
-	if ((ret = RCCE_recv(msg, len, STARPU_TO_SCC_SINK_ID(src_devid))) != RCCE_SUCCESS)
-		STARPU_MP_COMMON_REPORT_ERROR(node, ret);
-}
-
-/* arg -> [Function pointer on sink, number of interfaces, interfaces
- * (union _starpu_interface), cl_arg]
- *
- * This function change the dev_handle and the ptr of each interfaces
- * given to the sink.
- * dev_handle 	-> 	start of the shared memory (different for each sink)
- * ptr 			-> 	dev_handle + offset
- */
-void _starpu_scc_sink_execute(const struct _starpu_mp_node *node, void *arg, int arg_size)
-{
-	void *local_arg = arg;
-
-	/* point after the kernel */
-	local_arg += sizeof(void(*)(void**, void*));
-
-	unsigned nb_interfaces = *(unsigned*)local_arg;
-	local_arg += sizeof(nb_interfaces);
-
-	uintptr_t shm_addr = (uintptr_t)_starpu_scc_common_get_shared_memory_addr();
-
-	unsigned i;
-	for (i = 0; i < nb_interfaces; ++i)
-	{
-		/* The first field of an interface is the interface id. */
-		switch (*(enum starpu_data_interface_id *)local_arg)
-		{
-			case STARPU_MATRIX_INTERFACE_ID:
-			{
-				struct starpu_matrix_interface *matrix = (struct starpu_matrix_interface *)local_arg;
-				matrix->dev_handle = shm_addr;
-				matrix->ptr = matrix->dev_handle + matrix->offset;
-				break;
-			}
-
-			case STARPU_BLOCK_INTERFACE_ID:
-			{
-				struct starpu_block_interface *block = (struct starpu_block_interface *)local_arg;
-				block->dev_handle = shm_addr;
-				block->ptr = block->dev_handle + block->offset;
-				break;
-			}
-
-			case STARPU_VECTOR_INTERFACE_ID:
-			{
-				struct starpu_vector_interface *vector = (struct starpu_vector_interface *)local_arg;
-				vector->dev_handle = shm_addr;
-				vector->ptr = vector->dev_handle + vector->offset;
-				break;
-			}
-
-			case STARPU_VARIABLE_INTERFACE_ID:
-			{
-				struct starpu_variable_interface *variable = (struct starpu_variable_interface *)local_arg;
-				variable->dev_handle = shm_addr;
-				variable->ptr = variable->dev_handle + variable->offset;
-				break;
-			}
-
-			case STARPU_CSR_INTERFACE_ID:
-			case STARPU_BCSR_INTERFACE_ID:
-			case STARPU_MULTIFORMAT_INTERFACE_ID:
-			fprintf(stderr, "Data type not supported on SCC.\n");
-
-			default:
-				STARPU_ABORT();
-		}
-
-		/* point to the next interface */
-		local_arg += sizeof(union _starpu_interface);
-	}
-
-	_starpu_sink_common_execute(node, arg, arg_size);
-}

+ 0 - 38
src/drivers/scc/driver_scc_sink.h

@@ -1,38 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#ifndef __DRIVER_SCC_SINK_H__
-#define __DRIVER_SCC_SINK_H__
-
-#include <common/config.h>
-
-
-#ifdef STARPU_USE_SCC
-
-#include <drivers/mp_common/mp_common.h>
-
-void _starpu_scc_sink_init(struct _starpu_mp_node *node);
-void _starpu_scc_sink_deinit(struct _starpu_mp_node *node);
-
-void _starpu_scc_sink_send_to_device(const struct _starpu_mp_node *node, int dst_devid, void *msg, int len);
-void _starpu_scc_sink_recv_from_device(const struct _starpu_mp_node *node, int src_devid, void *msg, int len);
-
-void _starpu_scc_sink_execute(const struct _starpu_mp_node *node, void *arg, int arg_size);
-
-#endif /* STARPU_USE_SCC */
-
-
-#endif /* __DRIVER_SCC_SINK_H__ */

+ 0 - 416
src/drivers/scc/driver_scc_source.c

@@ -1,416 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#include <starpu.h>
-#include <starpu_profiling.h>
-#include <core/sched_policy.h>
-#include <core/task.h>
-#include <common/uthash.h>
-
-#include <RCCE.h>
-
-#include <drivers/driver_common/driver_common.h>
-#include <drivers/mp_common/source_common.h>
-#include <drivers/scc/driver_scc_common.h>
-#include <drivers/scc/driver_scc_source.h>
-
-static struct _starpu_mp_node *scc_mp_nodes[STARPU_MAXSCCDEVS];
-
-struct _starpu_scc_kernel
-{
-	UT_hash_handle hh;
-	char *name;
-	starpu_scc_kernel_t func[STARPU_MAXSCCDEVS];
-} *kernels;
-
-starpu_pthread_mutex_t htbl_mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
-
-static struct _starpu_mp_node *_starpu_scc_src_memory_node_to_mp_node(unsigned memory_node)
-{
-	int devid = _starpu_memory_node_get_devid(memory_node);
-
-	STARPU_ASSERT(devid < STARPU_MAXSCCDEVS);
-	return scc_mp_nodes[devid];
-}
-
-static void _starpu_scc_src_init_context(int devid)
-{
-	/* Let's create the node structure, we'll communicate with the peer
-	 * through RCCE thanks to it */
-	scc_mp_nodes[devid] = _starpu_mp_common_node_create(STARPU_SCC_SOURCE, devid);
-}
-
-static void _starpu_scc_src_deinit_context(int devid)
-{
-	_starpu_mp_common_send_command(scc_mp_nodes[devid], STARPU_EXIT, NULL, 0);
-
-	_starpu_mp_common_node_destroy(scc_mp_nodes[devid]);
-}
-
-static int _starpu_scc_src_execute_job(struct _starpu_job *j, struct _starpu_worker *args)
-{
-	int ret;
-	uint32_t mask = 0;
-
-	STARPU_ASSERT(j);
-	struct starpu_task *task = j->task;
-
-	struct timespec codelet_start, codelet_end;
-
-	int profiling = starpu_profiling_status_get();
-	unsigned calibrate_model = 0;
-
-	STARPU_ASSERT(task);
-	struct starpu_codelet *cl = task->cl;
-	STARPU_ASSERT(cl);
-
-	if (cl->model && cl->model->benchmarking)
-		calibrate_model = 1;
-
-	ret = _starpu_fetch_task_input(j, mask);
-	if (ret != 0)
-	{
-		/* there was not enough memory, so the input of
-		 * the codelet cannot be fetched ... put the
-		 * codelet back, and try it later */
-		return -EAGAIN;
-	}
-
-
-	starpu_scc_kernel_t kernel = NULL;
-
-	starpu_scc_func_t func = _starpu_task_get_scc_nth_implementation(j->task->cl, j->nimpl);
-	if (func)
-	{
-		/* We execute the function contained in the codelet, it must return a
-		 * pointer to the function to execute on the device, either specified
-		 * directly by the user or by a call to starpu_scc_get_kernel().
-		 */
-		kernel = func();
-	}
-	else
-	{
-		/* If user doesn't define any starpu_scc_func_t in cl->scc_funcs we try to use
-		 * cpu_funcs_name.
-		 */
-		char *func_name = _starpu_task_get_cpu_name_nth_implementation(j->task->cl, j->nimpl);
-		if (func_name)
-		{
-			starpu_scc_func_symbol_t symbol;
-
-			_starpu_scc_src_register_kernel(&symbol, func_name);
-
-			kernel = _starpu_scc_src_get_kernel(symbol);
-		}
-	}
-	STARPU_ASSERT(kernel);
-
-	_starpu_driver_start_job(args, j, &codelet_start, 0, profiling);
-
-	_starpu_src_common_execute_kernel_from_task(scc_mp_nodes[args->devid], (void (*)(void)) kernel, 0, task);
-
-	_starpu_driver_end_job(args, j, args->perf_arch, &codelet_end, 0, profiling);
-
-	_starpu_driver_update_job_feedback(j, args, args->perf_arch, &codelet_start, &codelet_end, profiling);
-
-	_starpu_push_task_output(j, mask);
-
-
-	return 0;
-}
-
-void _starpu_scc_src_mp_deinit()
-{
-	_starpu_scc_common_unmap_shared_memory();
-	RCCE_finalize();
-}
-
-int _starpu_scc_src_register_kernel(starpu_scc_func_symbol_t *symbol, const char *func_name)
-{
-	unsigned int func_name_size = (strlen(func_name) + 1) * sizeof(char);
-
-	STARPU_PTHREAD_MUTEX_LOCK(&htbl_mutex);
-	struct _starpu_scc_kernel *kernel;
-
-	HASH_FIND_STR(kernels, func_name, kernel);
-
-	if (kernel != NULL)
-	{
-		STARPU_PTHREAD_MUTEX_UNLOCK(&htbl_mutex);
-		// Function already in the table.
-		*symbol = kernel;
-		return 0;
-	}
-
-	kernel = malloc(sizeof(*kernel));
-	if (kernel == NULL)
-	{
-		STARPU_PTHREAD_MUTEX_UNLOCK(&htbl_mutex);
-		return -ENOMEM;
-	}
-
-	kernel->name = malloc(func_name_size);
-	if (kernel->name == NULL)
-	{
-		STARPU_PTHREAD_MUTEX_UNLOCK(&htbl_mutex);
-		free(kernel);
-		return -ENOMEM;
-	}
-
-	memcpy(kernel->name, func_name, func_name_size);
-
-	HASH_ADD_STR(kernels, name, kernel);
-
-	unsigned int nb_scc_devices = starpu_scc_worker_get_count();
-	unsigned int i;
-	for (i = 0; i < nb_scc_devices; ++i)
-		kernel->func[i] = NULL;
-
-	STARPU_PTHREAD_MUTEX_UNLOCK(&htbl_mutex);
-
-	*symbol = kernel;
-
-	return 0;
-}
-
-starpu_scc_kernel_t _starpu_scc_src_get_kernel(starpu_scc_func_symbol_t symbol)
-{
-	int workerid = starpu_worker_get_id();
-	/* This function has to be called in the codelet only, by the thread
-	 * which will handle the task */
-	if (workerid < 0)
-		return NULL;
-
-	int devid = starpu_worker_get_devid(workerid);
-
-	struct _starpu_scc_kernel *kernel = symbol;
-
-	if (kernel->func[devid] == NULL)
-	{
-		struct _starpu_mp_node *node = scc_mp_nodes[devid];
-		int ret = _starpu_src_common_lookup(node, (void (**)(void))&kernel->func[devid], kernel->name);
-
-		if (ret)
-			return NULL;
-	}
-
-	return kernel->func[devid];
-}
-
-unsigned _starpu_scc_src_get_device_count()
-{
-	int nb_scc_devices;
-
-	if (!_starpu_scc_common_is_mp_initialized())
-	{
-		return 0;
-	}
-
-	nb_scc_devices = RCCE_num_ues() - 1;
-	nb_scc_devices = nb_scc_devices < 0 ? 0 : nb_scc_devices;
-
-	return nb_scc_devices;
-}
-
-void _starpu_scc_exit_useless_node(int devid)
-{
-	struct _starpu_mp_node *node = _starpu_mp_common_node_create(STARPU_SCC_SOURCE, devid);
-
-	_starpu_mp_common_send_command(node, STARPU_EXIT, NULL, 0);
-
-	_starpu_mp_common_node_destroy(node);
-}
-
-void _starpu_scc_src_init(struct _starpu_mp_node *node)
-{
-	node->mp_connection.scc_nodeid = STARPU_TO_SCC_SINK_ID(node->peer_id);
-}
-
-/* Allocate memory on SCC.
- * Return 0 if OK or 1 if not.
- */
-int _starpu_scc_allocate_memory(void **addr, size_t size, unsigned memory_node)
-{
-	return _starpu_src_common_allocate(_starpu_scc_src_memory_node_to_mp_node(memory_node),
-			addr, size);
-}
-
-/* Free memory on SCC.
- */
-void _starpu_scc_free_memory(void *addr, unsigned memory_node)
-{
-	return _starpu_src_common_free(_starpu_scc_src_memory_node_to_mp_node(memory_node),
-			addr);
-}
-
-int _starpu_scc_allocate_shared_memory(void **addr, size_t size)
-{
-	return (*addr = (void*)RCCE_shmalloc(size)) == NULL;
-}
-
-void _starpu_scc_free_shared_memory(void *addr)
-{
-	RCCE_shfree(addr);
-}
-
-/* Assigns the offset to "offset" between "ptr" and the start of the shared memory.
- * Affect "dev_handle" with the start of the shared memory is useful for data
- * partionning.
- */
-void _starpu_scc_set_offset_in_shared_memory(void *ptr, void **dev_handle, size_t *offset)
-{
-	/* We're on SCC... */
-	if (_starpu_can_submit_scc_task())
-	{
-		if (!_starpu_scc_common_is_in_shared_memory(ptr))
-		{
-			fprintf(stderr, "The data (%p) you want to register does not seem to be allocated in shared memory. "
-					"Please use starpu_malloc to do this.\n", ptr);
-			STARPU_ABORT();
-		}
-
-		void *shm_addr = _starpu_scc_common_get_shared_memory_addr();
-
-		if (dev_handle)
-			*dev_handle = shm_addr;
-
-		if (offset)
-			*offset = ptr - shm_addr;
-	}
-}
-
-/* Transfert SIZE bytes from the address pointed by SRC in the SRC_NODE memory
- * node to the address pointed by DST in the DST_NODE memory node
- */
-int _starpu_scc_copy_src_to_sink(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size)
-{
-	return _starpu_src_common_copy_host_to_sink(_starpu_scc_src_memory_node_to_mp_node(dst_node),
-			src, dst, size);
-}
-
-/* Transfert SIZE bytes from the address pointed by SRC in the SRC_NODE memory
- * node to the address pointed by DST in the DST_NODE memory node
- */
-int _starpu_scc_copy_sink_to_src(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size)
-{
-	return _starpu_src_common_copy_sink_to_host(_starpu_scc_src_memory_node_to_mp_node(src_node),
-			src, dst, size);
-}
-
-int _starpu_scc_copy_sink_to_sink(void *src, unsigned src_node, void *dst, unsigned dst_node, size_t size)
-{
-	return _starpu_src_common_copy_sink_to_sink(_starpu_scc_src_memory_node_to_mp_node(src_node),
-			_starpu_scc_src_memory_node_to_mp_node(dst_node),
-			src, dst, size);
-}
-
-void *_starpu_scc_src_worker(void *arg)
-{
-	struct _starpu_worker *args = arg;
-
-	int devid = args->devid;
-	int workerid = args->workerid;
-	struct _starpu_machine_config *config = args->config;
-	unsigned memnode = args->memory_node;
-	unsigned baseworkerid = args - config->workers;
-	unsigned mp_nodeid = args->mp_nodeid;
-	unsigned i;
-
-	_starpu_worker_init(args, _STARPU_FUT_SCC_KEY);
-
-	_starpu_scc_src_init_context(devid);
-
-	args->status = STATUS_UNKNOWN;
-
-	for (i = 0; i < config->topology.nmiccores[mp_nodeid]; i++)
-	{
-		struct _starpu_worker *worker = &config->workers[baseworkerid+i];
-		snprintf(worker->name, sizeof(worker->name), "MIC %d core %u", mp_nodeid, i);
-	}
-
-	_STARPU_TRACE_WORKER_INIT_END;
-
-	/* tell the main thread that this one is ready */
-	STARPU_PTHREAD_MUTEX_LOCK(&args->mutex);
-	args->worker_is_initialized = 1;
-	STARPU_PTHREAD_COND_SIGNAL(&args->ready_cond);
-	STARPU_PTHREAD_MUTEX_UNLOCK(&args->mutex);
-
-	struct _starpu_job * j;
-	struct starpu_task *task;
-	int res;
-
-	while (_starpu_machine_is_running())
-	{
-		_STARPU_TRACE_START_PROGRESS(memnode);
-		_starpu_datawizard_progress(memnode, 1);
-		_STARPU_TRACE_END_PROGRESS(memnode);
-
-		task = _starpu_get_worker_task(args, workerid, memnode);
-		if (!task)
-			continue;
-
-		j = _starpu_get_job_associated_to_task(task);
-
-		/* can a SCC device do that task ? */
-		if (!_STARPU_SCC_MAY_PERFORM(j))
-		{
-			/* this isn't a SCC task */
-			_starpu_push_task_to_workers(task);
-			continue;
-		}
-
-		_starpu_set_current_task(task);
-		args->current_task = j->task;
-
-		res = _starpu_scc_src_execute_job(j, args);
-
-		_starpu_set_current_task(NULL);
-		args->current_task = NULL;
-
-		if (res)
-		{
-			switch (res)
-			{
-				case -EAGAIN:
-					_STARPU_DISP("ouch, put the codelet %p back ... \n", j);
-					_starpu_push_task_to_workers(task);
-					STARPU_ABORT();
-					continue;
-				default:
-					STARPU_ASSERT(0);
-			}
-		}
-
-		_starpu_handle_job_termination(j);
-	}
-
-	_STARPU_TRACE_WORKER_DEINIT_START;
-
-	_starpu_handle_all_pending_node_data_requests(memnode);
-
-	/* In case there remains some memory that was automatically
-	 * allocated by StarPU, we release it now. Note that data
-	 * coherency is not maintained anymore at that point ! */
-	_starpu_free_all_automatically_allocated_buffers(memnode);
-
-	_starpu_scc_src_deinit_context(args->devid);
-
-	_STARPU_TRACE_WORKER_DEINIT_END(_STARPU_FUT_SCC_KEY);
-
-	return NULL;
-}

+ 0 - 56
src/drivers/scc/driver_scc_source.h

@@ -1,56 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#ifndef __DRIVER_SCC_SOURCE_H__
-#define __DRIVER_SCC_SOURCE_H__
-
-#include <starpu.h>
-#include <starpu_scc.h>
-#include <common/config.h>
-
-
-#ifdef STARPU_USE_SCC
-
-#include <drivers/mp_common/mp_common.h>
-
-
-void _starpu_scc_src_mp_deinit();
-
-int _starpu_scc_src_register_kernel(starpu_scc_func_symbol_t *symbol, const char *func_name);
-starpu_scc_kernel_t _starpu_scc_src_get_kernel(starpu_scc_func_symbol_t symbol);
-
-unsigned _starpu_scc_src_get_device_count();
-void _starpu_scc_exit_useless_node(int devid);
-
-void _starpu_scc_src_init(struct _starpu_mp_node *node);
-
-int _starpu_scc_allocate_memory(void **addr, size_t size, unsigned memory_node);
-void _starpu_scc_free_memory(void *addr, unsigned memory_node);
-int _starpu_scc_allocate_shared_memory(void **addr, size_t size);
-void _starpu_scc_free_shared_memory(void *addr);
-
-void _starpu_scc_set_offset_in_shared_memory(void *ptr, void **dev_handle, size_t *offset);
-
-int _starpu_scc_copy_src_to_sink(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size);
-int _starpu_scc_copy_sink_to_src(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size);
-int _starpu_scc_copy_sink_to_sink(void *src, unsigned src_node, void *dst, unsigned dst_node, size_t size);
-
-void *_starpu_scc_src_worker(void *arg);
-
-#endif /* STARPU_USE_SCC */
-
-
-#endif /* __DRIVER_SCC_SOURCE_H__ */

+ 0 - 45
src/drivers/scc/driver_scc_utils.c

@@ -1,45 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2012  Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-
-#include <starpu.h>
-#include <starpu_scc.h>
-#include <common/config.h>
-
-#include <drivers/mp_common/source_common.h>
-#include <drivers/scc/driver_scc_source.h>
-
-
-/* Initiate a lookup on each SCC device to find the adress of the function
- * named FUNC_NAME, store them in the global array kernels and return
- * the index in the array through SYMBOL.
- * If success, returns 0. If the user has registered too many kernels (more
- * than STARPU_MAXSCCDEVS) returns -ENOMEM
- */
-int starpu_scc_register_kernel(starpu_scc_func_symbol_t *symbol,
-			       const char *func_name)
-{
-	return _starpu_scc_src_register_kernel(symbol, func_name);
-}
-
-/* If success, return the pointer to the function defined by SYMBOL on the
- * device linked to the called 
- * device.
- */
-starpu_scc_kernel_t starpu_scc_get_kernel(starpu_scc_func_symbol_t symbol)
-{
-	return _starpu_scc_src_get_kernel(symbol);
-}