i have plugin when installed, extracts executables @ temporary location, , uses them. here code:
public class startcheck implements istartup { private bufferedreader buf=null; public static string pathbandwidth; public static string pathdevicequery; public static string pathkernellaunchoverhead; public static string memorylatency; public void earlystartup() { // method checks presence of nvcc when eclipse starts-up. string command="nvcc --version"; runtime run = runtime.getruntime(); process pr; try { pr = run.exec(command); pr.waitfor(); buf = new bufferedreader(new inputstreamreader(pr.getinputstream())); //print-out nvcc version system.out.println(buf.readline()); preparation.return_val=true; //extract executables bundle bundle = platform.getbundle("ptxanalysis"); url url_bandwidth = filelocator.find(bundle, new path("/executables/bandwidth.out"), null); url url_devicequery = filelocator.find(bundle, new path("/executables/devicequery.out"), null); url url_kernellaunchoverhead = filelocator.find(bundle, new path("/executables/empty"), null); url url_memorylatency = filelocator.find(bundle, new path("/executables/memlatency.out"), null); try { url_bandwidth = filelocator.tofileurl(url_bandwidth); url_devicequery = filelocator.tofileurl(url_devicequery); url_kernellaunchoverhead = filelocator.tofileurl(url_kernellaunchoverhead); url_memorylatency = filelocator.tofileurl(url_memorylatency); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } pathbandwidth=url_bandwidth.tostring(); pathdevicequery=url_devicequery.tostring(); pathkernellaunchoverhead=url_kernellaunchoverhead.tostring(); memorylatency=url_memorylatency.tostring(); }catch (ioexception e) { //disable commands since no further task can done, prompt user install nvcc. system.out.println("nvcc not found on computer. won't able use energy estimation plug-in"); energyestimator.return_val=false; preparation.return_val=false; } catch (interruptedexception e) { e.printstacktrace(); } } }
when install plugin, gives me location (one of many), executable has been extracted:
/home/limafoxtrottango/.eclipse/org.eclipse.platform_4.4.1_2069420271_linux_gtx_x86_64/configuration/org.eclipse.osgi/460/0/.cp/executables/bandwidth.out
now, problems: can't find such directory. understand temporary directory, not show-up if eclipse running. using 1 of these paths run executable using processbuilder. here code:
public static void runexecutable(){ initializearray(); path_result="/home/"+system.getproperty("user.name")+"/kernellaunchoverhead.txt"; string path_executable=startcheck.pathkernellaunchoverhead.substring(path_result.indexof('/'),path_result.lastindexof('/')+1); //path directory in executable extracted try { fw = new filewriter(path_result); for(int i=0;i<arr.length;i++){ processbuilder builder=new processbuilder("./empty",integer.tostring(arr[i])); builder.directory(new file(path_executable)); int av=0; float sum=0; while(av<10){ process pr=builder.start(); stdin = pr.getinputstream(); isr = new inputstreamreader(stdin); br = new bufferedreader(isr); sum=sum+float.parsefloat(line=br.readline()); av++; } fw.write(arr[i]+" "+float.tostring(sum/10)); fw.write("\n"); } fw.close(); } catch (ioexception e1) { // todo auto-generated catch block e1.printstacktrace(); } fillarrays(path_result); bestlinefit(); savemodel("/home/"+system.getproperty("user.name")+"/kernellaunchoverheadmodel.txt"); }
on invoking function, nothing happens. not throw filenotfound exceptions. normally, should have found executable in directory, , run it. after installing plugin, nothing happens.
to re-iterate, class startcheck showing me path executables have been extracted. paths not exist anywhere on system.
directories starting .
(such .eclipse
in path show) hidden on linux , macos systems.
you can see them command line using ls -a
Comments
Post a Comment