rich7420 commented on code in PR #687:
URL: https://github.com/apache/mahout/pull/687#discussion_r2592972799


##########
qdp/qdp-core/examples/dataloader_throughput.rs:
##########
@@ -0,0 +1,140 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// DataLoader-style throughput test
+// Simulates a QML training loop that keeps the GPU fed with batches of 
vectors.
+// Run: cargo run -p qdp-core --example dataloader_throughput --release
+
+use std::env;
+use std::sync::mpsc;
+use std::thread;
+use std::time::{Duration, Instant};
+
+use qdp_core::QdpEngine;
+
+const BATCH_SIZE: usize = 64;
+const VECTOR_LEN: usize = 1024; // 2^10
+const NUM_QUBITS: usize = 10;
+
+fn build_sample(seed: u64) -> Vec<f64> {

Review Comment:
   We should verify that the CPU producer (build_sample) isn't slower than the 
GPU consumer. If the channel is frequently empty, we are benchmarking the CPU's 
random number generation rather than the QDP engine. Maybe we can simplify the 
math in build_sample or increase the prefetch_depth to ensure the GPU is always 
fed."



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to