Hello Dave,

I am trying to use my Mpz type inside a collective finish.
I have added a MulReducer<T> struct in Reducible.x10
but my program is failing either silently or with "Place 0 exited
unexpectedly with signal: Segmentation fault"

Here is a summary of the code:

val finalSum =  finish(myMulReducer()){
ateach (z in D_Base) {
//calculate myFact - partial factorial in this place
offer myFact; //******failing here
                    }
};
return finalSum;
//......

              static struct myMulReducer implements Reducible[Mpz] {
        public def zero() = Mpz(0);
        public operator this(a:Mpz, b:Mpz) = (a * b);
}

Is the offer causing the problem? Also tried to write partial results in a
DistArray and used reduce function, in which case I get a Termination error

Regards,
Konstantina


2014-06-06 21:42 GMT+01:00 Konstantina Panagiotopoulou <kwno...@hotmail.com>
:

> Dave,
>
> It was actually a circular dependency between files.
> My type now implements the interfaces Any and Arithmetic.
> Next step is Comparable and Reducible.
>
> Thanks a lot!
>
> Konstantina
>
>
>
> 2014-06-06 1:54 GMT+01:00 David P Grove <gro...@us.ibm.com>:
>
>  Hi,
>>
>>  My guess is that you are missing an include.
>>
>>  early in basic_functions.h there is a #include <x10/lang/Complex.h>
>> Inside of Complex.h, you'll find
>>
>> #include <complex>
>> typedef std::complex<double> x10_complex;
>>
>> So before the struct_equals_inner is defined, we've typedef'ed
>> x10_complex to std::complex<double> and included <complex>.
>>
>> My guess is you need to do something similar for the x10_mpz type.
>>
>> --dave
>>
>>
>> [image: Inactive hide details for Konstantina Panagiotopoulou
>> ---06/04/2014 01:43:32 PM---Hi again Dave, I have moved the files to 
>> the]Konstantina
>> Panagiotopoulou ---06/04/2014 01:43:32 PM---Hi again Dave, I have moved the
>> files to the according places
>>
>> From: Konstantina Panagiotopoulou <kwno...@hotmail.com>
>>
>> To: Mailing list for users of the X10 programming language <
>> x10-users@lists.sourceforge.net>
>> Date: 06/04/2014 01:43 PM
>>
>> Subject: Re: [X10-users] GNU multiple precision library binding??
>> ------------------------------
>>
>>
>>
>> Hi again Dave,
>>
>> I have moved the files to the according places
>> x10.runtime/src-cpp/x10/lang and x10.runtime/src-x10/x10
>> and I can call the constructor and functions in my test program.
>>
>> But I am really stuck with the integration of the new type.
>> I am trying to implement the Any interface and making changes according
>> to the Complex type.
>>
>> I keep getting large amounts of errors (that seem irrelevant) and the
>> following error in basic_functions.h:
>> error: ISO C++ forbids declaration of ‘x10_mpz’ with no type
>> in three different places.
>> Firstly in the lines:
>> inline x10_boolean struct_equals_inner(const x10_mpz x,  const x10_mpz y)
>> { return x==y; }
>> inline x10_boolean equals_inner(const x10_mpz x, const x10_mpz y){
>>  return x==y; }
>>
>> I checked the other basic types (eg Double) (Complex doesn't declare an
>> "equals" method) and added this part
>>
>> @Native("c++", "::x10aux::equals(#this, #x)")
>>     public native def equals(x:Any):Boolean;
>> @Native("c++", "::x10aux::equals(#this, #x)")
>>     public native def equals(x:Mpz):Boolean;
>>
>> in my Mpz.x10 file.
>> I suppose my type should fit in one of the templates in
>> basic_functions.h, probably this one:
>> template<class T, class U> inline x10_boolean struct_equals(T x, U y) {
>>  return struct_equals_inner(x, y);  }
>> but the error persists.
>>
>> Also, I get the same error in line:
>> inline x10_int hash_code(const x10_mpz x){return hash_code((x10_ulong)x);}
>> Now this is a naive implementation until I get the build successful (if
>> ever)
>> Any suggestion on these would be of great help!!
>>
>> last thing..
>> Is this line required in the .x10 file?
>> public type Mpz(b:Mpz) = Mpz{self==b};
>> Most of the types will have it, but Complex doesn't.
>>
>>
>> Regards,
>> Konstantina
>>
>> 2014-05-12 15:16 GMT+01:00 David P Grove <*gro...@us.ibm.com*
>> <gro...@us.ibm.com>>:
>>
>>    Konstantina Panagiotopoulou <*kwno...@hotmail.com*
>>    <kwno...@hotmail.com>> wrote on 05/09/2014 09:58:40 AM:
>>
>>
>>    >
>>    > I have started implementing basic functions for my GMP type but I
>>    > have an issue on where to place my .h and .x10 files.
>>    > First I added them in
>>
>>    > x10.runtime/src-cpp/x10/lang and
>>    > x10.runtime/src-x10/x10 accordingly.
>>    > I have used proper namespaces for the .h file and added a couple of
>>    > lines in basic_function.h
>>    > When I try to build, this fails, and if I don't build it, then my
>>    > test program (located in x10.dist) cannot find the type.
>>
>>    > Now, if I put everything in the x10.dist directory, I cannot refer
>>    > to the .h file from basic_functions.h
>>    > Not even using its full path.
>>    >
>>    > Any suggestions?
>>    >
>>
>>
>>    Hi,
>>
>>    It should work to put the .x10 files in x10.runtime/src-x10/x10/lang
>>     and the .cc/.h files in x10.runtime/src-cpp/x10/lang.   You will need to
>>    edit the Makefile in x10.runtime/src-cpp to add the corresponding .o file
>>    to ALL_XRCPP_OBJECTS.
>>
>>    After doing this, you need to force at least enough of the build to
>>    happen so that the new .h files are copied into x10.dist/stdlib/.  
>> Probably
>>    the simplest thing to do is in x10.dist, do "ant clean-cpp dist-cpp"
>>
>>    --dave
>>
>>
>>    
>> ------------------------------------------------------------------------------
>>    "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>>    Instantly run your Selenium tests across 300+ browser/OS combos.
>>    Get unparalleled scalability from the best Selenium testing platform
>>    available
>>    Simple to use. Nothing to install. Get started now for free."
>> *http://p.sf.net/sfu/SauceLabs* <http://p.sf.net/sfu/SauceLabs>
>>    _______________________________________________
>>    X10-users mailing list
>> *X10-users@lists.sourceforge.net* <X10-users@lists.sourceforge.net>
>> *https://lists.sourceforge.net/lists/listinfo/x10-users*
>>    <https://lists.sourceforge.net/lists/listinfo/x10-users>
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their
>> applications. Written by three acclaimed leaders in the field,
>> this first edition is now available. Download your free book today!
>> http://p.sf.net/sfu/NeoTech
>> _______________________________________________
>> X10-users mailing list
>> X10-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/x10-users
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and their
>> applications. Written by three acclaimed leaders in the field,
>> this first edition is now available. Download your free book today!
>> http://p.sf.net/sfu/NeoTech
>> _______________________________________________
>> X10-users mailing list
>> X10-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/x10-users
>>
>>
>
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to