@@ -84,20 +84,49 @@ public void testSplitByCounts() {
8484 assertArrayEquals (counts , actualCounts );
8585 }
8686
87- @ Test
88- public void testSplitByAffinity () {
89- if (!device .getPartitionProperties ().contains (CLDevice .PartitionType .ByAffinityDomain )) return ;
90-
91- for (CLDevice .AffinityDomain domain : device .getPartitionAffinityDomains ()) {
92- CLDevice [] subDevices = device .createSubDevicesByAffinity (domain );
93- assertTrue (subDevices .length > 1 );
94- for (CLDevice subDevice : subDevices ) {
95- checkParent (device , subDevice );
96- assertEquals (domain , subDevice .getPartitionAffinityDomain ());
97- }
87+ public void checkSplitByAffinity (CLDevice .AffinityDomain domain ) {
88+ if (!device .getPartitionProperties ().contains (CLDevice .PartitionType .ByAffinityDomain )) {
89+ System .out .println ("Split by affinity is not supported by device " + device );
90+ return ;
91+ }
92+ if (!device .getPartitionAffinityDomains ().contains (domain )) {
93+ System .out .println ("Affinity domain " + domain + " not supported by device " + device );
94+ return ;
95+ }
96+
97+ CLDevice [] subDevices = device .createSubDevicesByAffinity (domain );
98+ assertTrue (subDevices .length > 1 );
99+ for (CLDevice subDevice : subDevices ) {
100+ checkParent (device , subDevice );
101+ assertEquals (domain , subDevice .getPartitionAffinityDomain ());
98102 }
99103 }
100104
105+ @ Test
106+ public void testSplitByAffinity_NUMA () {
107+ checkSplitByAffinity (CLDevice .AffinityDomain .NUMA );
108+ }
109+ @ Test
110+ public void testSplitByAffinity_L4Cache () {
111+ checkSplitByAffinity (CLDevice .AffinityDomain .L4Cache );
112+ }
113+ @ Test
114+ public void testSplitByAffinity_L3Cache () {
115+ checkSplitByAffinity (CLDevice .AffinityDomain .L3Cache );
116+ }
117+ @ Test
118+ public void testSplitByAffinity_L2Cache () {
119+ checkSplitByAffinity (CLDevice .AffinityDomain .L2Cache );
120+ }
121+ @ Test
122+ public void testSplitByAffinity_L1Cache () {
123+ checkSplitByAffinity (CLDevice .AffinityDomain .L1Cache );
124+ }
125+ @ Test
126+ public void testSplitByAffinity_NextPartitionable () {
127+ checkSplitByAffinity (CLDevice .AffinityDomain .NextPartitionable );
128+ }
129+
101130 private void checkParent (CLDevice parent , CLDevice child ) {
102131 assertSame (parent , child .getParent ());
103132 // Force a get info CL_DEVICE_PARENT_DEVICE.
0 commit comments