You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Han Hui Wen (JIRA)" <ji...@apache.org> on 2010/08/13 08:09:17 UTC

[jira] Created: (MAHOUT-475) Replace Mapper with MultithreadedMapper to implement org.apache.mahout.math.hadoop.similarity.RowSimilarityJob.CooccurrencesMapper

Replace Mapper with  MultithreadedMapper  to implement org.apache.mahout.math.hadoop.similarity.RowSimilarityJob.CooccurrencesMapper
------------------------------------------------------------------------------------------------------------------------------------

                 Key: MAHOUT-475
                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
             Project: Mahout
          Issue Type: Improvement
          Components: Collaborative Filtering
    Affects Versions: 0.4
            Reporter: Han Hui Wen 
             Fix For: 0.4


Because CooccurrencesMapper has huge computing,
Maybe we can replace  Mapper with  MultithreadedMapper.

Original:
{code}
 public static class CooccurrencesMapper
      extends Mapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
{code}

new:
{code}
 public static class CooccurrencesMapper
      extends MultithreadedMapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
{code}

And call the mapper
original:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      pairwiseSimilarity.waitForCompletion(true);
    }
{code}

new:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      CooccurrencesMapper.setNumberOfThreads(n); //n should about be less the core counts of the machine.
      pairwiseSimilarity.waitForCompletion(true);
      
    }
{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Han Hui Wen  updated MAHOUT-475:
--------------------------------

    Status: Patch Available  (was: Open)


https://issues.apache.org/jira/secure/attachment/12452011/patch_985097.txt

Patch :
1) using MultithreadedMapper
2) compress the output
3) add --numMapThreads parameter
4) add -Dmapred.reduce.tasks 

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>             Fix For: 0.4
>
>         Attachments: patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Han Hui Wen  updated MAHOUT-475:
--------------------------------

    Attachment:     (was: after_patch_20100813.jpg)

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>            Assignee: Sean Owen
>             Fix For: 0.4
>
>         Attachments: after_patch_20100813.jpg, patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MAHOUT-475) Replace Mapper with MultithreadedMapper to implement org.apache.mahout.math.hadoop.similarity.RowSimilarityJob.CooccurrencesMapper

Posted by "Sebastian Schelter (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898100#action_12898100 ] 

Sebastian Schelter commented on MAHOUT-475:
-------------------------------------------

Hui,

Just like in the other issue can you follow these steps:

# Modify your local copy of mahout to include the changes you propose
# build Mahout and run your job again with your modified version
# upload a patch containing your changes and give us some details on the performance increase you encountered

Have a look at this website: https://cwiki.apache.org/confluence/display/MAHOUT/How+To+Contribute

> Replace Mapper with  MultithreadedMapper  to implement org.apache.mahout.math.hadoop.similarity.RowSimilarityJob.CooccurrencesMapper
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>             Fix For: 0.4
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> Original:
> {code}
>  public static class CooccurrencesMapper
>       extends Mapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
> {code}
> new:
> {code}
>  public static class CooccurrencesMapper
>       extends MultithreadedMapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
> {code}
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       CooccurrencesMapper.setNumberOfThreads(n); //n should about be less the core counts of the machine.
>       pairwiseSimilarity.waitForCompletion(true);
>       
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Han Hui Wen  updated MAHOUT-475:
--------------------------------

    Attachment: after_patch_20100813.jpg

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>            Assignee: Sean Owen
>             Fix For: 0.4
>
>         Attachments: after_patch_20100813.jpg, patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Han Hui Wen  updated MAHOUT-475:
--------------------------------

    Comment: was deleted

(was: Patch :
1) using MultithreadedMapper
2) compress the  output
3) add --numMapThreads parameter
4) add -Dmapred.reduce.tasks)

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>             Fix For: 0.4
>
>         Attachments: patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898210#action_12898210 ] 

Han Hui Wen  commented on MAHOUT-475:
-------------------------------------

For Job RowSimilarityJob-CooccurrencesMapper-SimilarityReducer:
before using patch ,we used 4.5hours,
after using patch,we only used 43 minutes.

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>            Assignee: Sean Owen
>             Fix For: 0.4
>
>         Attachments: after_patch_20100813.jpg, patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-475) Replace Mapper with MultithreadedMapper to implement org.apache.mahout.math.hadoop.similarity.RowSimilarityJob.CooccurrencesMapper

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Han Hui Wen  updated MAHOUT-475:
--------------------------------

    Description: 
Because CooccurrencesMapper has huge computing,
Maybe we can replace  Mapper with  MultithreadedMapper.

Original:
{code}
 public static class CooccurrencesMapper
      extends Mapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
{code}

new:
{code}
 public static class CooccurrencesMapper
      extends MultithreadedMapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
{code}

And call the mapper
original:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      pairwiseSimilarity.waitForCompletion(true);
    }
{code}

new:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      CooccurrencesMapper.setNumberOfThreads(n); //n should about be less than core counts of the machine.
      pairwiseSimilarity.waitForCompletion(true);
      
    }
{code}

  was:
Because CooccurrencesMapper has huge computing,
Maybe we can replace  Mapper with  MultithreadedMapper.

Original:
{code}
 public static class CooccurrencesMapper
      extends Mapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
{code}

new:
{code}
 public static class CooccurrencesMapper
      extends MultithreadedMapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
{code}

And call the mapper
original:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      pairwiseSimilarity.waitForCompletion(true);
    }
{code}

new:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      CooccurrencesMapper.setNumberOfThreads(n); //n should about be less the core counts of the machine.
      pairwiseSimilarity.waitForCompletion(true);
      
    }
{code}


> Replace Mapper with  MultithreadedMapper  to implement org.apache.mahout.math.hadoop.similarity.RowSimilarityJob.CooccurrencesMapper
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>             Fix For: 0.4
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> Original:
> {code}
>  public static class CooccurrencesMapper
>       extends Mapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
> {code}
> new:
> {code}
>  public static class CooccurrencesMapper
>       extends MultithreadedMapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
> {code}
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       CooccurrencesMapper.setNumberOfThreads(n); //n should about be less than core counts of the machine.
>       pairwiseSimilarity.waitForCompletion(true);
>       
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Han Hui Wen  updated MAHOUT-475:
--------------------------------

    Attachment: after_patch_20100813.jpg

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>            Assignee: Sean Owen
>             Fix For: 0.4
>
>         Attachments: after_patch_20100813.jpg, patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Sean Owen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898340#action_12898340 ] 

Sean Owen commented on MAHOUT-475:
----------------------------------

Yes but you should get the same effect by simply running more Mappers. This really isn't something a Mapper itself should manage.

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>            Assignee: Sean Owen
>             Fix For: 0.4
>
>         Attachments: after_patch_20100813.jpg, patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Han Hui Wen  updated MAHOUT-475:
--------------------------------

    Attachment: patch_985097.txt

Patch :
1) using MultithreadedMapper
2) compress the  output
3) add --numMapThreads parameter
4) add -Dmapred.reduce.tasks

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>             Fix For: 0.4
>
>         Attachments: patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Han Hui Wen  updated MAHOUT-475:
--------------------------------

        Summary: Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity   (was: Replace Mapper with  MultithreadedMapper  to implement org.apache.mahout.math.hadoop.similarity.RowSimilarityJob.CooccurrencesMapper)
    Description: 
Because CooccurrencesMapper has huge computing,
Maybe we can replace  Mapper with  MultithreadedMapper.



And call the mapper
original:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      pairwiseSimilarity.waitForCompletion(true);
    }
{code}

new:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      
      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
      MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
      SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
      SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
      SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);

      pairwiseSimilarity.waitForCompletion(true);
    }
{code}

  was:
Because CooccurrencesMapper has huge computing,
Maybe we can replace  Mapper with  MultithreadedMapper.

Original:
{code}
 public static class CooccurrencesMapper
      extends Mapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
{code}

new:
{code}
 public static class CooccurrencesMapper
      extends MultithreadedMapper<VarIntWritable,WeightedOccurrenceArray,WeightedRowPair,Cooccurrence>
{code}

And call the mapper
original:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      pairwiseSimilarity.waitForCompletion(true);
    }
{code}

new:
{code}
    if (shouldRunNextPhase(parsedArgs, currentPhase)) {
      Job pairwiseSimilarity = prepareJob(weightsPath,
                               pairwiseSimilarityPath,
                               SequenceFileInputFormat.class,
                               CooccurrencesMapper.class,
                               WeightedRowPair.class,
                               Cooccurrence.class,
                               SimilarityReducer.class,
                               SimilarityMatrixEntryKey.class,
                               MatrixEntryWritable.class,
                               SequenceFileOutputFormat.class);

      Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
      pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
      pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
      CooccurrencesMapper.setNumberOfThreads(n); //n should about be less than core counts of the machine.
      pairwiseSimilarity.waitForCompletion(true);
      
    }
{code}


> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>             Fix For: 0.4
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Sean Owen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Owen updated MAHOUT-475:
-----------------------------

        Status: Resolved  (was: Patch Available)
      Assignee: Sean Owen
    Resolution: Not A Problem

People can 'correct' me here but conceptually Mappers and Reducers are single threaded. It's up to a Hadoop cluster to run multiple workers per machine to take advantage of more cores and parallelism.

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>            Assignee: Sean Owen
>             Fix For: 0.4
>
>         Attachments: patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MAHOUT-475) Replace Mapper with MultithreadedMapper to run job pairwiseSimilarity

Posted by "Han Hui Wen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898223#action_12898223 ] 

Han Hui Wen  commented on MAHOUT-475:
-------------------------------------

About MultithreadedMapper,here is the source:

http://svn.apache.org/repos/asf/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/lib/map/MultithreadedMapper.java

They used a thread pool to run multiple key-values pair concurrently and asynchronously.

It fits for that the mapper task has complicated computing , RowSimilarityJob-CooccurrencesMapper-SimilarityReducer is just the one.

> Replace Mapper with  MultithreadedMapper  to run job pairwiseSimilarity 
> ------------------------------------------------------------------------
>
>                 Key: MAHOUT-475
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-475
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Han Hui Wen 
>            Assignee: Sean Owen
>             Fix For: 0.4
>
>         Attachments: after_patch_20100813.jpg, patch_985097.txt
>
>
> Because CooccurrencesMapper has huge computing,
> Maybe we can replace  Mapper with  MultithreadedMapper.
> And call the mapper
> original:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}
> new:
> {code}
>     if (shouldRunNextPhase(parsedArgs, currentPhase)) {
>       Job pairwiseSimilarity = prepareJob(weightsPath,
>                                pairwiseSimilarityPath,
>                                SequenceFileInputFormat.class,
>                                CooccurrencesMapper.class,
>                                WeightedRowPair.class,
>                                Cooccurrence.class,
>                                SimilarityReducer.class,
>                                SimilarityMatrixEntryKey.class,
>                                MatrixEntryWritable.class,
>                                SequenceFileOutputFormat.class);
>       
>       Configuration pairwiseConf = pairwiseSimilarity.getConfiguration();
>       pairwiseConf.set(DISTRIBUTED_SIMILARITY_CLASSNAME, distributedSimilarityClassname);
>       pairwiseConf.setInt(NUMBER_OF_COLUMNS, numberOfColumns);
>       MultithreadedMapper.setMapperClass(pairwiseSimilarity, CooccurrencesMapper.class);
>       MultithreadedMapper.setNumberOfThreads(pairwiseSimilarity, numMapThreads);
>       SequenceFileOutputFormat.setCompressOutput(pairwiseSimilarity, true);
>       SequenceFileOutputFormat.setOutputCompressorClass(pairwiseSimilarity, GzipCodec.class);
>       SequenceFileOutputFormat.setOutputCompressionType(pairwiseSimilarity, CompressionType.BLOCK);
>       pairwiseSimilarity.waitForCompletion(true);
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.