Skip to content

Commit db14c23

Browse files
Bug in backdResults being reset before being retrieved.
Disable use of VecBitSet (since not needed on NUC) Other minor optimisations.
1 parent 1b01bc2 commit db14c23

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

models/starComplexity.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,6 @@ void StarComplexityGen::fillStarMap(unsigned numStars)
352352
(compute,[block=&*block](){
353353
block->result.swap(block->backedResult);
354354
});
355-
backedResultsReset=syclQ().parallel_for
356-
(blockSize,resultSwapped,[block=&*block](auto i){block->backedResult[i].reset();});
357355

358356
// accumulate starMap results on separate host thread
359357
starMapPopulated=syclQ().submit([&](auto& handler) {
@@ -376,6 +374,9 @@ void StarComplexityGen::fillStarMap(unsigned numStars)
376374
});
377375
});
378376

377+
backedResultsReset=syclQ().parallel_for
378+
(blockSize,starMapPopulated,[block=&*block](auto i){block->backedResult[i].reset();});
379+
379380
Event::wait({resultSwapped,backedResultsReset});
380381
resultBufferConsumed=0;
381382
};

models/starComplexity.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,7 @@ class linkRepImpl
7171
if (data[i]) return false;
7272
return true;
7373
}
74-
bool operator==(const linkRepImpl& x) const {
75-
for (unsigned i=0; i<size; ++i)
76-
if (data[i]!=x.data[i]) return false;
77-
return true;
78-
}
74+
bool operator==(const linkRepImpl& x) const {return operator<=>(x)==0;}
7975
auto operator<=>(const linkRepImpl& x) const {
8076
for (unsigned i=0; i<size; ++i)
8177
if (auto r=data[i]<=>x.data[i]; r!=0)
@@ -88,16 +84,16 @@ class linkRepImpl
8884
return std::vector<unsigned>(start,end);
8985
}
9086
void dataFromVector(const std::vector<unsigned>& x) {
91-
memcpy(data,x.data(),std::min(size_t(size),x.size())*sizeof(Impl));
87+
memcpy(data,x.data(),std::min(size_t(size)*sizeof(Impl),x.size()*sizeof(x[0])));
9288
}
9389
};
9490

95-
#ifdef SYCL_LANGUAGE_VERSION
96-
using linkRep=linkRepImpl<VecBitSet<unsigned,4>>;
97-
#else
91+
//#ifdef SYCL_LANGUAGE_VERSION
92+
//using linkRep=linkRepImpl<VecBitSet<unsigned,4>>;
93+
//#else
9894
// on NUC, unsigned works best (32 bits)
9995
using linkRep=linkRepImpl<unsigned>;
100-
#endif
96+
//#endif
10197

10298
// Convert to/from a JSON array for Python conversion
10399
#define CLASSDESC_json_pack___linkRep

models/starComplexity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from starComplexity import starC
55
from datetime import datetime
6-
nodes=10
6+
nodes=22
77
# computed from max_{l\in[0,L]}min(n+L-l,2l) where L=n(n-1)/2
88
maxStars=0
99
L=int(0.5*nodes*(nodes-1))

0 commit comments

Comments
 (0)