/* StarPU --- Runtime system for heterogeneous multicore architectures. * * Copyright (C) 2013 Corentin Salingue * * 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 #include #include #include #include #include #include #include #include #include /* ------------------- use UNISTD to write on disk ------------------- */ /* allocation memory on disk */ static void * starpu_unistd_alloc (void *base, size_t size) { struct starpu_unistd_global_obj * obj = malloc(sizeof(struct starpu_unistd_global_obj)); STARPU_ASSERT(obj != NULL); /* only flags change between unistd and unistd_o_direct */ obj->flags = O_RDWR; return starpu_unistd_global_alloc (obj, base, size); } /* open an existing memory on disk */ static void * starpu_unistd_open (void *base, void *pos, size_t size) { struct starpu_unistd_global_obj * obj = malloc(sizeof(struct starpu_unistd_global_obj)); STARPU_ASSERT(obj != NULL); /* only flags change between unistd and unistd_o_direct */ obj->flags = O_RDWR; return starpu_unistd_global_open (obj, base, pos, size); } struct starpu_disk_ops starpu_disk_unistd_ops = { .alloc = starpu_unistd_alloc, .free = starpu_unistd_global_free, .open = starpu_unistd_open, .close = starpu_unistd_global_close, .read = starpu_unistd_global_read, .write = starpu_unistd_global_write, .plug = starpu_unistd_global_plug, .unplug = starpu_unistd_global_unplug, .copy = NULL, .bandwidth = get_unistd_global_bandwidth_between_disk_and_main_ram };