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

Setting AMGX device id #29

Open
misukin opened this issue Mar 8, 2023 · 3 comments
Open

Setting AMGX device id #29

misukin opened this issue Mar 8, 2023 · 3 comments

Comments

@misukin
Copy link

misukin commented Mar 8, 2023

Hi, I really enjoy this project!

I would like to use my Julia code on multiple devices (no MPI) and need to set the device id. Is there any way to do that, besides AMGX_resources_create?
If not, is there any chance the functionality is going to be implemented?
Although, not familiar with wrappers, I might also help out whereever I can.

Thanks!

@KristofferC
Copy link
Collaborator

How would you do it from the C library?

@misukin
Copy link
Author

misukin commented Mar 8, 2023

const int deviceID
AMGX_config_handle cfg;
AMGX_resources_handle rsrc;
AMGX_resources_create(&rsrc,cfg,NULL, 1,&deviceID);

A workaround is to start Julia with:
CUDA_VISIBLE_DEVICES=deviceID, that is not my preferred solution.

Thanks!

@KristofferC
Copy link
Collaborator

Okay, only resources_create_simple is currently wrapped (https://github.com/JuliaGPU/AMGX.jl#not-implemented).

There could be another create! function as in

AMGX.jl/src/Resources.jl

Lines 19 to 26 in f812a39

function create!(resources::Resources, cfg::Config)
res_handle_ptr = Ref{API.AMGX_resources_handle}()
@checked API.AMGX_resources_create_simple(res_handle_ptr, cfg.handle)
resources.handle = res_handle_ptr[]
resources.cfg = cfg
inc_refcount!(resources.cfg)
return resources
end
that takes a device id as well.

Maybe just create!(resources::Resources, cfg::Config; device_id) and if device_id is given it calls AMGX_resources_create otherwise AMGX_resources_create_simple.

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

No branches or pull requests

2 participants