-
-
Save VibhuJawa/76a626fdcb4f9b14876d457dcd921415 to your computer and use it in GitHub Desktop.
This file contains 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
# UDF-2: | |
#if session change flag | |
#. set session id to x | |
#. set all other clicks to x until next session_change_flag | |
#else | |
#. do nothing | |
@cuda.jit | |
def populate_session_ids_kernel(session_boundary): | |
gid = cuda.grid(1) | |
# don't loop if we're off the edge | |
if gid < len(session_boundary): | |
# if this is a session boundary... | |
if session_boundary[gid] == 1: | |
# this thread marks the start of a session | |
session_boundary[gid] = gid | |
look_ahead = 1 | |
# check elements 'forward' of this one | |
# until a new session boundary is found | |
while session_boundary[gid + look_ahead] == 0: | |
session_boundary[gid + look_ahead] = gid | |
look_ahead += 1 | |
# don't segfault if I'm the last thread | |
if gid + look_ahead == len(session_boundary) - 1: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment