Hi Josh,

I'm running on a linux64 system. If I enter the suggested command I  
simply get:
hostname|
No spaces before or after the name.

In other programming languages these spaces don't appear if I use  
their respective functions for getting the host name.

Maybe my idea of writing "Runtime.getName()" wasn't correct? I just  
guessed this one.

bye


Zitat von Josh Milthorpe <josh.miltho...@gmail.com>:

> Hi Michael,
>
> for Native X10, Runtime.getName() uses the value returned by gethostname().
> This should be null-terminated:
>
> http://pubs.opengroup.org/onlinepubs/009695399/functions/gethostname.html
>
> However, it looks like for your system, there are a number of spaces in the
> hostname before the null character.  What platform are you running on?
> What do you get if you run the command:
>
> $ echo `hostname`'|'
>
> On my system, I see
>
> hostname.ibm.com|
>
> Cheers,
>
> Josh
>
> On 10 September 2014 08:27, Michael Dietrich <
> michael.dietr...@s2010.tu-chemnitz.de> wrote:
>
>> Hi,
>>
>> I changed the code to the following:
>>
>> import x10.io.Console;
>>
>> class HelloWholeWorld {
>>    public static def main(args:Rail[String]):void {
>>       finish for (p in Place.places()) {
>>          at (p) async {
>>            Console.OUT.println(here+" says hello: "+ Runtime.getName());
>>            Console.OUT.flush();
>>          }
>>       }
>>
>>    Console.OUT.println("The End!");
>>    Console.OUT.flush();
>>    }
>> }
>>
>> with the same configuration as before I get the following:
>>
>> [console]$ ./HelloWholeWorld
>> Place(1) says hello: 5979@name1
>> Place(0) says hello: 10184@name2
>>                                      The End!
>>                                              [console]$
>>
>> The output order of the two places may vary but that's quite normal in
>> this case. The other message is printed at the end correctly now.
>> One more question is how these much spaces get into the output and how
>> to avoid them? This is actually not so important since this program
>> (and the output) is for practising reasons only but may be good to
>> know. :)
>>
>> Thank you for your support.
>>
>> bye
>>
>>
>> Zitat von Marco Bungart <m.bung...@gmx.net>:
>>
>> > Hi,
>> >
>> > Am 08.09.2014 um 16:25 schrieb WangChen:
>> >> 1.
>> >> I tested it on my computer.
>> >> If all name in X10_HOSTLIST are invalid then the program won’t start.
>> >> if one of them is right, then the program will running on it.
>> >>
>> >> 2.
>> >> Since you used finish construct, “the End” should always be printed at
>> last.
>> >> I get the right output when compiling with native x10(x10c++)
>> >> But i get the same results as you do when compiling with managed
>> >> x10(x10c). (“the End” not printed at last)
>> >
>> > Remember that println does buffer. To write directly (without
>> > buffering), call Console.OUT.flush() after every
>> > Console.OUT.println(...). This *should* fix ordering.
>> >
>> > Cheers,
>> > Marco
>> >
>> >>
>> >> 3.
>> >> To synchronize places you could use the barrier() method in the Team
>> class.
>> >>
>> >> |*barrier <../../x10/util/Team.html#barrier()>*()|
>> >>            Blocks until all team members have reached the barrier.
>> >>
>> >>
>> >> I’m new to X10 too and i’m not sure what i said was all right.
>> >> Hope i could help.
>> >>
>> >>
>> >> 在 2014年9月8日,下午9:29,Michael Dietrich
>> >> <michael.dietr...@s2010.tu-chemnitz.de
>> >> <mailto:michael.dietr...@s2010.tu-chemnitz.de>> 写道:
>> >>
>> >>> Hello,
>> >>>
>> >>> I'm sorry for my late answer. Finally I've written a test program like
>> >>> this
>> >>>
>> >>>
>> >>> import x10.io.Console;
>> >>>
>> >>> class HelloWholeWorld {
>> >>>   public static def main(args:Rail[String]):void {
>> >>>      finish for (p in Place.places()) {
>> >>>         at (p) async Console.OUT.println(here+" says hello: "+
>> >>> Runtime.getName());
>> >>>      }
>> >>>
>> >>>   Console.OUT.println("The End");
>> >>>
>> >>>   }
>> >>> }
>> >>>
>> >>> The following occurs
>> >>>
>> >>> [console]$ export X10_NPLACES=2
>> >>> [console]$ export X10_HOSTLIST="name1,name2"
>> >>> [console]$ ./HelloWholeWorld
>> >>> Place(0) says hello: 28901@name1
>> >>>                                     The End
>> >>>                                                      Place(1) says
>> >>> hello: 25821@name2
>> >>>
>> >>> [console]$
>> >>>
>> >>>
>> >>> If I enter invalid names I don't get any output. "The End" neither. So
>> >>> it seems the program doesn't even start if it gets wrong input. If
>> >>> this is correct I would be content with this. Is there a way to avoid
>> >>> all these spaces?
>> >>>
>> >>> One simple question since I'm unexperienced with X10 yet: How to
>> >>> synchronize the places, so that "The End" is always printed at last?
>> >>>
>> >>> Thank you very much for your help.
>> >>>
>> >>> bye
>> >>>
>> >>>
>> >>> Zitat von WangChen <wang...@163.com <mailto:wang...@163.com>>:
>> >>>
>> >>>> Hi, Michael
>> >>>> I’m reading the doc these days and i found an api that might be
>> >>>> useful to you.
>> >>>> In the Runtime class:
>> >>>> getName
>> >>>>
>> >>>> public static String getName()
>> >>>> Get a string that identifies the X10 execution environment of this
>> >>>> place. The string is undefined but should be helpful for debugging,
>> >>>> typically containing the pid and hostname. On java it is equivalent
>> >>>> to
>> >>>> java.lang.management.ManagementFactory.getRuntimeMXBean().getName().
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> 在 2014年8月27日,下午11:33,Michael Dietrich
>> >>>> <michael.dietr...@s2010.tu-chemnitz.de
>> >>>> <mailto:michael.dietr...@s2010.tu-chemnitz.de>> 写道:
>> >>>>
>> >>>>> Hello,
>> >>>>>
>> >>>>> I am using X10 as a part of my bachelor's thesis about high
>> >>>>> performance programming languages (so maybe some more questions may
>> be
>> >>>>> asked later :-) ).
>> >>>>>
>> >>>>> My first questions are about using several places:
>> >>>>>
>> >>>>> * If I set X10_NPLACES=n with having less than n hosts, the places
>> >>>>> will be distributed among the existing hosts, right?
>> >>>>>
>> >>>>> * Is there a possibility to find out which place is located on which
>> >>>>> host? In Chapel you have here.name.
>> >>>>>
>> >>>>> * Should X10_NTHREADS be equal to the amount of cores within a host?
>> >>>>>
>> >>>>> * Let there be X10_HOSTLIST="A,B,foo". A and B are the hosts I want
>> to
>> >>>>> use while foo is a randomly chosen set of letters for simulating a
>> >>>>> mistyped or currently inactive computer.
>> >>>>> If I start a program with this parameter I don't get an error message
>> >>>>> though there is something wrong. If I do isDead() on every place
>> every
>> >>>>> of them returns false.
>> >>>>> Did I maybe forget to set something so it doesn't distribute the
>> >>>>> places to other computers or does X10 ignore host names which cannot
>> >>>>> be reached?
>> >>>>>
>> >>>>> Thank you very much
>> >>>>> bye
>> >>>>>
>> >>>>>
>> >>>>>
>> ------------------------------------------------------------------------------
>> >>>>> Slashdot TV.
>> >>>>> Video for Nerds.  Stuff that matters.
>> >>>>> http://tv.slashdot.org/
>> >>>>> _______________________________________________
>> >>>>> X10-users mailing list
>> >>>>> X10-users@lists.sourceforge.net
>> >>>>> https://lists.sourceforge.net/lists/listinfo/x10-users
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> ------------------------------------------------------------------------------
>> >>> Want excitement?
>> >>> Manually upgrade your production database.
>> >>> When you want reliability, choose Perforce
>> >>> Perforce version control. Predictably reliable.
>> >>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
>> >>> _______________________________________________
>> >>> X10-users mailing list
>> >>> X10-users@lists.sourceforge.net
>> >>> https://lists.sourceforge.net/lists/listinfo/x10-users
>> >>
>> >>
>> >>
>> >>
>> ------------------------------------------------------------------------------
>> >> Want excitement?
>> >> Manually upgrade your production database.
>> >> When you want reliability, choose Perforce
>> >> Perforce version control. Predictably reliable.
>> >>
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> X10-users mailing list
>> >> X10-users@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/x10-users
>> >>
>> >
>> >
>> ------------------------------------------------------------------------------
>> > Want excitement?
>> > Manually upgrade your production database.
>> > When you want reliability, choose Perforce
>> > Perforce version control. Predictably reliable.
>> >
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
>> > _______________________________________________
>> > X10-users mailing list
>> > X10-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/x10-users
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Want excitement?
>> Manually upgrade your production database.
>> When you want reliability, choose Perforce
>> Perforce version control. Predictably reliable.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
>> _______________________________________________
>> X10-users mailing list
>> X10-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/x10-users
>>




------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to