Skip to content
New issue

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

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

Already on GitHub? # to your account

[Feature Request] add dependency specification #197

Closed
GiggleLiu opened this issue Apr 29, 2022 · 3 comments · Fixed by #205
Closed

[Feature Request] add dependency specification #197

GiggleLiu opened this issue Apr 29, 2022 · 3 comments · Fixed by #205
Labels
enhancement New feature or request

Comments

@GiggleLiu
Copy link
Contributor

If I want to write a script with both GPU and CPU code, then I can avoid using CUDA by using the following grammar.

@cast :(using CUDA) function f(x)
      # some GPU computation
end

@cast function g(x)
      # some CPU computation
end

@main

The @main macro calls the required using statement by inspecting ARG[1].

@Roger-luo
Copy link
Collaborator

Roger-luo commented May 11, 2022

I think this would be the solution to your feature without adding a new syntax to the package https://github.com/johnnychen94/LazyModules.jl

cc: @johnnychen94

@johnnychen94
Copy link
Contributor

johnnychen94 commented May 12, 2022

For CUDA.jl it will almost certainly hit the world-age issue because CuArray is an alien type to the caller world-age. See the discussion in [ANN] Accouncing LazyModules.jl: delay the heavy dependency loading to its first use

@Roger-luo
Copy link
Collaborator

OK, that's quite unfortunate... but in general, I feel this is not something Comonicon should support but should be supported by Julia itself unless we can find a way that does not change the syntax.

@Roger-luo Roger-luo added the enhancement New feature or request label May 12, 2022
@Roger-luo Roger-luo linked a pull request Jun 18, 2022 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants