Saturday, June 23, 2012

Novel : The Demon Slayer

So this is a great novel about a young boy who has encounters with the supernatural. It's currently available on amazon as e-reader: http://www.amazon.com/dp/B008C909TS

Sunday, June 17, 2012

Happy Father's Day!

Each father's day, I reminisce about the great times I shared with my dad. On this day, whether I was at home with him, or miles away separated by oceans and continents, I never forgot about all the reasons that made him the greatest dad in the world. It has made me the person I am today. When I stop and think about my values, beliefs, hobbies, and habits, I realize that he played a strong role in shaping not just each of my thoughts and actions, but he also gave me my vision and the ability to judge a person and to see the world in its true colors.

In celebration of father's day, here are two great poems:

1. Free Verse about a father's love: http://voices.yahoo.com/free-verse-fathers-love-10931188.html?cat=47

2. Haiku (actually Senryu) about Father's Dayhttp://voices.yahoo.com/about-fathers-day-haiku-11369436.html?cat=42

Saturday, May 12, 2012

Photo Albums

  • I used to store all my digital pics on Yahoo! Photos which was bought by Sharpcast Photos.
  • Sharpcast is now Sugar Sync and the photo album application has been obsoleted by Hummingbird.
  • I now use Flickr for all my photo editing and storage.
  • Here's a great album comparing various online photo albums: http://voices.yahoo.com/best-photo-album-software-programs-7605028.html?cat=15
  • Check out my photos on Flickr: here

Sunday, March 25, 2012

Friday, March 23, 2012

Comparison of Infininand vs Gigabit Ethernet (GigE)

The great debate between Infiniband vs GigE has been ongoing and accelerated by arrival of 10GigE.These are some studies that compare the two protocols. While one is sockets based and the other is qpairs based, these high performance computation-heavy benchmarks stress test for latency, and bandwidth analysis. The results are surprisingly indicative of the type of workload that is running using each interconnect technology.

http://www.deskeng.com/articles/aaammw.htm

Fluent Benchmark Configuration for Infiniband and GigE

LS-DYNA Benchmark comparison published for the LS-DYNA Conference
http://www.dynalook.com/international-conf-2008/

"Optimizing LS-DYNA® Productivity in Cluster Environments"
http://www.dynalook.com/international-conf-2008/ComputingTechnology-3.pdf

Client Code to Create ATM SVC

This is client code that creates Switched Virtual Connection with AAL5 UBR sockets using ATM on Linux distribution from sourceforge.net



#define MAX_SDU     20000
#define MAX_OFFSET  8

void usage(char *name)
{
  fprintf(stderr,"usage: %s [vpi] [vci]\n",name);
  exit(1);
}

int main(int argc, char *argv[])
{
  struct sockaddr_atmsvc to_addr;
  struct atm_blli        blli;
  struct atm_qos         qos, to_qos;
  struct atm_sap         to_sap;
  fd_set                 rd, wd, ed;
  int                    to_fd;
  char                   command[20] = "";
  int                    compare = 1;
  int                    num;

  char   *quit = "q";
  char   *dest = "47.0005.80.ffe100.0000f21a26d8.0020ea000ee0.00";

  /*char   *dest = "nestor-atm";
  */
 
  printf("client: creating new socket...\n");
  if ((to_fd = socket(PF_ATMSVC, SOCK_DGRAM, ATM_AAL5)) < 0)
  {
    perror("client:socket create error\n");
    return 1;
  }
  printf("socket id:");
  printf("%d",to_fd);
  printf("\n");

  printf("client: setting qos...\n");
  memset(&qos,0,sizeof(qos));
  qos.aal = ATM_AAL5;
  qos.txtp.traffic_class = qos.rxtp.traffic_class = ATM_UBR;
  qos.txtp.max_sdu = qos.rxtp.max_sdu = MAX_SDU;

  if (setsockopt(to_fd,SOL_ATM,SO_ATMQOS,&qos,sizeof(qos)) < 0)
  {
        perror("client: setsockopt SO_ATMQOS\n");
        return 1;
  }

  printf("client: setting sap parameters...\n");
  memset(&to_sap,0, sizeof(to_sap));
  if (setsockopt(to_fd, SOL_ATM, SO_ATMSAP,&to_sap, sizeof(to_sap)) <0)
  {
    perror("client: sap paremeter set failed\n");
    close(to_fd);
    return 1;
  }
 

  memset(&to_addr,0, sizeof(to_addr));
  to_addr.sas_family = AF_ATMSVC;
  text2atm(dest, (struct sockaddr *)&to_addr, sizeof(to_addr), T2A_SVC | T2A_LOCAL);

   printf("client: calling connect...\n");
    if (connect(to_fd,(struct sockaddr *) &to_addr,sizeof(to_addr)) < 0)
    {
        perror("client: bind failed\n");
        close(to_fd);
        return 1;
    }
 
    srandom(0); /* we want it to be deterministic */


    FD_ZERO(&rd);
    FD_ZERO(&wd);
    FD_ZERO(&ed);
    FD_SET(to_fd, &wd);
   
    printf("\n");
    printf("Enter message, q to quit: ");
    gets(command);
    compare = strcmp(command, quit);

    while (compare!=0)
    {
      printf("\n");
      printf("client sending message...\n");
     
      num = write(to_fd,command,sizeof(command));
      if (num < 0)
      {
        perror("client: write failed\n");
        close(to_fd);
        return 0;
      }

      printf("\n");
      memset(command,0,sizeof(command));
      printf("Enter message, q to quit: ");
      gets(command);
      compare= strcmp(command, quit);
    }
    printf("Shutting down...!\n");
    shutdown(to_fd, 2);
    printf("Goodbye!\n");
    close(to_fd);
  return 0;
}

Server Code to Create ATM SVC

This code creates ATM Switched Virtual Connection with AAL5 UBR socket using ATM on Linux distribution from sourceforge.net




#define MAX_SDU     20000
#define MAX_OFFSET  8

void usage(char *name)
{
  fprintf(stderr,"usage: %s [vpi] [vci]\n",name);
  exit(1);
}

int main(int argc, char *argv[])
{
  struct sockaddr_atmsvc frm_addr, lsn_addr;
  struct atm_blli        blli;
  struct atm_qos         qos, fm_qos;
  struct atm_sap         lstn_sap;
  socklen_t              fm_len, lsn_len;
  fd_set                 rd, wd, ed;
  int                    lsn_fd, fm_fd;
  int                    pid, lst;
  static unsigned char   buffer[20];
  int                    num;

  /*char   *lstn = "47.0005.80.ffe100.0000.f21a.26d8.0020ea000ee0.00";
  */
  char *lstn = "nestor-atm";
 
  printf("server: creating listen socket...\n");
  if ((lsn_fd = socket(PF_ATMSVC, SOCK_DGRAM, ATM_AAL5)) < 0)
  {
    perror("makeConn:socket error\n");
    return 1;
  }
  printf("socket id:");
  printf("%d",lsn_fd);
  printf("\n");

  printf("server: setting listen qos...\n");
  memset(&qos,0,sizeof(qos));
  qos.aal = ATM_AAL5;
  qos.txtp.traffic_class = qos.rxtp.traffic_class = ATM_UBR;
  qos.txtp.max_sdu = qos.rxtp.max_sdu = MAX_SDU;

  if (setsockopt(lsn_fd,SOL_ATM,SO_ATMQOS,&qos,sizeof(qos)) < 0)
  {
        perror("server: setsockopt SO_ATMQOS\n");
        return 1;
  }

  printf("server: setting listen sap...\n");
  memset(&lstn_sap,0, sizeof(lstn_sap));
  if (setsockopt(lsn_fd, SOL_ATM, SO_ATMSAP,&lstn_sap, sizeof(lstn_sap)) <0)
  {
    perror("server: sap paremeter set failed\n");
    close(lsn_fd);
    return 1;
  }

  memset(&lsn_addr,0, sizeof(lsn_addr));
  lsn_addr.sas_family = AF_ATMSVC;
  text2atm(lstn, (struct sockaddr *)&lsn_addr, sizeof(lsn_addr), T2A_SVC | T2A_LOCAL);

   printf("server: binding listen socket...\n");
    if (bind(lsn_fd,(struct sockaddr *) &lsn_addr,sizeof(lsn_addr)) < 0)
    {
        perror("server: bind failed\n");
        return 1;
    }
 
   fm_len = sizeof(frm_addr);
   memset(&frm_addr,0,fm_len);

    printf("server: listening...\n");
    if (listen(lsn_fd, 3) < 0)
    {
       perror("server: listen failed\n");
       close(lsn_fd);
       return 1;
    }
    srandom(0); /* we want it to be deterministic */
 
  while(1)
  {

    FD_ZERO(&rd);
    FD_ZERO(&wd);
    FD_ZERO(&ed);
    FD_SET(lsn_fd, &rd);
    select(lsn_fd+1, &rd, &wd, &ed, NULL);
   
    printf("server: accepting on new socket...\n");
    fm_fd = accept(lsn_fd, (struct sockaddr *)&frm_addr,&fm_len);
    if (fm_fd < 0)
    {
      perror("server: did not accept\n");
      close(fm_fd);
      close(lsn_fd);
      exit(1);
    }

    while(1)
    {
      FD_SET(fm_fd, &rd);
      select(fm_fd+1, &rd, &wd, &ed, NULL);
      memset(buffer,0,sizeof(buffer));
      printf("server: waiting...\n");
      lst = read(fm_fd,buffer,sizeof(buffer));
      if (lst < 0)
      {
        perror("server: listen error\n");
        close(lsn_fd);
        close(fm_fd);
        exit(0);
      }
      if (lst > 0)
      {
        printf("server: received bytes %d\n", lst);
        printf("server: message = %s\n", buffer);
      }
      if (lst == 0)
      {
       printf("server: closing connection...\n");
       close(lsn_fd);
       close(fm_fd);
       exit(0);
      }
    }
  }
  return 0;
}