-
Notifications
You must be signed in to change notification settings - Fork 43
Creating a "Hello World" process in Rsyn
Jucemar Monteiro edited this page Jan 29, 2019
·
4 revisions
Here we present the steps to create a simple "Hello world!" using Rsyn:
- Change to the directory in which you want to implement your Hello World process. We highly recommend creating the processes under /x/src/x/opto/.
$ cd <Rsyn-x-Path>/x/src/x/opto/example
- The second step is to create a module and implement the interface Process. The snippet below shows how to implement a process that prints the message "Hello World!"
$ gedit HelloWorld.cpp
#ifndef HELLOWORLD_H
#define HELLOWORLD_H
#include "rsyn/session/Session.h"
class HelloWorld : public Rsyn::Process {
public:
HelloWorld() {};
private:
bool run(const Rsyn::Json& params) override {
std::cout << "Hello World!\n"; // English
std::cout << "Olá mundo!\n"; // Portuguese
std::cout << "Haro doumo!\n"; // Japanese
return true;
};
};
#endif /* HELLOWORLD_H */
- To plug the module into the framework, you must register the module in the setup file, located in x/src/x/setup/process.cpp:
// ...
#include "x/opto/example/HelloWorld.cpp"
//...
// Registration
namespace Rsyn {
static Startup registerProcesses([]{
Rsyn::Session session;
// ...
// Your code goes here...
session.registerProcess<HelloWorld>("custom.HelloWorld");
// ...
} // end method
} // end namespace
- Recompile the code:
$ cmake <path>
$ make clean
$ make all
- Create a script calling your implementation (The script below was created under x/bin directory):
open "iccad2015" {
"parms" : "ICCAD15.parm",
"config" : "../demo/simple/simple.iccad2015",
"maxDisplacement" : 400,
"targetUtilization" : 0.85
};
run "custom.HelloWorld";
- Run Rsyn under /bin directory:
./rsyn-cmd -script <your-script>.rsyn