Skip to content

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:

  1. 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
  1. 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 */
  1. 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
  1. Recompile the code:
$ cmake <path>
$ make clean
$ make all
  1. 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";
  1. Run Rsyn under /bin directory:
./rsyn-cmd -script <your-script>.rsyn 
Clone this wiki locally