Search in sources :

Example 1 with OpenAcc

use of claw.tatsu.directive.generator.OpenAcc in project claw-compiler by C2SM-RCM.

the class ConfigurationTest method readConfig.

void readConfig(Path cfgDirPath) {
    try {
        Configuration conf = new TestConfiguration();
        assertNotNull(conf);
        Context context = new TestContext();
        assertNotNull(context);
        conf = Configuration.load(cfgDirPath, null, null, null, null, Integer.valueOf(MAX_COLUMN), context, Collections.emptyList());
        assertNotNull(context.getGenerator());
        assertNotNull(conf.accelerator());
        assertEquals(MAX_COLUMN, context.getMaxColumns());
        assertFalse(conf.isForcePure());
        conf.setForcePure();
        assertTrue(conf.isForcePure());
        int[] majorMinor = conf.getMajorMinor("0.3");
        assertEquals(0, majorMinor[0]);
        assertEquals(3, majorMinor[1]);
        try {
            conf.checkVersion("0.2");
            fail();
        } catch (Exception ignored) {
        }
        try {
            conf.getMajorMinor("sdjhsajkd");
            fail();
        } catch (Exception ignored) {
        }
        try {
            conf.checkVersion(ClawVersion.VERSION);
        } catch (Exception ignored) {
            fail();
        }
        assertTrue(conf.accelerator() instanceof OpenAccConfiguration);
        assertTrue(context.getGenerator() instanceof OpenAcc);
        assertSame(Target.GPU, conf.getCurrentTarget());
        assertSame(CompilerDirective.OPENACC, conf.getCurrentDirective());
        assertEquals(Configuration.CPU_STRATEGY_FUSION, conf.getParameter(Configuration.CPU_STRATEGY));
        conf.overrideConfigurationParameter(Configuration.CPU_STRATEGY, Configuration.CPU_STRATEGY_SINGLE);
        assertEquals(Configuration.CPU_STRATEGY_SINGLE, conf.getParameter(Configuration.CPU_STRATEGY));
        assertNull(conf.getParameter(DUMMY_KEY));
        conf.overrideConfigurationParameter(DUMMY_KEY, DUMMY_VALUE);
        assertEquals(DUMMY_VALUE, conf.getParameter(DUMMY_KEY));
    } catch (Exception e) {
        fail();
    }
}
Also used : Context(claw.tatsu.common.Context) TestContext(helper.Utils.TestContext) OpenAccConfiguration(claw.tatsu.directive.configuration.OpenAccConfiguration) TestConfiguration(helper.Utils.TestConfiguration) TestContext(helper.Utils.TestContext) TestConfiguration(helper.Utils.TestConfiguration) OpenAcc(claw.tatsu.directive.generator.OpenAcc) OpenAccConfiguration(claw.tatsu.directive.configuration.OpenAccConfiguration)

Example 2 with OpenAcc

use of claw.tatsu.directive.generator.OpenAcc in project claw-compiler by C2SM-RCM.

the class Context method init.

public void init(CompilerDirective compilerDirective, Target target, AcceleratorConfiguration acceleratorConfiguration, int maxColumns) {
    if (compilerDirective != null) {
        _compilerDirective = compilerDirective;
        if (compilerDirective == CompilerDirective.OPENACC) {
            OpenAcc gen = new OpenAcc(this);
            _directiveGenerator = gen;
            if (acceleratorConfiguration != null) {
                gen.setExecutionMode(((OpenAccConfiguration) acceleratorConfiguration).getMode());
            }
        } else if (compilerDirective == CompilerDirective.OPENMP) {
            OpenMp gen = new OpenMp(this);
            _directiveGenerator = gen;
            if (acceleratorConfiguration != null) {
                gen.setExecutionMode(((OpenMpConfiguration) acceleratorConfiguration).getMode());
            }
        } else {
            _directiveGenerator = new DirectiveNone();
        }
    } else {
        _compilerDirective = CompilerDirective.NONE;
        _directiveGenerator = new DirectiveNone();
    }
    _acceleratorConfiguration = acceleratorConfiguration;
    if (target == null) {
        _target = Target.NONE;
    } else {
        _target = target;
    }
    _maxColumns = maxColumns;
    _moduleCache = new ModuleCache();
}
Also used : OpenMp(claw.tatsu.directive.generator.OpenMp) ModuleCache(claw.tatsu.xcodeml.module.ModuleCache) OpenAcc(claw.tatsu.directive.generator.OpenAcc) OpenMpConfiguration(claw.tatsu.directive.configuration.OpenMpConfiguration) DirectiveNone(claw.tatsu.directive.generator.DirectiveNone)

Aggregations

OpenAcc (claw.tatsu.directive.generator.OpenAcc)2 Context (claw.tatsu.common.Context)1 OpenAccConfiguration (claw.tatsu.directive.configuration.OpenAccConfiguration)1 OpenMpConfiguration (claw.tatsu.directive.configuration.OpenMpConfiguration)1 DirectiveNone (claw.tatsu.directive.generator.DirectiveNone)1 OpenMp (claw.tatsu.directive.generator.OpenMp)1 ModuleCache (claw.tatsu.xcodeml.module.ModuleCache)1 TestConfiguration (helper.Utils.TestConfiguration)1 TestContext (helper.Utils.TestContext)1