浏览代码

mpi/examples/: reorganise code for matrix_decomposition

Nathalie Furmento 12 年之前
父节点
当前提交
8fab387fd6

+ 5 - 4
mpi/examples/Makefile.am

@@ -53,10 +53,11 @@ EXTRA_DIST = 					\
 	mpi_lu/pxlu.c			\
 	mpi_lu/pxlu_kernels.h		\
 	mpi_lu/pxlu_kernels.c		\
-	matrix_decomposition/mpi_cholesky.h	\
-	matrix_decomposition/mpi_kernels.h	\
-	matrix_decomposition/mpi_cholesky_models.h \
-	matrix_decomposition/mpi_cholesky_codelets.h \
+	matrix_decomposition/mpi_cholesky.h		\
+	matrix_decomposition/mpi_kernels.h		\
+	matrix_decomposition/mpi_cholesky_models.h 	\
+	matrix_decomposition/mpi_cholesky_codelets.h 	\
+	matrix_decomposition/mpi_cholesky_params.h	\
 	../tests/helper.h
 
 examplebindir = $(libdir)/starpu/mpi

+ 1 - 1
mpi/examples/matrix_decomposition/mpi_cholesky.c

@@ -18,7 +18,7 @@
 
 #include <starpu_mpi.h>
 #include <common/blas.h>
-#include "mpi_cholesky.h"
+#include "mpi_cholesky_params.h"
 #include "mpi_cholesky_models.h"
 #include "mpi_cholesky_codelets.h"
 

+ 0 - 84
mpi/examples/matrix_decomposition/mpi_cholesky.h

@@ -1,84 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012, 2013  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.
- */
-
-#ifndef __MPI_CHOLESKY_H__
-#define __MPI_CHOLESKY_H__
-
-#define BLOCKSIZE	(size/nblocks)
-
-static unsigned size = 4*1024;
-static unsigned nblocks = 16;
-static unsigned nbigblocks = 2;
-static unsigned noprio = 0;
-static unsigned display = 0;
-static unsigned dblockx = -1;
-static unsigned dblocky = -1;
-
-static void __attribute__((unused)) parse_args(int argc, char **argv)
-{
-	int i;
-	for (i = 1; i < argc; i++)
-	{
-		if (strcmp(argv[i], "-size") == 0)
-		{
-			char *argptr;
-			size = strtol(argv[++i], &argptr, 10);
-		}
-
-		if (strcmp(argv[i], "-dblockx") == 0)
-		{
-			char *argptr;
-			dblockx = strtol(argv[++i], &argptr, 10);
-		}
-
-		if (strcmp(argv[i], "-dblocky") == 0)
-		{
-			char *argptr;
-			dblocky = strtol(argv[++i], &argptr, 10);
-		}
-
-		if (strcmp(argv[i], "-nblocks") == 0)
-		{
-			char *argptr;
-			nblocks = strtol(argv[++i], &argptr, 10);
-		}
-
-		if (strcmp(argv[i], "-nbigblocks") == 0)
-		{
-			char *argptr;
-			nbigblocks = strtol(argv[++i], &argptr, 10);
-		}
-
-		if (strcmp(argv[i], "-no-prio") == 0)
-		{
-			noprio = 1;
-		}
-
-		if (strcmp(argv[i], "-display") == 0)
-		{
-			display = 1;
-		}
-
-		if (strcmp(argv[i], "-h") == 0)
-		{
-			printf("usage : %s [-display] [-size size] [-nblocks nblocks]\n", argv[0]);
-		}
-	}
-	if (nblocks > size) nblocks = size;
-}
-
-#endif // __MPI_CHOLESKY_H__

+ 1 - 1
mpi/examples/matrix_decomposition/mpi_cholesky_codelets.c

@@ -16,7 +16,7 @@
  */
 
 #include <starpu_mpi.h>
-#include "mpi_cholesky.h"
+#include "mpi_cholesky_params.h"
 #include "mpi_cholesky_models.h"
 #include "mpi_cholesky_codelets.h"
 #include "mpi_cholesky_kernels.h"

+ 1 - 1
mpi/examples/matrix_decomposition/mpi_cholesky_distributed.c

@@ -17,7 +17,7 @@
  */
 
 #include <starpu_mpi.h>
-#include "mpi_cholesky.h"
+#include "mpi_cholesky_params.h"
 #include "mpi_cholesky_models.h"
 #include "mpi_cholesky_codelets.h"
 

+ 2 - 2
mpi/examples/matrix_decomposition/mpi_cholesky_kernels.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  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
@@ -16,7 +16,7 @@
  */
 
 #include <starpu.h>
-#include "mpi_cholesky.h"
+#include "mpi_cholesky_params.h"
 #include "common/blas.h"
 #ifdef STARPU_USE_CUDA
 #include <cuda.h>

+ 82 - 0
mpi/examples/matrix_decomposition/mpi_cholesky_params.c

@@ -0,0 +1,82 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2009, 2010  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  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 <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+unsigned size = 4*1024;
+unsigned nblocks = 16;
+unsigned nbigblocks = 2;
+unsigned noprio = 0;
+unsigned display = 0;
+unsigned dblockx = -1;
+unsigned dblocky = -1;
+
+void parse_args(int argc, char **argv)
+{
+        int i;
+        for (i = 1; i < argc; i++)
+        {
+                if (strcmp(argv[i], "-size") == 0)
+                {
+                        char *argptr;
+                        size = strtol(argv[++i], &argptr, 10);
+                }
+
+                if (strcmp(argv[i], "-dblockx") == 0)
+                {
+                        char *argptr;
+                        dblockx = strtol(argv[++i], &argptr, 10);
+                }
+
+                if (strcmp(argv[i], "-dblocky") == 0)
+                {
+                        char *argptr;
+                        dblocky = strtol(argv[++i], &argptr, 10);
+                }
+
+                if (strcmp(argv[i], "-nblocks") == 0)
+                {
+                        char *argptr;
+                        nblocks = strtol(argv[++i], &argptr, 10);
+                }
+
+                if (strcmp(argv[i], "-nbigblocks") == 0)
+                {
+                        char *argptr;
+                        nbigblocks = strtol(argv[++i], &argptr, 10);
+                }
+
+                if (strcmp(argv[i], "-no-prio") == 0)
+                {
+                        noprio = 1;
+                }
+
+                if (strcmp(argv[i], "-display") == 0)
+                {
+                        display = 1;
+                }
+
+                if (strcmp(argv[i], "-h") == 0)
+                {
+                        printf("usage : %s [-display] [-size size] [-nblocks nblocks]\n", argv[0]);
+                }
+        }
+        if (nblocks > size) nblocks = size;
+}
+

+ 34 - 0
mpi/examples/matrix_decomposition/mpi_cholesky_params.h

@@ -0,0 +1,34 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2009, 2010  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  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.
+ */
+
+#ifndef __MPI_CHOLESKY_PARAMS_H__
+#define __MPI_CHOLESKY_PARAMS_H__
+
+#define BLOCKSIZE       (size/nblocks)
+
+extern unsigned size;
+extern unsigned nblocks;
+extern unsigned nbigblocks;
+extern unsigned noprio;
+extern unsigned display;
+extern unsigned dblockx;
+extern unsigned dblocky;
+
+void parse_args(int argc, char **argv);
+
+#endif // __MPI_CHOLESKY_PARAMS_H__
+