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

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

                Author: ASF GitHub Bot
            Created on: 20/Jan/26 15:45
            Start Date: 20/Jan/26 15:45
    Worklog Time Spent: 10m 
      Work Description: viiccwen commented on code in PR #881:
URL: https://github.com/apache/mahout/pull/881#discussion_r2708937310


##########
qdp/qdp-core/src/gpu/encodings/amplitude.rs:
##########
@@ -411,8 +415,20 @@ impl AmplitudeEncoder {
 
 impl AmplitudeEncoder {
     /// Compute inverse L2 norm on GPU using the reduction kernel.
+    ///
+    /// # Arguments
+    /// * `device` - CUDA device reference
+    /// * `input_ptr` - Device pointer to input data (f64 array on GPU)
+    /// * `len` - Number of f64 elements
+    ///
+    /// # Returns
+    /// The inverse L2 norm (1/||x||_2) of the input data
+    ///
+    /// # Safety
+    /// The caller must ensure `input_ptr` points to valid GPU memory 
containing
+    /// at least `len` f64 elements on the same device as `device`.
     #[cfg(target_os = "linux")]
-    fn calculate_inv_norm_gpu(
+    pub unsafe fn calculate_inv_norm_gpu(

Review Comment:
   If we promote GPU norm computation later as a public feature (e.g. via a 
QuantumEncoder extension trait), maybe we can do a follow-up about design a 
dedicated safe wrapper and keep this function as an internal building block. 
WDYT?



##########
qdp/qdp-core/src/gpu/encodings/amplitude.rs:
##########
@@ -411,8 +415,20 @@ impl AmplitudeEncoder {
 
 impl AmplitudeEncoder {
     /// Compute inverse L2 norm on GPU using the reduction kernel.
+    ///
+    /// # Arguments
+    /// * `device` - CUDA device reference
+    /// * `input_ptr` - Device pointer to input data (f64 array on GPU)
+    /// * `len` - Number of f64 elements
+    ///
+    /// # Returns
+    /// The inverse L2 norm (1/||x||_2) of the input data
+    ///
+    /// # Safety
+    /// The caller must ensure `input_ptr` points to valid GPU memory 
containing
+    /// at least `len` f64 elements on the same device as `device`.
     #[cfg(target_os = "linux")]
-    fn calculate_inv_norm_gpu(
+    pub unsafe fn calculate_inv_norm_gpu(

Review Comment:
   Given this is an unsafe primitive that’s only used inside the core GPU 
pipeline, I’d lean towards making it `pub(crate)` for now and exposing only 
safe encoding APIs at the crate boundary.





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

    Worklog Id:     (was: 1001023)
    Time Spent: 3h 40m  (was: 3.5h)

> Provide better examples for the parallel ALS recommender code
> -------------------------------------------------------------
>
>                 Key: MAHOUT-878
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-878
>             Project: Mahout
>          Issue Type: Task
>    Affects Versions: 1.0.0
>            Reporter: Sebastian Schelter
>            Assignee: Sebastian Schelter
>            Priority: Major
>             Fix For: 0.6
>
>         Attachments: MAHOUT-878.patch
>
>          Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> We should provide examples that show how to apply the parallel ALS 
> recommender to the Netflix or KDD2011 datasets.



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

Reply via email to