Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flow.rand #5722

Merged
merged 41 commits into from
Aug 14, 2021
Merged

add flow.rand #5722

merged 41 commits into from
Aug 14, 2021

Conversation

VertexC
Copy link
Contributor

@VertexC VertexC commented Aug 4, 2021

image

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 5, 2021 04:58
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 12, 2021 19:53
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 12, 2021 21:47
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 13, 2021 02:55
@chengtbf chengtbf removed the request for review from oneflow-ci-bot August 13, 2021 04:45
@chengtbf
Copy link
Contributor

mark。暂时移除 automerge,两个小时以后加回来。

@chengtbf
Copy link
Contributor

有冲突,需要解决一下~

@VertexC VertexC requested a review from oneflow-ci-bot August 14, 2021 12:00
@oneflow-ci-bot oneflow-ci-bot removed their request for review August 14, 2021 12:56
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 14, 2021 12:57
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 14, 2021 13:57
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

PyTorch resnet50 time: 140.4ms (= 7018.6ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 128.2ms (= 6412.3ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
Relative speed: 1.09 (= 140.4ms / 128.2ms)

PyTorch resnet50 time: 83.4ms (= 4167.7ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 74.5ms (= 3723.8ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
Relative speed: 1.12 (= 83.4ms / 74.5ms)

PyTorch resnet50 time: 57.4ms (= 2870.6ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 48.5ms (= 2423.1ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
Relative speed: 1.18 (= 57.4ms / 48.5ms)

PyTorch resnet50 time: 50.0ms (= 2500.8ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 39.4ms (= 1969.6ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
Relative speed: 1.27 (= 50.0ms / 39.4ms)

PyTorch resnet50 time: 37.9ms (= 1892.7ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 38.8ms (= 1941.1ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
Relative speed: 0.98 (= 37.9ms / 38.8ms)

@oneflow-ci-bot oneflow-ci-bot merged commit 1db5745 into master Aug 14, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the dev_flow_rand branch August 14, 2021 15:00
template<typename T>
__global__ void GenerateGpu(curandState* state, const int64_t elem_cnt, T* dptr, const T low,
const T high) {
const int id = blockIdx.x * blockDim.x + threadIdx.x;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个kernel的block_num和thread_num是根据设备上的硬件相关信息计算的,这里并不能保证block_num*thread_num一定 > elem_cnt,所以这个kernel可能会只初始化tensor的前一部分,后一部分保持不变吧,这里应该用 CUDA_1D_KERNEL_LOOP吧

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,是的,这里确实有问题。@博文 你参考 oneflow/user/kernels/partial_fc_sample_kernel.cu 文件修改一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants