[
https://issues.apache.org/jira/browse/MAHOUT-802?focusedWorklogId=1001723&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1001723
]
ASF GitHub Bot logged work on MAHOUT-802:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 25/Jan/26 08:16
Start Date: 25/Jan/26 08:16
Worklog Time Spent: 10m
Work Description: viiccwen commented on code in PR #918:
URL: https://github.com/apache/mahout/pull/918#discussion_r2725082321
##########
qdp/qdp-kernels/src/amplitude.cu:
##########
@@ -391,6 +455,46 @@ __global__ void l2_norm_batch_kernel(
}
}
+/// Kernel: accumulate L2 norms for a batch (float32).
+/// Grid is organized as (blocks_per_sample * num_samples) blocks.
+__global__ void l2_norm_batch_kernel_f32(
+ const float* __restrict__ input_batch,
+ size_t num_samples,
+ size_t sample_len,
+ size_t blocks_per_sample,
+ float* __restrict__ out_norms
+) {
+ const size_t sample_idx = blockIdx.x / blocks_per_sample;
+ if (sample_idx >= num_samples) return;
+
+ const size_t block_in_sample = blockIdx.x % blocks_per_sample;
+ const size_t base = sample_idx * sample_len;
+
+ const size_t vec_idx = block_in_sample * blockDim.x + threadIdx.x;
+ const size_t stride = blockDim.x * blocks_per_sample;
+
+ float local_sum = 0.0f;
+
+ size_t vec_offset = vec_idx;
+ size_t offset = vec_offset * 2;
+ while (offset + 1 < sample_len) {
+ const float2 v = __ldg(reinterpret_cast<const float2*>(input_batch +
base) + vec_offset);
+ local_sum += v.x * v.x + v.y * v.y;
Review Comment:
Thx for reviewing!
Sure, it may misaligned for float2.
We could handle element 0 (of this sample) once, then shift base by +1 so
the remaining pointer is 8B-aligned.
Issue Time Tracking
-------------------
Worklog Id: (was: 1001723)
Time Spent: 0.5h (was: 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: 0.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)