question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use JIT compiler to back `cupy.fromfunction()`

See original GitHub issue

Description

#5925 added a bunch of NumPy-compliant functions, including cupy.fromfunction(). However, it is suboptimal as numpy.fromfunction is called internally.

It’d be nice to take the same JIT capability behind cupy.vectorize() and make it work with fromfunction. However, a common usage of fromfunction seems to involve lambda functions, which CuPy does not support yet (#4290). Not sure if this is a blocker, though.

Additional Information

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
asi1024commented, Nov 26, 2021

I am planning the support of lambda function input in cupy.vectorize as the first step 😃

1reaction
kmaehashicommented, Nov 25, 2021

However, we cannot (maybe will not also in the future) support lambda functions as the inspect.getsource cannot get lambda function as the target function.

How about walking through the AST generated from inspect.getsource and using the first lambda found? (I think it’s acceptable to raise an error when two lambdas are found in the AST).

Read more comments on GitHub >

github_iconTop Results From Across the Web

latest PDF - CuPy Documentation
Just-in-time Transpiler (JIT): Generate CUDA kernel from Python source code ... If we do copy the array in this situation, you can use...
Read more >
Compiling Python code with @jit - Numba
The recommended way to use the @jit decorator is to let Numba decide when and how to ... For example, calling the f()...
Read more >
Numba: a LLVM-based Python JIT compiler
In addi- tion, we share our experience in building a JIT compiler using LLVM[1]. Categories and Subject Descriptors. D.3.4 [Programming ...
Read more >
Staged Static Techniques to Efficiently Implement Array Copy ...
Since we are in the context of a JIT compiler, we developed a staged ... 2We use AspectMatlab to for some dynamic measurements...
Read more >
CUDA C++ Programming Guide - NVIDIA Documentation Center
Environment variables are available to control just-in-time compilation as ... by calling MyKernel() , and copies the result outputDevPtr back to the same ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found