Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Bug fix on project wizard.
Browse files Browse the repository at this point in the history
  • Loading branch information
lelandaisb committed Apr 13, 2020
1 parent c5c8c45 commit e92c1fe
Showing 1 changed file with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import java.io.ByteArrayInputStream
import java.lang.reflect.InvocationTargetException
import java.util.ArrayList
import java.util.Collection
import java.util.HashMap
import java.util.LinkedHashMap
import org.eclipse.core.resources.IFile
import org.eclipse.core.resources.IFolder
import org.eclipse.core.resources.IProject
Expand Down Expand Up @@ -147,19 +149,30 @@ class NewNablaProjectWizard extends Wizard implements INewWizard
val srcGenJavaFolder = project.getFolder("src-gen-java")
srcGenJavaFolder.create(false, true, monitor)

// Create src-gen-kokkos folder
val srcGenKokkosFolder = project.getFolder("src-gen-kokkos")
// Create src-gen-cpp folder
val srcGenCppFolder = project.getFolder("src-gen-cpp")
srcGenCppFolder.create(false, true, monitor)

// Create all src-gen-cpp subfolders
val cppFoldersByProgrammingModel = new LinkedHashMap<String, IFolder>

val srcGenStlThreadFolder = srcGenCppFolder.getFolder("stl-thread")
srcGenStlThreadFolder.create(false, true, monitor)
cppFoldersByProgrammingModel.put("StlThread", srcGenStlThreadFolder)

val srcGenKokkosFolder = srcGenCppFolder.getFolder("kokkos")
srcGenKokkosFolder.create(false, true, monitor)
cppFoldersByProgrammingModel.put("Kokkos", srcGenKokkosFolder)

// Create src-gen-kokkos-team folder
val srcGenKokkosTeamFolder = project.getFolder("src-gen-kokkos-team")
val srcGenKokkosTeamFolder = srcGenCppFolder.getFolder("kokkos-team")
srcGenKokkosTeamFolder.create(false, true, monitor)
cppFoldersByProgrammingModel.put("KokkosTeamThread", srcGenKokkosTeamFolder)

// Create nabla and nablagen models
val nablaFile = modulesFolder.getFile(newProjectPage.moduleName + ".nabla")
createFile(nablaFile, getNablaModelContent(newProjectPage.moduleName), monitor)
val nablagenFile = modulesFolder.getFile(newProjectPage.moduleName + ".nablagen")
createFile(nablagenFile, getNablagenModelContent(newProjectPage.moduleName, srcGenJavaFolder, srcGenKokkosFolder, srcGenKokkosTeamFolder), monitor)
createFile(nablagenFile, getNablagenModelContent(newProjectPage.moduleName, srcGenJavaFolder, cppFoldersByProgrammingModel), monitor)

// Create META-INF folder and MANIFEST
val metaInf = project.getFolder("META-INF")
Expand Down Expand Up @@ -272,13 +285,13 @@ class NewNablaProjectWizard extends Wizard implements INewWizard

set nodes: → { node };

const X_EDGE_LENGTH = 0.1;
const Y_EDGE_LENGTH = X_EDGE_LENGTH;
const X_EDGE_ELEMS = 20;
const Y_EDGE_ELEMS = 20;
const X_EDGE_LENGTH = 0.1;
const Y_EDGE_LENGTH = X_EDGE_LENGTH;
const X_EDGE_ELEMS = 20;
const Y_EDGE_ELEMS = 20;

const max_iter = 200;
const max_time = 1.0;
const max_iter = 200;
const max_time = 1.0;

ℝ t, δt;
ℝ[2] X{nodes};
Expand All @@ -287,7 +300,7 @@ class NewNablaProjectWizard extends Wizard implements INewWizard
iterate n while (n+1 < max_iter && t^{n+1} < max_time);
'''
private def getNablagenModelContent(String nablaModuleName, IFolder srcGenJavaFolder, IFolder srcGenKokkosFolder, IFolder srcGenKokkosTeamFolder)
private def getNablagenModelContent(String nablaModuleName, IFolder srcGenJavaFolder, HashMap<String, IFolder> cppFoldersByProgrammingModel)
'''
with «nablaModuleName».*;

Expand Down Expand Up @@ -328,27 +341,19 @@ class NewNablaProjectWizard extends Wizard implements INewWizard
language = Java;
outputDir = "«srcGenJavaFolder.fullPath»";
}
«FOR cppProgrammingModel : cppFoldersByProgrammingModel.keySet»

Ir2Code kokkosGenerator follows fillHlts
{
language = Kokkos
{
maxIterationVariable = max_iter;
stopTimeVariable = max_time;
}
outputDir = "«srcGenKokkosFolder.fullPath»";
}

Ir2Code kokkosTeamOfThreadGenerator follows fillHlts
Ir2Code «cppProgrammingModel.toFirstLower»Generator follows fillHlts
{
language = Kokkos
language = Cpp
{
maxIterationVariable = max_iter;
stopTimeVariable = max_time;
teamOfThreads;
programmingModel = «cppProgrammingModel»
}
outputDir = "«srcGenKokkosTeamFolder.fullPath»";
outputDir = "«cppFoldersByProgrammingModel.get(cppProgrammingModel).fullPath»";
}
«ENDFOR»
}
'''
Expand Down

0 comments on commit e92c1fe

Please sign in to comment.