1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Threading for KNC mods.

This commit is contained in:
paboyle 2015-11-04 03:22:14 -08:00
parent 5aafdd7e1a
commit 757b31ed42

View File

@ -45,12 +45,15 @@ class GridThread {
static int SumArraySize(void) {return _threads;}; static int SumArraySize(void) {return _threads;};
static void GetWork(int nwork, int me, int & mywork, int & myoff){ static void GetWork(int nwork, int me, int & mywork, int & myoff){
int basework = nwork/_threads; GetWork(nwork,me,mywork,myoff,_threads);
int backfill = _threads-(nwork%_threads); }
if ( me >= _threads ) { static void GetWork(int nwork, int me, int & mywork, int & myoff,int units){
int basework = nwork/units;
int backfill = units-(nwork%units);
if ( me >= units ) {
mywork = myoff = 0; mywork = myoff = 0;
} else { } else {
mywork = (nwork+me)/_threads; mywork = (nwork+me)/units;
myoff = basework * me; myoff = basework * me;
if ( me > backfill ) if ( me > backfill )
myoff+= (me-backfill); myoff+= (me-backfill);