/* StarPU --- Runtime system for heterogeneous multicore architectures. * * Copyright (C) 2009-2011 Université de Bordeaux 1 * Copyright (C) 2010 Mehdi Juhoor * Copyright (C) 2010, 2011, 2012 Centre National de la Recherche Scientifique * * 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 "cholesky.h" #include "cholesky_kernels.h" #define __heap __attribute__ ((heap_allocated)) /* * code to bootstrap the factorization * and construct the DAG */ static void dw_cholesky(unsigned nblocks, unsigned size, unsigned ld, float matA[nblocks][nblocks][size/nblocks * size/nblocks]) { struct timeval start; struct timeval end; int x, y; /* create all the DAG nodes */ unsigned i,j,k; for(x = 0; x < nblocks ; x++) { for (y = 0; y < nblocks; y++) { #pragma starpu register matA[x][y] } } gettimeofday(&start, NULL); for (k = 0; k < nblocks; k++) { #ifdef STARPU_DEVEL # warning deal with prio and models #endif // int prio = STARPU_DEFAULT_PRIO; // if (!noprio) prio = STARPU_MAX_PRIO; chol_codelet_update_u11(matA[k][k], size/nblocks, ld); for (j = k+1; j j) { rmat[j+i*size] = 0.0f; // debug } } } float test_mat[size * size] __heap; STARPU_SSYRK("L", "N", size, size, 1.0f, rmat, size, 0.0f, test_mat, size); fprintf(stderr, "comparing results ...\n"); if (display) { for (j = 0; j < size; j++) { for (i = 0; i < size; i++) { if (i <= j) { printf("%2.2f\t", test_mat[j +i*size]); } else { printf(".\t"); } } printf("\n"); } } int correctness = 1; for(x = 0; x < nblocks ; x++) { for (y = 0; y < nblocks; y++) { for (i = (size/nblocks)*x ; i < (size/nblocks)*x+(size/nblocks); i++) { for (j = (size/nblocks)*y ; j < (size/nblocks)*y+(size/nblocks); j++) { if (i <= j) { float orig = (1.0f/(1.0f+i+j)) + ((i == j)?1.0f*size:0.0f); float err = abs(test_mat[j +i*size] - orig); if (err > 0.00001) { fprintf(stderr, "Error[%d, %d] --> %2.2f != %2.2f (err %2.2f)\n", i, j, test_mat[j +i*size], orig, err); correctness = 0; break; } } } } } } starpu_cublas_shutdown(); #pragma starpu shutdown assert(correctness); return 0; }