GCC Code Coverage Report
Directory: . Exec Total Coverage
File: artifact/sc18gofmm/artifact_sc18gofmm.cpp Lines: 0 29 0.0 %
Date: 2019-01-14 Branches: 0 44 0.0 %

Line Exec Source
1
/**
2
 *  HMLP (High-Performance Machine Learning Primitives)
3
 *
4
 *  Copyright (C) 2014-2017, The University of Texas at Austin
5
 *
6
 *  This program is free software: you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation, either version 3 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program. If not, see the LICENSE file.
18
 *
19
 **/
20
21
/** GOFMM templates */
22
#include <gofmm_mpi.hpp>
23
/** Use dense SPD matrices. */
24
#include <containers/SPDMatrix.hpp>
25
/** use implicit kernel matrices (only coordinates are stored). */
26
#include <containers/KernelMatrix.hpp>
27
/** use distributed implicit kernel matrices (only coordinates are stored). */
28
#include <containers/VirtualMatrix.hpp>
29
/** use implicit PVFMM kernel matrices. */
30
#include <containers/OOCCovMatrix.hpp>
31
/** Use STL and HMLP namespaces. */
32
using namespace std;
33
using namespace hmlp;
34
35
36
37
/** @brief Top level driver that reads arguments from the command line. */
38
int main( int argc, char *argv[] )
39
{
40
  /** Parse arguments from the command line. */
41
  gofmm::CommandLineHelper cmd( argc, argv );
42
43
  /** MPI (Message Passing Interface): check for THREAD_MULTIPLE support. */
44
  int size, rank, provided;
45
	mpi::Init_thread( &argc, &argv, MPI_THREAD_MULTIPLE, &provided );
46
	if ( provided != MPI_THREAD_MULTIPLE )
47
	{
48
		printf( "MPI_THREAD_MULTIPLE is not supported\n" ); fflush( stdout );
49
    exit( 1 );
50
	}
51
52
  /** MPI (Message Passing Interface): create a specific comm for GOFMM. */
53
  mpi::Comm CommGOFMM;
54
  mpi::Comm_dup( MPI_COMM_WORLD, &CommGOFMM );
55
56
  mpi::PrintProgress( "\n--- Artifact of GOFMM for Super Computing 2018\n", CommGOFMM );
57
58
  /** HMLP API call to initialize the runtime. */
59
  hmlp_init( CommGOFMM );
60
61
  /** Run the matrix file provided by users. */
62
  if ( !cmd.spdmatrix_type.compare( "dense" ) )
63
  {
64
    using T = float;
65
    /** Dense spd matrix format. */
66
    SPDMatrix<T> K( cmd.n, cmd.n, cmd.user_matrix_filename );
67
    /** Launch self-testing routine. */
68
    mpigofmm::LaunchHelper( K, cmd, CommGOFMM );
69
  }
70
71
  /** Run the matrix file provided by users */
72
  if ( !cmd.spdmatrix_type.compare( "ooc" ) )
73
  {
74
    using T = float;
75
    /** Dense spd matrix format. */
76
    OOCSPDMatrix<T> K( cmd.n, cmd.n, cmd.user_matrix_filename );
77
    /** Launch self-testing routine. */
78
    mpigofmm::LaunchHelper( K, cmd, CommGOFMM );
79
  }
80
81
  /** Generate a kernel matrix from the coordinates. */
82
  if ( !cmd.spdmatrix_type.compare( "kernel" ) )
83
  {
84
    using T = double;
85
    /** Read the coordinates from the file. */
86
    DistData<STAR, CBLK, T> X( cmd.d, cmd.n, CommGOFMM, cmd.user_points_filename );
87
    /** Setup the kernel object. */
88
    kernel_s<T, T> kernel;
89
    kernel.type = GAUSSIAN;
90
    if ( !cmd.kernelmatrix_type.compare( "gaussian" ) ) kernel.type = GAUSSIAN;
91
    if ( !cmd.kernelmatrix_type.compare(  "laplace" ) ) kernel.type = LAPLACE;
92
    kernel.scal = -0.5 / ( cmd.h * cmd.h );
93
    /** Distributed spd kernel matrix format (implicitly create). */
94
    DistKernelMatrix<T, T> K( cmd.n, cmd.d, kernel, X, CommGOFMM );
95
    /** Launch self-testing routine. */
96
    mpigofmm::LaunchHelper( K, cmd, CommGOFMM );
97
  }
98
99
  /** Create a random spd matrix, which is diagonal-dominant. */
100
  if ( !cmd.spdmatrix_type.compare( "testsuit" ) )
101
  {
102
    using T = double;
103
    /** dense spd matrix format */
104
    SPDMatrix<T> K( cmd.n, cmd.n );
105
    /** random spd initialization */
106
    K.randspd( 0.0, 1.0 );
107
    /** broadcast K to all other rank */
108
    mpi::Bcast( K.data(), cmd.n * cmd.n, 0, CommGOFMM );
109
    /** Launch self-testing routine. */
110
    mpigofmm::LaunchHelper( K, cmd, CommGOFMM );
111
  }
112
113
  /** HMLP API call to terminate the runtime */
114
  hmlp_finalize();
115
  /** Message Passing Interface */
116
  mpi::Finalize();
117
118
  return 0;
119
120
}; /** end main() */