[ 
https://issues.apache.org/jira/browse/MAHOUT-802?focusedWorklogId=1002308&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1002308
 ]

ASF GitHub Bot logged work on MAHOUT-802:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Jan/26 17:36
            Start Date: 28/Jan/26 17:36
    Worklog Time Spent: 10m 
      Work Description: viiccwen commented on code in PR #918:
URL: https://github.com/apache/mahout/pull/918#discussion_r2737758593


##########
qdp/qdp-kernels/src/amplitude.cu:
##########
@@ -512,6 +677,66 @@ int launch_l2_norm_batch(
     return (int)cudaGetLastError();
 }
 
+/// Launch L2 norm reduction for a batch of vectors (float32).
+/// Writes inverse norms for each sample into `inv_norms_out_d`.
+int launch_l2_norm_batch_f32(
+    const float* input_batch_d,
+    size_t num_samples,
+    size_t sample_len,
+    float* inv_norms_out_d,
+    cudaStream_t stream
+) {
+    if (num_samples == 0 || sample_len == 0) {
+        return cudaErrorInvalidValue;
+    }
+
+    cudaError_t memset_status = cudaMemsetAsync(
+        inv_norms_out_d,
+        0,
+        num_samples * sizeof(float),
+        stream
+    );
+    if (memset_status != cudaSuccess) {
+        return memset_status;
+    }
+
+    const int blockSize = DEFAULT_BLOCK_SIZE;
+    const size_t elements_per_block = blockSize * 2; // float2 per thread
+    size_t blocks_per_sample = (sample_len + elements_per_block - 1) / 
elements_per_block;
+    const size_t max_blocks_per_sample = MAX_BLOCKS_PER_SAMPLE;
+    if (blocks_per_sample == 0) blocks_per_sample = 1;
+    if (blocks_per_sample > max_blocks_per_sample) {
+        blocks_per_sample = max_blocks_per_sample;
+    }
+
+    size_t gridSize = num_samples * blocks_per_sample;
+    const size_t max_grid = CUDA_MAX_GRID_DIM_1D; // CUDA grid dimension limit 
for 1D launch
+    if (gridSize > max_grid) {
+        blocks_per_sample = max_grid / num_samples;
+        if (blocks_per_sample == 0) {
+            blocks_per_sample = 1;
+        }
+        gridSize = num_samples * blocks_per_sample;

Review Comment:
   I think first suggestion is better.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1002308)
    Time Spent: 1.5h  (was: 1h 20m)

> Start Phase doesn't properly work in RecommenderJob
> ---------------------------------------------------
>
>                 Key: MAHOUT-802
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-802
>             Project: Mahout
>          Issue Type: Bug
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: MAHOUT-802.patch, MAHOUT-802b.patch
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> I'm trying to run RecommenderJob and do --startPhase 2 since I have my prefs 
> already in the right format.  Unfortunately, when I do that, I get:
> {quote}
> java.lang.IllegalArgumentException: Number of columns was not correctly set!
>       at 
> com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
>       at 
> org.apache.mahout.math.hadoop.similarity.RowSimilarityJob$SimilarityReducer.setup(RowSimilarityJob.java:296)
>       at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:174)
>       at 
> org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:648)
>       at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:416)
>       at 
> org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:256)
> {quote}
> This appears to be due to the fact that the numberOfUsers variable defaults 
> to 0 and is only set when phase 1 is run.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to