zhreshold commented on a change in pull request #17841: URL: https://github.com/apache/incubator-mxnet/pull/17841#discussion_r420413103
########## File path: src/io/dataloader.cc ########## @@ -0,0 +1,188 @@ +/* + * 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. + */ + +/*! + * Copyright (c) 2020 by Contributors + * \file dataloader.cc + * \brief Pure c++ backed dataloader implementation + */ +#include <dmlc/parameter.h> +#include <dmlc/omp.h> +#include <mxnet/io.h> + +#include "./inst_vector.h" +#include "./iter_prefetcher.h" +#include "../profiler/custom_op_profiler.h" + +namespace mxnet { +namespace io { +struct ThreadedDataLoaderParam : public dmlc::Parameter<ThreadedDataLoaderParam> { + /*! \brief Multithread worker number. */ + int num_workers; + /*! \brief dataset pointer.*/ + std::intptr_t dataset; + /*! \brief sampler pointer.*/ + std::intptr_t sampler; + /*! \brief batchify function pointer.*/ + std::intptr_t batchify_fn; + /*! \brief pin memory to device id.*/ + int pin_device_id; + // declare parameters + DMLC_DECLARE_PARAMETER(ThreadedDataLoaderParam) { + DMLC_DECLARE_FIELD(num_workers).set_default(0) + .describe("Number of thread workers."); + DMLC_DECLARE_FIELD(dataset) + .describe("Number of thread workers."); Review comment: Thanks for catching ########## File path: src/io/iter_sampler.cc ########## @@ -126,7 +126,9 @@ class RandomSampler : public IIterator<DataInst> { param_.InitAllowUnknown(kwargs); indices_.resize(param_.length); std::iota(std::begin(indices_), std::end(indices_), 0); // fill like arange - rng_.reset(new common::RANDOM_ENGINE(kRandMagic + param_.seed)); + mshadow::Random<cpu> *ctx_rng = ResourceManager::Get()->Request( + Context::CPU(), ResourceRequest::kRandom).get_random<cpu, real_t>(nullptr); + rng_.reset(new common::RANDOM_ENGINE(ctx_rng->GetSeed() + param_.seed)); Review comment: Removed ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
