use of cx2x.xcodeml.exception.IllegalDirectiveException in project claw-compiler by C2SM-RCM.
the class ClawLanguageTest method analyzeUnvalidClawLanguage.
/**
* Assert any unvalid claw raw input
*
* @param raw Raw string value of the CLAW directive to be analyzed.
*/
private void analyzeUnvalidClawLanguage(String raw) {
try {
Xnode p = XmlHelper.createXpragma();
p.setValue(raw);
Configuration configuration = new Configuration(AcceleratorDirective.OPENACC, Target.GPU);
AcceleratorGenerator generator = AcceleratorHelper.createAcceleratorGenerator(configuration);
ClawLanguage.analyze(p, generator, Target.GPU);
fail();
} catch (IllegalDirectiveException pex) {
assertNotNull(pex);
assertNotNull(pex.getMessage());
}
}
use of cx2x.xcodeml.exception.IllegalDirectiveException in project claw-compiler by C2SM-RCM.
the class ClawLanguageTest method analyzeValidArrayToFctCall.
/**
* Assert the result for valid CLAW call directive
*
* @param raw Raw string value of the CLAW directive to be analyzed.
* @param arrayName Array name to be checked.
* @param fctName Function name to be checked.
* @param params List of parameters identifier to be checked.
*/
private void analyzeValidArrayToFctCall(String raw, String arrayName, String fctName, List<String> params, List<Target> targets) {
try {
Xnode p = XmlHelper.createXpragma();
p.setValue(raw);
Configuration configuration = new Configuration(AcceleratorDirective.OPENACC, Target.GPU);
AcceleratorGenerator generator = AcceleratorHelper.createAcceleratorGenerator(configuration);
ClawLanguage l = ClawLanguage.analyze(p, generator, Target.GPU);
assertEquals(ClawDirective.ARRAY_TO_CALL, l.getDirective());
assertEquals(params.size(), l.getFctParams().size());
for (int i = 0; i < params.size(); ++i) {
assertEquals(params.get(i), l.getFctParams().get(i));
}
assertEquals(arrayName, l.getArrayName());
assertEquals(fctName, l.getFctName());
assertTargets(l, targets);
} catch (IllegalDirectiveException idex) {
System.err.print(idex.getMessage());
fail();
}
}
use of cx2x.xcodeml.exception.IllegalDirectiveException in project claw-compiler by C2SM-RCM.
the class ClawLanguageTest method analyzeValidClawLoopInterchange.
/**
* Assert the result for valid loop interchange CLAW directive
*
* @param raw Raw string value of the CLAW directive to be analyzed.
* @param indexes List of indexes to be found if any.
*/
private void analyzeValidClawLoopInterchange(String raw, List<String> indexes, boolean parallel, String acc, List<Target> targets) {
try {
Xnode p = XmlHelper.createXpragma();
p.setValue(raw);
Configuration configuration = new Configuration(AcceleratorDirective.OPENACC, Target.GPU);
AcceleratorGenerator generator = AcceleratorHelper.createAcceleratorGenerator(configuration);
ClawLanguage l = ClawLanguage.analyze(p, generator, Target.GPU);
assertEquals(ClawDirective.LOOP_INTERCHANGE, l.getDirective());
if (indexes != null) {
assertTrue(l.hasIndexes());
assertEquals(indexes.size(), l.getIndexes().size());
} else {
assertFalse(l.hasIndexes());
assertNull(l.getIndexes());
}
if (parallel) {
assertTrue(l.hasParallelClause());
} else {
assertFalse(l.hasParallelClause());
}
if (acc != null) {
assertTrue(l.hasAcceleratorClause());
assertEquals(acc, l.getAcceleratorClauses());
} else {
assertFalse(l.hasAcceleratorClause());
assertNull(l.getAcceleratorClauses());
}
assertTargets(l, targets);
} catch (IllegalDirectiveException idex) {
fail();
}
}
Aggregations