Fir on hadoop using hadoop-streaming

Source: Internet
Author: User
Tags vivado

Prepare hadoop streaming

Hadoop streaming allows you to create and run MAP/reduce jobs with any executable or script as the Mapper and/or the CER Cer.

1. Download hadoop streaming fit for your hadoop version

For hadoop2.4.0, you can visit the following website and download the JAR file:

Http://mvnrepository.com/artifact/org.apache.hadoop/hadoop-streaming/2.4.0

Than put the JAR file to the $ hadoop_home folder.

 

2. hadoop-streaming test in my cluster:

Bin/hadoop jar hadoop-streaming-2.4.0.jar-Input/in-output/out2-mapper/bin/cat

-Reducer/usr/bin/WC

 

3. Other map reduce demo here:

Python:

Http://www.michael-noll.com/tutorials/writing-an-hadoop-mapreduce-program-in-python/

C ++:

Http://blog.sina.com.cn/s/blog_62a9902f01018rzj.html

 

Fir hardware:

1. Fir. h

#ifndef _FIR_H_#define _FIR_H_#include "ap_cint.h"#define N58#define SAMPLES N+10 // just few more samples then number of tapstypedef shortcoef_t;typedef shortdata_t;typedef int38acc_t;#endif

2. fir_coef.dat

-378,-73,27,170,298,352,302,168,14,-80,-64,53,186,216,40,-356,-867,-1283,-1366,-954,-51,1132,2227,2829,2647,1633,25,-1712,-3042,29229,-3042,-1712,25,1633,2647,2829,2227,1132,-51,-954,-1366,-1283,-867,-356,40,216,186,53,-64,-80,14,168,302,352,298,170,27,-73,-378

3. Fir. c

#include "fir.h"void fir (  data_t *y,  data_t x  ) {  const coef_t c[N+1]={ #include "fir_coef.dat"    };    static data_t shift_reg[N];  acc_t acc;  int i;    acc=(acc_t)shift_reg[N-1]*(acc_t)c[N];  loop: for (i=N-1;i!=0;i--) {    acc+=(acc_t)shift_reg[i-1]*(acc_t)c[i];    shift_reg[i]=shift_reg[i-1];  }  acc+=(acc_t)x*(acc_t)c[0];  shift_reg[0]=x;  *y = acc>>15;}

4. fir_test.c

#include <stdio.h>#include <math.h>#include "fir.h"void fir (  data_t *y,  data_t x  );int main () {  FILE   *fp;  data_t signal, output;  fp=fopen("fir_impulse.dat","w");  int i;  for (i=0;i<SAMPLES;i++) {  if(i==0)  signal = 0x8000;  else  signal = 0;  fir(&output,signal);     printf("%i %d %d\n",i,(int)signal,(int)output);//     fprintf(fp,"%i %d %d\n",i,signal,output);  }  fclose(fp);  return 0;}

Here is the project in vivado HLS:

Here is the directive View:

In vivado Project Settings:

BD:

Done

 

Driver:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.