With the current version of X10, you can run the binary output by x10c++ directly. E.g. "./a.out". runx10 is not needed.
If I'm reading this correctly, x10c++ compiles your program ok, but you get a runtime exception. A Null Pointer Exception, in one of your Array.copy calls. I would try to figure out which of the Array.copy() calls is throwing the exception, and check if you're going beyond the array bounds. at void x10aux::throwException<x10::lang::NullPointerException>() at x10aux::throwNPE() at void x10::array::Array<void>::copy<signed char> (x10aux::ref<x10::array::Array<signed char> >, int, x10aux::ref<x10::array::Array<signed char> >, int, int) at AES::enc(x10aux::ref<x10::io::File>, int) at AES::main(x10aux::ref<x10::array::Array<x10aux::ref<x10::lang::String> > >) - Ben |------------> | From: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Anh <a...@pacbell.net> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | To: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |David P Grove/Watson/IBM@IBMUS, Mailing list for users of the X10 programming language <x10-users@lists.sourceforge.net>, | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Date: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |11/03/2011 17:34 | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Subject: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Re: [X10-users] AES in X10 | >--------------------------------------------------------------------------------------------------------------------------------------------------| Hi I compiled the code and working fine with Java-backend, but got error when run with X10C++ compilation. See the error output, i see that Array.copy(input,startIndex,subinput,0, endIndex-startIndex+1); hits ding. (I also recompiled X10 from source for better computability, and I don't see runx10 in the bin, is this new is that x10c++ no longer needs runx10?) public static def enc(f:File, num_of_proc:int){ val keystring = "krww6anpovmkcqstubjuzmxcvzpb7c7d"; var input:Rail[Byte] = getBytesFromFile(f); var sizes:Rail[int] = calPartitionInput(input.size, num_of_proc); val l = new ArrayList[AES](); for(var i:int=0,startIndex:int=0,endIndex:int=sizes(i)-1; i<sizes.size; i++){ var subinput:Rail[Byte] = new Array[Byte](0..(endIndex-startIndex)); Array.copy(input,startIndex,subinput,0, endIndex-startIndex+1); val aes = new AES(subinput, startIndex, keystring, "ENC"); startIndex = endIndex+1; endIndex = startIndex+((i<sizes.size-1)?sizes(i+1)-1:input.size-1); l.add(aes); } val s = Timer.milliTime(); finish{ for(var i:int=0; i<l.size(); i++){ val index = i; async { Console.OUT.println(index); l.get(index).run(); } } } val e = Timer.milliTime(); Console.OUT.println((e-s) + " milliseconds"); var newsize:int = input.size + (16 - (input.size % 16)); var output:Rail[Byte] = new Array[Byte](0..(newsize-1)); for(var i:ListIterator[AES]=l.iterator(); i.hasNext(); ){ val aes = i.next() as AES; var size:int = (aes.input.size%16==0)?aes.input.size:aes.output.size; Array.copy(aes.output, 0, output, aes.index, size); } val ext= f.getPath().substring(f.getPath().lastIndexOf(".")+1,f.getPath ().length()); val fn = f.getPath() + ".xenc."+ext ; var f1:x10.io.File = new x10.io.File(fn); var fw:x10.io.FileWriter = f1.openWrite(); fw.write(output); Console.OUT.println("Done ENC"); } Uncaught exception at place 0: x10.lang.MultipleExceptions x10.lang.NullPointerException x10.lang.NullPointerException at x10::lang::Throwable::fillInStackTrace() at x10aux::throwException(x10aux::ref<x10::lang::Throwable>) at void x10aux::throwException<x10::lang::NullPointerException>() at x10aux::throwNPE() at void x10::array::Array<void>::copy<signed char> (x10aux::ref<x10::array::Array<signed char> >, int, x10aux::ref<x10::array::Array<signed char> >, int, int) at AES::enc(x10aux::ref<x10::io::File>, int) at AES::main(x10aux::ref<x10::array::Array<x10aux::ref<x10::lang::String> > >) at x10aux::BootStrapClosure::__apply() at x10::lang::VoidFun_0_0::__apply(x10aux::ref<x10::lang::Reference>) at x10_lang_Runtime__closure__1::__apply() at x10::lang::VoidFun_0_0::__apply(x10aux::ref<x10::lang::Reference>) at x10::lang::Activity::run() at x10::lang::Runtime__Worker::loop() at x10::lang::Runtime__Worker::__apply() at x10::lang::Runtime__Pool::__apply(int) at x10::lang::Runtime::start(x10aux::ref<x10::lang::VoidFun_0_0>, x10aux::ref<x10::lang::VoidFun_0_0>) at int x10aux::template_main<x10::lang::Runtime, AES>(int, char**) at start ________________________________ From: David P Grove <gro...@us.ibm.com> To: Anh <a...@pacbell.net> Cc: Mailing list for users of the X10 programming language <x10-users@lists.sourceforge.net> Sent: Wednesday, November 2, 2011 6:34 PM Subject: Re: [X10-users] AES in X10 Anh <a...@pacbell.net> wrote on 11/02/2011 09:12:52 PM: > > looking at library API, I don't see Rail. Does latest version have > this feature? I saw this from previous version Yes. It's now a typedef for Array[T]{rank==1,zeroBased,rect}. In older versions of X10 it was a special, hand-optimized class distinct from Array. The tool that generates the library documentation is based on javadoc and doesn't quite understand X10's typedefs. If you look in x10.lang.Rail.x10 you'll find it: [dgrove@wahtutca lang]$ more Rail.x10 /* * This file is part of the X10 project (http://x10-lang.org). * * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.opensource.org/licenses/eclipse-1.0.php * * (C) Copyright IBM Corporation 2006-2010. */ package x10.lang; public type Rail[T] = Array [T]{self.rank==1,self.zeroBased,self.rect,self.rail}; --dave ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users