-
Notifications
You must be signed in to change notification settings - Fork 3
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
Parallelization of CliffordOperations
through numba
and cupy
#161
Conversation
CliffordOperations
through numbaCliffordOperations
through numba and cupy
CliffordOperations
through numba and cupyCliffordOperations
through numba
and cupy
Should we silence Codecov in Qibojit? |
I had a second thought, since tests are present in Qibojit (though in an unusual location wrt the other repos), and there is a related workflow. But I get that you wrote the related tests already in Qibo. Before silencing Codecov, or skip tests for this PR, it could be valuable to collect the opinions of the original Qibojit authors. @scarrazza @stavros11 @andrea-pasquale |
I know that in the past there were plans to test directly on gpu through a selfhosted workflow. I believe that it should be less complicated compare to qibolab tests. If we can do so, we should be able to recover coverage, right? |
def _clifford_pre_execution_reshape(state): | ||
return state.ravel() | ||
|
||
|
||
def _clifford_post_execution_reshape(state, nqubits): | ||
dim = _get_dim(nqubits) | ||
return state.reshape(dim, dim) | ||
|
||
|
||
def identity_density_matrix(nqubits, normalize: bool = True): | ||
n = 1 << nqubits | ||
state = cp.eye(n, dtype="complex128") | ||
cp.cuda.stream.get_current_stream().synchronize() | ||
if normalize: | ||
state /= 2**nqubits | ||
return state.reshape((n, n)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I'd say that using cp.ravel
and cp.reshape
is more robust just in case (I know, I know...)
Co-authored-by: Renato Mello <[email protected]>
for more information, see https://pre-commit.ci
@renatomello @alecandido @scarrazza is this ready to be merged? I would merge this one first and then the corresponding one in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the 0% coverage because it needs the PR in qibo
too?
It's because the changes here are tested in |
So then maybe they shouldn't count to coverage here (maybe |
To be completely honest: things implemented here should be tested here (as for every other project). Having features spread over many repos is an issue on its own. But we are starting facing that issue with qiboteam/qibo#1117 and https://github.com/qiboteam/qibo-core/, so I will not insist in this PR. |
I agree, but this would involve copy pasting the tests that are currently implemented in |
I believe the best would be to move all this code to Qibo, possibly to the |
This PR implements the
CliffordOperations
object introduced in qiboteam/qibo#1076 to be used specifically with theNumbaBackend
andCupyBackend
. Namely, each operation is rewritten as a loop over the row indices that is parallelized using,prange
and compiled with@njit(parallel=True, cache=True)
fornumba
, and@jit.rawkernel()
with cupy.Companion of qiboteam/qibo#1150