Open
Description
On my system this greatly sped up processing by over 2X. I am using large values for S. Hopefully I haven't optimized so far that it is actually wrong. Note: I also changed S to be an integer and it will scale somewhat differently(see comment below).
static inline void tm_initialize_random_streams(struct TsetlinMachine *tm, int s)
{
int next = 0;
int r = random() % (s+1);
for(int k=0; k<LA_CHUNKS; ++k){
(*tm).feedback_to_la[k] = 0;
while((next + r) / INT_SIZE <= k){
if(r == s){
next += (r - 1); //Skip setting any bits.
} else {
next += r;
(*tm).feedback_to_la[k] |= (1 << (next % INT_SIZE));
}
r = random() % (s+1);
}
}
}
Metadata
Metadata
Assignees
Labels
No labels