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

[feat] Make hdfs function compatible with tensorflow-io and TensorFlow version earlier than 2.6 by using FileSystem in TensorFlow Env. Also support S3 and so on now. #281

Merged
merged 2 commits into from
Oct 31, 2022

Conversation

MoFHeka
Copy link
Contributor

@MoFHeka MoFHeka commented Sep 28, 2022

Description

[feat] Make hdfs function compatible with tensorflow-io and TensorFlow version earlier than 2.6 by using FileSystem in TensorFlow Env.

After TF 2.6, TF file system was migrated from TF main repo to TF io repo. So when a TF add-on need to use file system, it's better to get file system pointer from TF env for compatibility.
Also support S3 and so on now.

Also add GPU/Redis backend implementation.

Also modify GPU/CPU hash table code(rehashifneeded/dump) to make them more decoupled.

An insert is typically performed after the rehash_if_needed call, but for unknown reasons with nvhashtable, the insert may have unknowable consequences that result in NaN values for the training parameters. Avoid unknown errors by calling cudaDeviceSynchronize() for purposes such as cache synchronization before insert kernels luanching.

Type of change

  • Bug fix
  • New Tutorial
  • Updated or additional documentation
  • Additional Testing
  • New Feature

Checklist:

  • I've properly formatted my code according to the guidelines
    • By running yapf
    • By running clang-format
  • This PR addresses an already submitted issue for TensorFlow Recommenders-Addons
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

How Has This Been Tested?

Compile and unit test it in different TF version.

@MoFHeka MoFHeka changed the title [feat] Make hdfs function compatible with tensorflow-io and TensorFlow version earlier than 2.6 by using FileSystem in TensorFlow Env. [feat] Make hdfs function compatible with tensorflow-io and TensorFlow version earlier than 2.6 by using FileSystem in TensorFlow Env. Also support S3 and so on now. Sep 30, 2022
virtual void get(const K* d_keys, ValueType<V>* d_vals, bool* d_status,
size_t len, ValueType<V>* d_def_val, cudaStream_t stream,
bool is_full_size_default) const {}
virtual size_t get_size(cudaStream_t stream) const { return 0; }
virtual size_t get_capacity() const { return 0; }
virtual void remove(const K* d_keys, size_t len, cudaStream_t stream) {}
virtual void clear(cudaStream_t stream) {}
virtual void remove(const K* d_keys, size_t len, cudaStream_t stream) const {}
Copy link
Member

Choose a reason for hiding this comment

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

Why do you change here? remove & clear should not be const.

rhdong
rhdong previously approved these changes Oct 26, 2022
Copy link
Member

@rhdong rhdong left a comment

Choose a reason for hiding this comment

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

LGTM

…w version earlier than 2.6 by using FileSystem in TensorFlow Env.

Change hdfs file system to all file system.
Now also support S3, local and so on.

Also change Redis backend function to make it more low coupling with TF.

Also modify GPU/CPU hash table code(rehashifneeded/dump/cpu insert) to make them more decoupled and stable.
but for unknown reasons with nvhashtable, the insert may have unknowable consequences that result in NaN values for the training parameters.
Avoid unknown errors by calling cudaDeviceSynchronize() for purposes such as cache synchronization before insert kernels luanching.
Copy link
Member

@rhdong rhdong left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@luliyucoordinate luliyucoordinate left a comment

Choose a reason for hiding this comment

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

LGTM

@rhdong rhdong merged commit f640888 into tensorflow:master Oct 31, 2022
@rhdong
Copy link
Member

rhdong commented Oct 31, 2022

Excellent job! Thanks, @MoFHeka !

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

Successfully merging this pull request may close these issues.

None yet

3 participants