{"id":18335729,"url":"https://github.com/shadensmith/splatt-ipdps17","last_synced_at":"2025-07-05T01:41:03.693Z","repository":{"id":73552293,"uuid":"91914545","full_name":"ShadenSmith/splatt-ipdps17","owner":"ShadenSmith","description":"SPLATT source code used in our IPDPS '17 paper.","archived":false,"fork":false,"pushed_at":"2017-05-20T20:54:06.000Z","size":6688,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T19:51:33.155Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShadenSmith.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-20T20:26:48.000Z","updated_at":"2018-06-04T21:06:29.000Z","dependencies_parsed_at":"2023-02-25T15:45:50.993Z","dependency_job_id":null,"html_url":"https://github.com/ShadenSmith/splatt-ipdps17","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadenSmith%2Fsplatt-ipdps17","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadenSmith%2Fsplatt-ipdps17/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadenSmith%2Fsplatt-ipdps17/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadenSmith%2Fsplatt-ipdps17/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShadenSmith","download_url":"https://codeload.github.com/ShadenSmith/splatt-ipdps17/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103761,"owners_count":21048236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T20:04:22.534Z","updated_at":"2025-04-09T19:50:15.620Z","avatar_url":"https://github.com/ShadenSmith.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"This repository is a fork of [SPLATT](https://github.com/ShadenSmith/splatt)\nused in the IPDPS'17 paper *Sparse Tensor Factorization on Many-Core Processors\nwith High-Bandwidth Memory* by Shaden Smith, Jongsoo Park, and George Karypis.\nThe code currently requires access to the Intel compiler chain and machines\nwith support for AVX-2 or AVX-512 vector instructions. This source code is\nspecifically optimized for Intel Knights Landing (KNL). The main SPLATT\nrepository will be updated as the code is cleaned/generalized.\n\nTo configure with optimizations for KNL:\n\n    $ ./my_configure --knl\n\nOtherwise:\n\n    $ ./my_configure\n\nThe `my_configure` script simply wraps `configure` while invoking the Intel\ncompiler toolchain and builds a dependency (`src/SpMP`).\n\n\nThe Surprisingly ParalleL spArse Tensor Toolkit\n===============================================\n\nSPLATT is a library and C API for sparse tensor factorization. SPLATT supports\nshared-memory parallelism with OpenMP and distributed-memory parallelism with\nMPI.\n\n\nTensor Format\n-------------\nSPLATT expects tensors to be stored in 1-indexed coordinate format with\nnonzeros separated by newlines. Each line of of the file has the coordinates of\nthe nonzero  followed by the value, all separated by spaces.  The following is\nan example 2x2x3 tensor with 5 nonzeros:\n\n    # This is a comment\n    1 1 2 1.5\n    1 2 2 2.5\n    2 1 1 3.7\n    1 2 3 0.5\n    2 1 2 4.1\n\n\nBuilding \u0026 Installing\n---------------------\nIn short,\n\n    $ ./configure \u0026\u0026 make\n\nwill build the SPLATT library and its executable. The executable will be found\nin `build/\u003carch\u003e/bin/`. You can also run\n\n    $ ./configure --help\n\nto see additional build options. To install,\n\n    $ make install\n\nwill suffice. The installation prefix can be chosen by adding a\n'--prefix=DIR' flag to configure.\n\n\nExecutable\n----------\nAfter building, an executable will found in the `build/` directory (or the\ninstallation prefix if SPLATT was installed). SPLATT builds a single executable\nwhich features a number of sub-commands:\n\n* cpd\n* check\n* convert\n* reorder\n* stats\n\nAll SPLATT commands are executed in the form\n\n    $ splatt CMD [OPTIONS]\n\nYou can execute\n\n    $ splatt CMD --help\n\nfor usage information of each command.\n\n### Example 1\n\n    $ splatt check mytensor.tns  --fix=fixed.tns\n\nThis runs `splatt-check` on 'mytensor.tns' and writes the fixed tensor to\n'fixed.tns'. The `splatt-check` routine finds empty slices and duplicate\nnonzero entries. Empty slices are indices in any mode which do not have any\nnonzero entries associated with them. Some SPLATT routines (including CPD)\nexpect there to be no empty slices, so running `splatt-check` on a new tensor\nis recommended.\n\n### Example 2\n\n    $ splatt cpd mytensor.tns -r 25 -t 4\n\nThis runs `splatt-cpd` on 'mytensor.tns' and finds a rank-25 CPD of the tensor.\nAdding '-t 4' instructs SPLATT to use four OpenMP threads during the\ncomputation. SPLATT will use all available CPU cores by default.  The matrix\nfactors are written to `modeN.mat` and lambda, the vector for scaling, is\nwritten to `lambda.mat`.\n\n\nDistributed-Memory Computation\n------------------------------\nSPLATT can optionally be built with support for distributed-memory systems via\nMPI. To add MPI support, simply add \"--mpi\" to the configuration step:\n\n    $ ./configure --mpi \u0026\u0026 make\n\nAfter building with MPI, `splatt-cpd` can be used as before. Careful\nconsideration should be given to the mapping of MPI ranks to nodes, because\neach SPLATT process will by default use all available CPU cores. We recommend\nmapping one rank per node. The necessary parameters to `mpirun` vary based\non the MPI implementation. For example, OpenMPI supports:\n\n### Example 3\n\n    $ mpirun -pernode -np 16 splatt cpd mytensor.tns -r 25\n\nThis would fully utilize 16 nodes to compute a rank-25 CPD of `mytensor.tns`.\nTo alternatively use one MPI rank per core:\n\n### Example 3\n\n    $ mpirun -np 128 splatt cpd mytensor.tns -r 25 -t 1\n\nThis would use 128 processes, with each using only one OpenMP thread.\n\n\nC/C++ API\n---------\nSPLATT provides a C API which is callable from C and C++. Installation not only\ninstalls the SPLATT executable, but also the static library `libsplatt.a` and\nthe header `splatt.h`. To use the C API, include `splatt.h` and link against\nthe SPLATT library. SPLATT also depends on the OpenMP and math libraries. The\nfollowing is an example compilation command:\n\n    $ gcc mycode.c -lsplatt -lgomp -lm\n    $ g++ mycode.cc -lsplatt -lgomp -lm\n\n### IO\nUnless otherwise noted, SPLATT expects tensors to be stored in the compressed\nsparse fiber (CSF) format. SPLATT provides two functions for forming a tensor\nin CSF:\n\n* `splatt_csf_load` reads a tensor from a file\n* `splatt_csf_convert` converts a tensor from coordinate format to CSF\n\n\n### Computation\n* `splatt_cpd` computes the CPD and returns a Kruskal tensor\n* `splatt_default_opts` allocates and returns an options array with defaults\n\n\n### Cleanup\nAll memory allocated by the SPLATT API should be freed by these functions:\n\n* `splatt_free_csf` deallocates a list of CSF tensors\n* `splatt_free_opts` deallocates a SPLATT options array\n* `splatt_free_kruskal` deallocates a Kruskal tensor\n\n### Example\nThe following is an example usage of the SPLATT API:\n\n    #include \u003csplatt.h\u003e\n\n    /* allocate default options */\n    double * cpd_opts = splatt_default_opts();\n\n    /* load the tensor from a file */\n    int ret;\n    splatt_idx_t nmodes;\n    splatt_csf_t * tt;\n    ret = splatt_csf_load(\"mytensor.tns\", \u0026nmodes, \u0026tt, cpd_opts);\n\n    /* do the factorization! */\n    splatt_kruskal_t factored;\n    ret = splatt_cpd_als(tt, 10, cpd_opts, \u0026factored);\n\n    /* do some processing */\n    for(splatt_idx_t m = 0; m \u003c nmodes; ++m) {\n      /* access factored.lambda and factored.factors[m] */\n    }\n\n    /* cleanup */\n    splatt_free_csf(tt, cpd_opts);\n    splatt_free_kruskal(\u0026factored);\n    splatt_free_opts(cpd_opts);\n\n\nPlease see `splatt.h` for further documentation of SPLATT structures and call\nsignatures.\n\n\nOctave/Matlab API\n----------------------------\nSPLATT also provides an API callable from Octave and Matlab that wraps the C\nAPI. To compile the interface just enter the `matlab/` directory from either\nOctave or Matlab and call `make`.\n\n    \u003e\u003e cd matlab\n    \u003e\u003e make\n\nAfter compilation the MEX files will be found in the current directory. You can\nnow call those functions directly:\n\n    \u003e\u003e KT = splatt_cpd('mytensor.tns', 25);\n\n`splatt_cpd` returns a structure with three fields:\n\n* `U` a cell array of the factor matrices\n* `lambda` the factor column norms absorbed into a vector\n* `fit` quality of the CPD defined by: 1 - (norm(residual) / norm(X))\n\nSPLATT also supports explicitly storing tensors in CSF form to avoid IO times\nduring successive factorizations,\n\n    \u003e\u003e X = splatt_load('mytensor.tns');\n    \u003e\u003e K25 = splatt_cpd(X, 25);\n    \u003e\u003e K50 = splatt_cpd(X, 50);\n\nSPLATT accepts non-default parameters via structures:\n\n    \u003e\u003e opts = struct('its', 100, 'tol', 1e-8);\n    \u003e\u003e XT = splatt_cpd(X, 25, opts);\n\nFinally, there are several SPLATT routines exposed for developing other tensor\noperations. SPLATT provides:\n\n* `splatt_mttkrp`\n* `splatt_norm`\n* `splatt_dim`\n* `splatt_innerprod`\n\nPlease see `help \u003ccmd\u003e` from an Octave/Matlab terminal or read \u003ccmd\u003e.m in the\n`matlab/` directory for more usage information.\n\n\nLicensing\n---------\nSPLATT is released under the MIT License. Please see the 'LICENSE' file for\ndetails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadensmith%2Fsplatt-ipdps17","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadensmith%2Fsplatt-ipdps17","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadensmith%2Fsplatt-ipdps17/lists"}