~ubuntu-branches/ubuntu/saucy/nwchem/saucy

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/global/testing/testmultrect.c

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2012-02-09 20:02:41 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120209200241-jgk03qfsphal4ug2
Tags: 6.1-1
* New upstream release.

[ Michael Banck ]
* debian/patches/02_makefile_flags.patch: Updated.
* debian/patches/02_makefile_flags.patch: Use internal blas and lapack code.
* debian/patches/02_makefile_flags.patch: Define GCC4 for LINUX and LINUX64
  (Closes: #632611 and LP: #791308).
* debian/control (Build-Depends): Added openssh-client.
* debian/rules (USE_SCALAPACK, SCALAPACK): Removed variables (Closes:
  #654658).
* debian/rules (LIBDIR, USE_MPIF4, ARMCI_NETWORK): New variables.
* debian/TODO: New file.
* debian/control (Build-Depends): Removed libblas-dev, liblapack-dev and
  libscalapack-mpi-dev.
* debian/patches/04_show_testsuite_diff_output.patch: New patch, shows the
  diff output for failed tests.
* debian/patches/series: Adjusted.
* debian/testsuite: Optionally run all tests if "all" is passed as option.
* debian/rules: Run debian/testsuite with "all" if DEB_BUILD_OPTIONS
  contains "checkall".

[ Daniel Leidert ]
* debian/control: Used wrap-and-sort. Added Vcs-Svn and Vcs-Browser fields.
  (Priority): Moved to extra according to policy section 2.5.
  (Standards-Version): Bumped to 3.9.2.
  (Description): Fixed a typo.
* debian/watch: Added.
* debian/patches/03_hurd-i386_define_path_max.patch: Added.
  - Define MAX_PATH if not defines to fix FTBFS on hurd.
* debian/patches/series: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * testmultrect.c
 
3
 * Test rectangular matrix multiplication.
 
4
 *
 
5
 * Nawab Ali <nawab.ali@pnl.gov>
 
6
 */
 
7
#if HAVE_CONFIG_H
 
8
#   include "config.h"
 
9
#endif
 
10
 
 
11
#include <math.h>
 
12
#include <stdio.h>
 
13
#include <stdlib.h>
 
14
#include "ga.h"
 
15
#include "macdecls.h"
 
16
#include "mp3.h"
 
17
 
 
18
#define NDIMS 2                 /* 2-dimensional matrices */
 
19
 
 
20
#define HEAP  4000000
 
21
#define STACK 4000000
 
22
 
 
23
int m = 2;
 
24
int k = 3;
 
25
int n = 4;
 
26
int g_a, g_b, g_c;              /* GA handles for matrices A, B, and C */
 
27
 
 
28
int mr_create_matrices(void);
 
29
int mr_cleanup(void);
 
30
 
 
31
 
 
32
int main(int argc, char **argv) {
 
33
    int ret, nprocs;
 
34
    int me, heap, stack;
 
35
 
 
36
    /* Initialize message passing and GA */
 
37
    MP_INIT(argc,argv);
 
38
    GA_INIT(argc,argv);
 
39
 
 
40
    me = GA_Nodeid();
 
41
    nprocs = GA_Nnodes();
 
42
    heap = HEAP/nprocs;
 
43
    stack = STACK/nprocs;
 
44
 
 
45
    if (!MA_init(C_DBL, stack, heap)) {
 
46
        GA_Error("MA_init failed", stack+heap);
 
47
    }
 
48
 
 
49
    /* Create the matrices A, B, C */
 
50
    ret = mr_create_matrices();
 
51
 
 
52
    GA_Print(g_a);
 
53
    GA_Print(g_b);
 
54
    GA_Print(g_c);
 
55
 
 
56
    /* C = A x B */
 
57
    GA_Dgemm('N', 'N', m, n, k, 1.0, g_a, g_b, 0.0, g_c);
 
58
 
 
59
    /* Clean up */
 
60
    ret = mr_cleanup();
 
61
    GA_Terminate();
 
62
    MP_FINALIZE();
 
63
 
 
64
    return 0;
 
65
}
 
66
 
 
67
int mr_create_matrices(void) {
 
68
    double val_a = 10.0;
 
69
    double val_b = 20.0;
 
70
    int ret, dims[NDIMS];
 
71
 
 
72
    /* Create a 2-dimensional matrix A[m][k] */
 
73
    dims[0] = m;
 
74
    dims[1] = k;
 
75
 
 
76
    g_a = GA_Create_handle();
 
77
    GA_Set_array_name(g_a, "Matrix A");
 
78
    GA_Set_data(g_a, NDIMS, dims, C_DBL);
 
79
    ret = GA_Allocate(g_a);
 
80
    GA_Fill(g_a, &val_a);
 
81
 
 
82
    /* Create a 2-dimensional matrix B[k][n] */
 
83
    dims[0] = k;
 
84
    dims[1] = n;
 
85
 
 
86
    g_b = GA_Create_handle();
 
87
    GA_Set_array_name(g_b, "Matrix B");
 
88
    GA_Set_data(g_b, NDIMS, dims, C_DBL);
 
89
    ret = GA_Allocate(g_b);
 
90
    GA_Fill(g_b, &val_b);
 
91
 
 
92
    /* Create a 2-dimensional matrix C[m][n] */
 
93
    dims[0] = m;
 
94
    dims[1] = n;
 
95
 
 
96
    g_c = GA_Create_handle();
 
97
    GA_Set_array_name(g_c, "Matrix C");
 
98
    GA_Set_data(g_c, NDIMS, dims, C_DBL);
 
99
    ret = GA_Allocate(g_c);
 
100
    GA_Zero(g_c);
 
101
 
 
102
    return 0;
 
103
}
 
104
 
 
105
int mr_cleanup(void) {
 
106
    GA_Destroy(g_a);
 
107
    GA_Destroy(g_b);
 
108
    GA_Destroy(g_c);
 
109
    return 0;
 
110
}