Skip to content

Added get_revision and device_info #107

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

Merged
merged 1 commit into from
Feb 19, 2017
Merged

Added get_revision and device_info #107

merged 1 commit into from
Feb 19, 2017

Conversation

botev
Copy link
Contributor

@botev botev commented Feb 17, 2017

Sorry, this should have been part of the previous, but was a bit busy.
One caveat is that I assumed that the commit string is truly static, so I return Cow<'static, str>. Also, I notice that the name of the platform has underscores Intel(R)_Core(TM)_i7-4600U_CPU_@ 2.10GHz so the question is should those be replaced by spaces or kept like that.

@9prady9
Copy link
Member

9prady9 commented Feb 19, 2017

@botev Commit string is a compile time string and the user should not free it. What does Cow<> do when a variable of such type goes out of scope ?

@pavanky Why does the platform name returned by af_device_info has underscores?

@pavanky
Copy link
Member

pavanky commented Feb 19, 2017

@9prady9

@pavanky Why does the platform name returned by af_device_info has underscores?

I don't know what you mean. Can you show me an example ?

@9prady9
Copy link
Member

9prady9 commented Feb 19, 2017

@pavanky

Name: GeForce_GT_650M

Thats the output of af_devie_info for platform name, white spaces are replaced by underscores.

Edit:
You can also find it in the PR description for Intel CPU.

We are doing that at this line in the upstream.

@pavanky
Copy link
Member

pavanky commented Feb 19, 2017

@9prady9 That is not platform name, that is device name. I don't remember why I changed spaces to underscores. If we are going to change this, it should probably change upstream.

@9prady9
Copy link
Member

9prady9 commented Feb 19, 2017

Okay. @botev No need to change underscores to white spaces.

@botev
Copy link
Contributor Author

botev commented Feb 19, 2017

@9prady9 Cow is a clone-on-write smart pointer. Additionally, it relies on a reference. This means:

  1. It does not free anything underlying (as in rust references require that the owner outlives them, but they do not free resources).
  2. If someone decides to modify it in any way it clones the underlying object. E.g. if someone decides to use the returned value in building a new string it will clone it so that it does not modify the initial underlying string.

I think that is good consistent behavior and has 0 overhead at runtime (I think the modification checks are at compile time).

@9prady9 9prady9 merged commit 3f58888 into arrayfire:devel Feb 19, 2017
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.

3 participants