-
-
Save VibhuJawa/a7797908f53a0ee2d49790b6bd0e0c96 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-1 | |
# make a array for session change flag | |
# for all rows x | |
# set the flag if user_sk[x]!=user_sk[x-1] or tstamp_inSec[x] - tstamp_inSec[x-1] > 60 minutes | |
@cuda.jit | |
def make_session_change_flag_kernel( | |
user_sk, tstamp_inSec, session_change_flag, time_out | |
): | |
gid = cuda.grid(1) | |
if 0 < gid < len(wcs_user_sk): | |
if ( | |
user_sk[gid] != user_sk[gid - 1] | |
or tstamp_inSec[gid] - tstamp_inSec[gid - 1] > time_out | |
): | |
session_change_flag[gid] = np.int32(1) | |
else: | |
session_change_flag[gid] = np.int32(0) | |
else: | |
session_change_flag[gid] = np.int32(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment