24   std::string m_Afile_name;
    25   std::string m_outputfile_name;
    34   UVEC m_factor_local_dims;
    37   bool m_enable_dim_tree;
    38   static const int kprimeoffset = 17;
    41     std::cout << 
"a::" << this->m_ntfalgo << 
"::i::" << this->m_Afile_name
    42               << 
"::k::" << this->m_k << 
"::dims::" << this->m_global_dims
    43               << 
"::t::" << this->m_num_it
    44               << 
"::proc_grids::" << this->m_proc_grids
    45               << 
"::error::" << this->m_compute_error
    46               << 
"::regs::" << this->m_regs
    47               << 
"::num_k_blocks::" << m_num_k_blocks
    48               << 
"::dim_tree::" << m_enable_dim_tree << std::endl;
    51   template <
class NTFTYPE>
    54     std::string rand_prefix(
"rand_");
    59     dio.
readInput(m_Afile_name, this->m_global_dims, this->m_proc_grids,
    60                     this->m_k, this->m_sparsity);
    64          << 
"::Completed generating tensor A=" << A.
dimensions()
    66          << 
"::global dims::" << this->m_global_dims << std::endl;
    67 #ifdef DISTNTF_VERBOSE    70 #ifdef WRITE_RAND_INPUT    72 #endif  // ifdef WRITE_RAND_INPUT    79     INFO << mpicomm.
rank() << 
"::" << __PRETTY_FUNCTION__
    80          << 
"::" << factors.printinfo() << std::endl;
    81 #endif  // ifdef MPI_VERBOSE    82     MPI_Barrier(MPI_COMM_WORLD);
    94     m_nls_sizes = arma::zeros<UVEC>(num_modes);
    95     m_nls_idxs = arma::zeros<UVEC>(num_modes);
    97     for (
int i = 0; i < num_modes; i++) {
   100       int num_rows = this->m_factor_local_dims[i];
   101       m_nls_sizes[i] = 
itersplit(num_rows, slice_size, slice_rank);
   102       m_nls_idxs[i] = 
startidx(num_rows, slice_size, slice_rank);
   105     MPI_Barrier(MPI_COMM_WORLD);
   107     NTFTYPE ntfsolver(A, this->m_k, this->m_ntfalgo, this->m_global_dims,
   108                       this->m_factor_local_dims, this->m_nls_sizes,
   109                       this->m_nls_idxs, mpicomm);
   111     ntfsolver.num_iterations(this->m_num_it);
   112     ntfsolver.compute_error(this->m_compute_error);
   113     if (this->m_enable_dim_tree) {
   114       ntfsolver.dim_tree(this->m_enable_dim_tree);
   116     ntfsolver.regularizers(this->m_regs);
   117     MPI_Barrier(MPI_COMM_WORLD);
   120     ntfsolver.computeNTF();
   123     if (!this->m_outputfile_name.empty()) {
   124       dio.
write(this->m_outputfile_name, &ntfsolver);
   126     if (mpicomm.
rank() == 0) {
   127       printf(
"NTF took %.3lf secs.\n", temp);
   135   void parseCommandLine() {
   138     this->m_ntfalgo = pc.
lucalgo();
   144     this->m_num_k_blocks = 1;
   148     this->m_enable_dim_tree = pc.
dim_tree();
   151     switch (this->m_ntfalgo) {
   153         callDistNTF<DistNTFMU>();
   156         callDistNTF<DistNTFHALS>();
   159         callDistNTF<DistNTFANLSBPP>();
   162         callDistNTF<DistNTFAOADMM>();
   165         callDistNTF<DistNTFNES>();
   168         callDistNTF<DistNTFCPALS>();
   171         ERR << 
"Wrong algorithm choice. Quitting.." << this->m_ntfalgo
   181     this->parseCommandLine();
   187 int main(
int argc, 
char *argv[]) {
   190   MPI_Barrier(MPI_COMM_WORLD);
 algotype lucalgo()
Returns the NMF algorithm to run. Passed as parameter –algo or -a. 
 
int slice_size(int mode) const
 
std::string output_file_name()
Returns output file name. 
 
float sparsity()
Input parameter for generating sparse matrix. Passed as -s or –sparsity. 
 
Data is stored such that the unfolding  is column major. 
 
int rank(const int *i_coords) const
Returns the rank of current MPI process given the cartesian coordinates. 
 
bool compute_error()
Returns whether to compute error not. Passed as parameter -e or –error. 
 
void write(const std::string &output_file_name, DistAUNTF *ntfsolver)
 
DistNTF(int argc, char *argv[])
Driver function for the distntf. 
 
int startidx(int n, int p, int r)
Returns the start idx of the current rank r for a global dimension n across p processes. 
 
int iterations()
Returns number of iterations. passed as -t or –iter. 
 
int main(int argc, char *argv[])
 
int itersplit(int n, int p, int r)
The dimension a particular rank holds out of the global dimension n across p processes. 
 
void print() const
prints the value of the tensor. 
 
void parseplancopts()
parses the command line parameters 
 
void memusage(const int myrank, std::string event)
Captures the memory usage of every mpi process. 
 
UWORD lowrankk()
returns the low rank. Passed as parameter –lowrank or -k 
 
UVEC processor_grids()
Returns the process grid configuration. 
 
UVEC dimensions() const
Returns a vector of dimensions on every mode. 
 
std::string input_file_name()
Returns input file name. Passed as -i or –input. 
 
int slice_rank(int i) const
Returns the slice rank on a particular slice grid. 
 
void readInput(const std::string file_name, UVEC i_global_dims, UVEC i_proc_grids, UWORD k=0, double sparsity=0)
 
FVEC regularizers()
Returns the vector regularizers for all the modes. 
 
ncp_factors contains the factors of the ncp every ith factor is of size n_i * k number of factors is ...
 
void clear()
Clears the data and also destroys the storage. 
 
UVEC dimensions()
Returns vector of dimensions for every mode. 
 
bool dim_tree()
Enable dimension tree or not.