How to create parallel routine?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

How to create parallel routine?

Post by xjonny »

Hello!
I've tryed to compile a parallel routine & include it into flow...

routine is test-only...

#include <string>
using namespace std;
#define int32 int
int32 time2idP(string q)
{
return q[1];
}

Compile:
g++ -shared -s -o /root/dwhlib.so /root/dwhlib.cpp -ldl

I created parallel routine in dstage with library path:
/root/dwhlib.so

Compiling-error:
External routine library file name 'dwhlib.so' is invalid,routine 'time2idP'
and so on...
I've tryed to move it to other folders... same result.

Please help!!! or tell me, where I can take docs about programming for DStage.
IT happens...
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Welcome Aboard 8)
What do you have in this library?
Did you just try compiling with gCC +Z runctionname.c ?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

Post by xjonny »

Thanks for your hospitality. And sorry for my English...
Really, I didn't understand what you mean.

DStage can get a function only from .so file (under Linux)? (Y)
I have to compile this library by g++ as I understood from docs. (Y) May be I'm wrong... But after your advise I've tryed to do this with gcc...

This library (for test purposes) contains only one function (as I described above).
I don't understand how I have to create and compile this library,so I've tryed different ways: compiled with gcc & g++, set different params char* and string, put it in different places...

Really, it is stupid. I know. If you can show me a book with such description: 2do this & this and so on... :?

May be, problems in my C. :oops: I use Java ususally and am not good in C...

Thank you. I'll wait for your help. This is a question of live&death...
IT happens...
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

Post by xjonny »

I forgot to say... I can't exec
gCC +Z ...
neither
aCC +Z ...
IT happens...
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Are you just playing around with c routines ? Hardly you have to write an external C function. The px functions library is rich with differnt functions to achieve many tasks.
You either habe gCC or aCC. Both may not work. Try to write a simple "HELLO WORLD" program, that you can get off the net and try compiling that first.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

Post by xjonny »

Really, I need to create functions which convert data/time into id, mine colors (I don't know how to say this: capture german, english and russian names of colors and convert them into ids) and so on... A lot of functions...

I don't play. I've just tryed to make "ONE-SIMPLE-FUNCTION"... After that I can create others.

I have gcc 3.3.3 & gcc 4.0.x on my server (yeah, both). There is no option "+z".
(OS: Linux, SuSE 10)

May be, I didn't understand you? Or you didn't understand me? :D

//I can make "HELLO-WORLD" program if you didn't understand... but I'm not very good in C anyway...
IT happens...
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

Post by xjonny »

Thanks!

Problem decided... with g++ and configuring few params of DS "by hands".
IT happens...
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I am sorry I didnt get you, what was your problem again and how did you fix it?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

Post by xjonny »

Problem was in step-by-step description how to create parallel routine under
(sic!) SuSE Linux 10 with preinstalled gcc(g++) ver. 4.0.x while DS needs gcc(g++) ver 3.3.3.

Decision:
1. install gcc 3.3.3 on DS-server (in different directory saving gcc 4.0.x - problems with compatibility of glibc and others)
2. install second server with gcc 3.3.3 only
3. configure DS "to see" its own libraries. By default it doesn't see them :(
something like this:
vi /etc/ld.so.conf.d/ds.conf
/home/dsadm/Ascential/DataStage/PXEngine.751.4/lib
/home/dsadm/Ascential/DataStage/PXEngine.752.3/lib
4. compile routine on second server by g++!!! not gcc!!!
like this:
g++ -shared -s -o /root/libtime2idP.so /root/dwhlib.cpp -ldl

... and copy to DS server (via ssh for example)...
5. on DS (sic!!! only to this path! because DS ignores path to library, I tryed)
cp /root/libtime2idP.so /usr/lib/
6. Thats all! configure DS from Designer

It is very simple, isn't it?

"If we knew what it was we were doing, it would not be called research, would it?"
- Albert Einstein

/* Hello from Russia. First DS EE developer team in RU. */
IT happens...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Don't you also have to add a new "parallel routine" to the DataStage repository, to allow DataStage to check the number and type of arguments, and so on?

This is actually a reference to the existence of the function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

xjonny wrote:"If we knew what it was we were doing, it would not be called research, would it?"
- Albert Einstein
I like this guy, he quotes Albert Einstein. :lol:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply