/* StarPU --- Runtime system for heterogeneous multicore architectures. * * Copyright (C) 2013-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), 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 #include "../helper.h" #include #include /* Stress data allocation on a GPU, triggering eviction */ #define SIZE_LIMIT 128 #define STR_LIMIT "128" #define SIZE_ALLOC 128 #if !defined(STARPU_HAVE_SETENV) #warning setenv is not defined. Skipping test int main(int argc, char **argv) { return STARPU_TEST_SKIPPED; } #else static int test_prefetch(unsigned memnodes) { float *buffers[4]; starpu_data_handle_t handles[4]; unsigned i; starpu_ssize_t available_size; if (starpu_get_env_number_default("STARPU_DIDUSE_BARRIER", 0)) /* This would hang */ return STARPU_TEST_SKIPPED; buffers[0] = malloc(SIZE_ALLOC*1024*512); STARPU_ASSERT(buffers[0]); /* Prefetch half the memory */ starpu_variable_data_register(&handles[0], STARPU_MAIN_RAM, (uintptr_t)buffers[0], SIZE_ALLOC*1024*512); for(i=1 ; i