ArrayFire bindings for Linear Algebra by prasunanand · Pull Request #3 · arrayfire/arrayfire-rb (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation18 Commits125 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Implemented following classes:
- Af_Array
- Algorithm
- Arith
- BLAS
- LAPACK
- CUDA
- OpenCL
- Device
- Random
- Sparse
- Statistics
Added exception handling.
Only doubles implemented currently
| RDoc::Task.new do |rdoc| | | ----------------------------------------------------------------------- | | rdoc.main = "README.md" | | rdoc.rdoc_files.include(%w{README.md LICENSE CONTRIBUTING.md lib ext}) | | end |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this task run if you do a gem build
on the gemspec? Is it not possible to add this to the gemspec itself?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@v0dro I didn't get the question. Why would we need rdoc
to run when using gem build
.?
AFAIK, RubyDoc.info automatically generates the docs when I push the gem.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the above rake commands adds rdoc files which are then read by rubygems.org to generate YARD docs. If its not done during gem build and if you forget to run above rake task, the rdoc files will not get added to the gemspec and rubygems wont be able to detect them.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@v0dro, I will follow Victor's advice about using rubygems-tasks
library.
return Data_Wrap_Struct(CLASS_OF(left_val), NULL, arf_free, result); \ |
---|
} |
#define DEF_UNARY_RUBY_ACCESSOR(oper, name) \ |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of macros!
static VALUE arf_device_info(VALUE self, VALUE name_val, VALUE platform_val, VALUE toolkit_val, VALUE compute_val){ |
---|
char* d_name = (char*)malloc(sizeof(char) * 64); |
char* d_platform = (char*)malloc(sizeof(char) * 10); |
char* d_toolkit = (char*)malloc(sizeof(char) * 64); |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you be using xmalloc
and xfree
everywhere? They're the functions from ruby.h and allocate memory that the ruby VM is aware. malloc will allocate from system heap not ruby VM heap.
When do you plan to merge this?
af_get_dims(&dims[0], &dims[1], &dims[2], &dims[3], input->carray); |
size_t* shape = (size_t*)malloc(ndims * sizeof(size_t));; |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double colon at the end.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its outdated commit.
uint ndims; |
---|
af_get_numdims(&ndims, input->carray); |
dim_t* dims = (dim_t*)malloc(ndims * sizeof(dim_t)); |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its good practice in C to declare all the variables at the top of the function.
Is it possible to publish this using rubygems? Just gem install arrayfire-rb
would be amazing.
Also you should remove the statement saying that bindings aren't yet ready for production from README. And, add SciRuby to the acknowledgements at the bottom along with the website.
@v0dro
I am not aware of rubygems
, but in principle it should be possible. We have similar packaging in rust environment(rust package manager - cargo.io) known as crate
. From the usage style, it seems like rubygems is similar to crates in Rust or javascript package manager - npm.
I don't think it is a good idea to remove the cautionary statements until all the feasible functionality from ArrayFire is ported over to the ruby bindings. For one, I don't think @prasunanand has worked on image processing functions yet. Also, I believe indexing hasn't been worked on either.
Oh. Ok. @prasunanand can you create issues and set milestones for this purpose in the GitHub issue tracker? It will becomes easy for new contributors to quickly what's going on and how to contribute. Make things as granular as possible.
@9prady9 rubygems is the ruby packaging system and the central repository for most open source gems (yes, it is similar to npm and crates). Hosting the gem on rubygems will allow users to install with a single command instead of cloning and compiling.
Thanks @9prady9 for merging the PR.
@v0dro I am creating milestones and I will work on the missing features.
Alright. I think you add them to @9prady9 's list.