[ 
https://issues.apache.org/jira/browse/HAMA-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13415999#comment-13415999
 ] 

Mikalai Parafeniuk commented on HAMA-524:
-----------------------------------------

I think I should describe two methods: setup() and bsp() in SpMV class. Hama's 
initialization is made in method SparseMatrixVectorMultiplication and no 
pseudocode needed, code can be found in my GitHub repository.

Variables: matrixLocalArray - array of local matrices, vectorLocalArray - array 
of local vectors, peerCount - number of peers, masterTask - name of master 
task, mLocal - local matrix, vLocal - local vector, peerName - name of current 
peer, inputMatrix and inputVector - input data.

Setup procedure.
{code}
masterTask = selectMasterTask();
if (peerName == masterTask) {
  matrixLocalArray = createArrayOfMatrix();
  vectorLocalArray = createArrayOfVector();
  selectSpmvStrategy();
  selectSpmvMappers();
  for (int i = 0; i < peerCount; i++) {
    matrixLocalArray[i] = createEmptyMatrix()
    vectorLocalArray[i] = createEmptyVector();
  }
  for (matrixItem : inputMatrix) {
    int owner = getOwnerOfMatrixCell(matrixItem);
    matrixLocalArray[owner] = matrixItem;
  }
  for (vectorItem : inputVector) {
    int owner = getOwnerOfVectorCell(vectorItem);
    vectorLocalArray[owner] = vectorItem;
  }
}
sync();
{code}

Bsp procedure.
{code}
int index = definePeerIndex();
mLocal = matrixLocalArray[index];
vLocal = vectorLocalArray[index];
makeOtherComputation();
{code}

NullPointerException is thrown from time to time when i am trying to setup 
local matrix and array in bsp procedure, because different peers are from 
different sides of barrier synchronization. Thus masterTask haven't initialized 
cell in matrixLocalArray yeat and some peers trying to access local matrix in 
bsp method.
                
> [GSoC 2012] Sparse Matrix-Vector multiplication (SpMV) on Hama
> --------------------------------------------------------------
>
>                 Key: HAMA-524
>                 URL: https://issues.apache.org/jira/browse/HAMA-524
>             Project: Hama
>          Issue Type: New Feature
>          Components: bsp core, examples, math
>            Reporter: Edward J. Yoon
>            Assignee: Mikalai Parafeniuk
>              Labels: gsoc, gsoc2012, newbie
>
> Implement Efficient and Fast SpMV algorithm which can be widely used in 
> scientific computing, financial modeling, information retrieval, and others, 
> using Hama Bulk Synchronous Parallel framework.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to