[feat] Added default FPGA configuration based on the vendor
@@ -64,6 +64,8 @@ import uk.ac.manchester.tornado.runtime.tasks.meta.TaskMetaData;
public class OCLCodeCache {
public static final String LOOKUP_BUFFER_KERNEL_NAME = "lookupBufferAddress";
+ private static final String DIRECTORY_BITSTREAM = "fpga-source-comp-default/";
+ public static String FPGA_BIN_LOCATION = "./" + DIRECTORY_BITSTREAM + LOOKUP_BUFFER_KERNEL_NAME;
private static final String FALSE = "False";
private static final String TRUE = "True";
@@ -78,6 +80,8 @@ public class OCLCodeCache {
private final String OPENCL_LOG_DIR = getProperty("tornado.opencl.log.dir", "/var/opencl-logs");
private final String INTEL_ALTERA_OPENCL_COMPILER = "aoc";
private final String XILINX_OPENCL_COMPILER = "xocc";
+ private final String INTEL_ALTERA_COMPILER_FLAGS = "FLAGS=-v -fast-compile -high-effort -fp-relaxed -report -incremental -profile";
+ private final String XILINX_COMPILER_FLAGS = "-O3 -j12";
private final String FPGA_CLEANUP_SCRIPT = System.getenv("TORNADO_SDK") + "/bin/cleanFpga.sh";
private String fpgaName;
private String compilationFlags;
@@ -140,15 +144,11 @@ public class OCLCodeCache {
private void parseFPGAConfigurationFile() {
FileReader fileReader;
BufferedReader bufferedReader;
+ System.out.println("[parseFPGAConfigurationFile]");
try {
fileReader = new FileReader(new File("").getAbsolutePath() + "/etc/fpga.conf");
bufferedReader = new BufferedReader(fileReader);
- } catch (IOException e) {
- System.out.println("Wrong file, please ensure you have configured the etc/fpga.conf file!");
- return;
- }
String line;
-
try {
while ((line=bufferedReader.readLine()) != null) {
switch (line.split("=")[0]) {
@@ -170,6 +170,15 @@ public class OCLCodeCache {
} catch (IOException e) {
e.printStackTrace();
}
+ } catch (IOException e) {
+ System.out.println("Wrong configuration file, proceed with default configuration. If you target FPGA in the cloud, please ensure that you have configured the etc/fpga.conf file!");
+ //return;
+ fpgaName = deviceContext.getDevice().getDeviceName();
+ fpgaBinLocation = FPGA_BIN_LOCATION;
+ fpgaSourceDir = DIRECTORY_BITSTREAM;
+ directoryBitstream = DIRECTORY_BITSTREAM;
+ compilationFlags = (deviceContext.getDevice().getDeviceVendor().toLowerCase().equals("xilinx")) ? XILINX_COMPILER_FLAGS : INTEL_ALTERA_COMPILER_FLAGS;
+ }
}
