Quantcast
Channel: Intel Developer Zone Articles
Viewing all 3384 articles
Browse latest View live

Intel® Math Kernel Library Benchmarks (Intel® MKL Benchmarks)

$
0
0

Intel MKL Benchmarks package includes Intel® Optimized LINPACK Benchmark,  Intel® Optimized MP LINPACK Benchmark for Clusters, and Intel® Optimized High Performance Conjugate Gradient Benchmark from the latest Intel MKL release. Use the links in the table below to download package for Linux*, Windows* or OS X*.

By downloading any sample package you accept the End User License Agreement

 

 

Package

Release Date

Download Size

Package Contents

Intel Optimized LINPACK Benchmark

Intel Optimized MP LINPACK
Benchmark for Clusters

Intel Optimized High Performance Conjugate Gradient Benchmark (v 3.0)

 

 

 

Source

Binary

Source

Binary

Source

Binary

Linux* package(l_mklb_p_2017.1.013) (.tgz)

Sep 1, 2016

22 MB

 

X

X

X

X

X

 

Windows* package(w_mklb_p_2017.1.014) (.zip)

Sep 1, 2016

15 MB

 

X

X

X

 

 

 

OS X* package(m_mklb_p_2017.1.014) (.tgz)

Sep 1, 2016

3 MB

 

X

 

 

 

 

Optimization Notice in English


Intel® Xeon Phi™ Processor Software Optimization Guide

$
0
0

This document targets engineers interested in optimizing code for improved performance on the Intel® Xeon Phi™ processor. The manual begins with a high level description of the Intel® Xeon Phi™ processor micro-architecture. It follows with several topics that have the highest impact on performance on Intel® Xeon Phi™ AVX512 instructions, Memory Subsystems, Micro-architectural Nuances, Compiler Knobs & Directives, Numeric sequences, MCDRAM as Cache, and Scalar versus Vector Coding.

Integration Wrappers for Intel® Integrated Performance Primitives (Intel® IPP)

$
0
0

To provide easy-to-use APIs and reduce the effort required to add Intel® Integrated Performance Primitives (Intel® IPP) functions to your application, Intel® IPP library introduces new Integration Wrappers APIs. These APIs aggregate multiple Intel® IPP functions and provide easy interfaces to support external threading of Intel® IPP functions. A technical preview of Integration Wrappers functionality is now available for evaluation.

Integration Wrappers consist of C and C++ interfaces:

  • C interface aggregates Intel IPP functions of similar functionality with various data types and channels into one function. Initialization steps required by several Intel IPP functions are implemented in one initialization function for each functionality. To reduce the size of your code and save time required for integration, the wrappers handle all memory management and Intel IPP function selection routines.
  • C++ interface wraps around the C interface to provide default parameters, easily initialized objects as parameters, exception handling, and objects for complex Intel IPP functions with automatic memory management for specification structures.

Integration Wrappers are available as a separate download in the form of source and pre-built binaries.

1. Intel® IPP Integration Wrappers Preview Overview

1.1 Key Features

Integration Wrappers simplify usage of Intel IPP functions and address some of the advanced use cases of Intel IPP. They consist of the C and C++ APIs which provide the following key features:

C interface provides compatibility with C libraries and applications and enables you to use the following features of Integration Wrappers:

  • Automatic selection of the proper Intel IPP function based on input parameters
  • Automatic handling of temporary memory allocations for Intel IPP functions
  • Improved tiling handling and automatic borders processing for tiles
  • Memory optimizations for threading

C++ interface additionally provides:

  • Easier to use classes like IwSize (image size structure in Integration Wrappers)  instead of IppiSize (image size structure in Intel IPP functions), IwRect instead of IppiRect, and IwValue as a unified scalar parameter for borders and other per-channel input values
  • Complex Intel IPP functions designed as classes to use automatic construction and destruction features

The following two code examples implement the image resizing operation with two APIs 1) Resizing image with the Intel® IPP functions 2) Resizing image using the Intel® IPP Integration Wrappers APIs.  The second implementation is much simpler requires less effort to use the Intel IPP functions.

1.Image Resizing with Intel® IPP functions

{……
     ippSts = ippiResizeGetSize_8u(srcSize, dstSize, ippLinear, 0, &specSize, &initSize);
     if(ippSts < 0) return ippSts;
     //allocate internal buffer
     pSpec = (IppiResizeSpec_32f*)ippsMalloc_8u(specSize);
     if(specSize && !pSpec) return STS_ERR_ALLOC;
     //allocate initialization buffer
     pInitBuf = ippsMalloc_8u(initSize);
     //init ipp resizer
     ippSts = ippiResizeLinearInit_8u(srcSize, dstSize, pSpec);
     ippSts = ippiResizeGetSrcRoi_8u(pSpec, dstRoiOffset, dstRoiSize, &srcRoiOffset, &srcRoiSize);
     // adjust input and output buffers to current ROI
     unsigned char *pSrcPtr = pSrc + srcRoiOffset.y*srcStep + rcRoiOffset.x*CHANNELS;
     unsigned char *pDstPtr = pDst + dstRoiOffset.y*dstStep + dstRoiOffset.x*CHANNELS;
     ippSts = ippiResizeGetBufferSize_8u(pSpec, dstRoiSize, CHANNELS, &bufferSize);
     pBuffer = ippsMalloc_8u(bufferSize);
     // perform resize
     ippSts = ippiResizeLinear_8u_C1R(pSrcPtr, srcStep, pDstPtr, dstStep, dstRoiOffset, dstRoiSize, ippBorderRepl, 0, pSpec, pBuffer);
     .......
}

2. Image Resize with Intel® IPP Integration Wrappers (C++ interface)

{ ......
      //Initialization
      IppDataType dataType = ImageFormatToIpp(src.m_sampleFormat);
      ipp::IwiSize srcSize(ImageSizeToIpp(src.m_size));
      ipp::IwiSize dstSize(ImageSizeToIpp(dst.m_size));
      m_resize.InitAlloc(srcSize, dstSize, dataType, src.m_samples, interpolation, ipp::IwiResizeParams(), ippBorderRepl);
      //Run
      ipp::IwiImage iwSrc = ImageToIwImage(src);
      ipp::IwiImage iwDst = ImageToIwImage(dst);
      ipp::IwiRect rect((int)roi.x, (int)roi.y, (int)roi.width, (int)roi.height);
      ipp::IwiRoi  iwRoi(rect);
      m_resize(&iwSrc, &iwDst, &iwRoi);
  ......
}

1.2 Threading

The API of Integration Wrappers (IW) is designed to simplify tile-based processing of images. Tiling is based on the concept of region of interest (ROI).
Most IW image processing functions operate not only on whole images but also on image areas - ROIs. Image ROI is a rectangular area that is either some part of the image or the whole image.

The sections below explain the following IW tiling techniques:

Manual tiling

IW functions are designed to be tiled using the IwiRoi interface. But if for some reasons automatic tiling with IwiRoi is not suitable, there are special APIs to perform tiling manually.

When using manual tiling you need to:

  • Shift images to a correct position for a tile using iwiImage_GetRoiImage
  • If necessary, pass correct border InMem flags to a function using iwiRoi_GetTileBorder
  • If necessary, check the filter border around the image border using iwiRoi_CorrectBorderOverlap

Here is an example of IW threading with OpenMP* using manual tiling:

#include "iw++/iw.hpp"
#include <omp.h>

int main(int, char**)
{
    // Create images
    ipp::IwiImage srcImage, cvtImage, dstImage;
    srcImage.Alloc(ipp::IwiSize(320, 240), ipp8u, 3);
    cvtImage.Alloc(srcImage.m_size, ipp8u, 1);
    dstImage.Alloc(srcImage.m_size, ipp16s, 1);
    int threads = omp_get_max_threads(); // Get threads number
    ipp::IwiSize   tileSize(dstImage.m_size.width, (dstImage.m_size.height + threads - 1)/threads); // One tile per thread
    IppiBorderSize sobBorderSize = iwiSizeToBorderSize(iwiMaskToSize(ippMskSize3x3)); // Convert mask size to border size
    #pragma omp parallel num_threads(threads)
    {
        // Declare thread-scope variables
        IppiBorderType border;
        ipp::IwiImage srcTile, cvtTile, dstTile;
        // Color convert threading
        #pragma omp for
        for(IppSizeL row = 0; row < dstImage.m_size.height; row += tileSize.height)
        {
            ipp::IwiRect tile(0, row, tileSize.width, tileSize.height); // Create actual tile rectangle
            // Get images for current ROI
            srcTile = srcImage.GetRoiImage(tile);
            cvtTile = cvtImage.GetRoiImage(tile);
            // Run functions
            ipp::iwiColorConvert_RGB(&srcTile, iwiColorRGB, &cvtTile, iwiColorGray);
        }
        // Sobel threading
        #pragma omp for
        for(IppSizeL row = 0; row < dstImage.m_size.height; row += tileSize.height)
        {
            ipp::IwiRect tile(0, row, tileSize.width, tileSize.height); // Create actual tile rectangle
            iwiRoi_CorrectBorderOverlap(sobBorderSize, cvtImage.m_size, &tile); // Check borders overlap and correct tile of necessary
            border = iwiRoi_GetTileBorder(ippBorderRepl, sobBorderSize, cvtImage.m_size, tile); // Get actual tile border
            // Get images for current ROI
            cvtTile = cvtImage.GetRoiImage(tile);
            dstTile = dstImage.GetRoiImage(tile);
            // Run functions
            ipp::iwiFilterSobel(&cvtTile, &dstTile, iwiDerivHorFirst, ippMskSize3x3, border);
        }
    }
}

Basic tiling

You can use basic tiling to tile or thread one standalone function or a group of functions without borders. To apply basic tiling, initialize the IwiRoi structure with the current tile rectangle and pass it to the processing function.

For functions operating with different sizes for source and destination images, use the destination size as a base for tile parameters.

Here is an example of IW threading with OpenMP* using basic tiling with IwiRoi:

#include "iw++/iw.hpp"
#include <omp.h>

int main(int, char**)
{
    // Create images
    ipp::IwiImage srcImage, cvtImage, dstImage;
    srcImage.Alloc(ipp::IwiSize(320, 240), ipp8u, 3);
    cvtImage.Alloc(srcImage.m_size, ipp8u, 1);
    dstImage.Alloc(srcImage.m_size, ipp16s, 1);

    int            threads = omp_get_max_threads(); // Get threads number
    ipp::IwiSize   tileSize(dstImage.m_size.width, (dstImage.m_size.height + threads - 1)/threads); // One tile per thread

    #pragma omp parallel num_threads(threads)
    {
        // Declare thread-scope variables
        ipp::IwiRoi  roi;

        // Color convert threading
        #pragma omp for
        for(IppSizeL row = 0; row < dstImage.m_size.height; row += tileSize.height)
        {
            roi = ipp::IwiRect(0, row, tileSize.width, tileSize.height); // Initialize IwiRoi with current tile rectangle

            // Run functions
            ipp::iwiColorConvert_RGB(&srcImage, iwiColorRGB, &cvtImage, iwiColorGray, IPP_MAXABS_64F, &roi);
        }

        // Sobel threading
        #pragma omp for
        for(IppSizeL row = 0; row < dstImage.m_size.height; row += tileSize.height)
        {
            roi = ipp::IwiRect(0, row, tileSize.width, tileSize.height); // Initialize IwiRoi with current tile rectangle

            // Run functions
            ipp::iwiFilterSobel(&cvtImage, &dstImage, iwiDerivHorFirst, ippMskSize3x3, ippBorderRepl, 0, &roi);
        }
    }
}

Pipeline tiling

With the IwiRoi interface you can easily tile pipelines by applying a current tile to an entire pipeline at once instead of tiling each function one by one. This operation requires borders handling and tracking pipeline dependencies, which increases complexity of the API. But when used properly, pipeline tiling can increase scalability of threading or performance of non-threaded functions by performing all operations inside the CPU cache.

Here are some important details that you should take into account when performing pipeline tiling:

  1. Pipeline tiling is performed in reverse order: from destination to source, therefore:
    • Use the tile size based on the destination image size
    • Initialize the IwiRoi structure with the IwiRoiPipeline_Init for the last operation
    • Initialize the IwiRoi structure for other operations from the last to the first with IwiRoiPipeline_InitChild
  2. Obtain the border size for each operation from its mask size, kernel size, or using the specific function returning the border size, if any.
  3. If you have a geometric transform inside the pipeline, fill in the IwiRoiScale structure for IwiRoi for this transform operation.
  4. In case of threading, copy initialized IwiRoi structures to a local thread or initialize them on a per-thread basis. Access to structures is not thread-safe.
  5. Do not exceed the maximum tile size specified during initialization. Otherwise, this can lead to buffers overflow.

The IW package contains several advanced tiling examples, which can help you understand the details of the process. For more information on how to find and use these examples, please download package and view contained developer reference for Integration Wrappers for Intel IPP.

The following example demonstrates IW threading with OpenMP* using IwiRoi pipeline tiling:

#include "iw++/iw.hpp"
#include <omp.h>

int main(int, char**)
{
    // Create images
    ipp::IwiImage srcImage, dstImage;
    srcImage.Alloc(ipp::IwiSize(320, 240), ipp8u, 3);
    dstImage.Alloc(srcImage.m_size, ipp16s, 1);
    int threads = omp_get_max_threads(); // Get threads number
    ipp::IwiSize   tileSize(dstImage.m_size.width, (dstImage.m_size.height + threads - 1)/threads); // One tile per thread
    IppiBorderSize sobBorderSize = iwiSizeToBorderSize(iwiMaskToSize(ippMskSize3x3)); // Convert mask size to border size

    #pragma omp parallel num_threads(threads)
    {
        // Declare thread-scope variables
        ipp::IwiImage       cvtImage;
        ipp::IwiRoiPipeline roiConvert, roiSobel;
        roiSobel.Init(tileSize, dstImage.m_size, &sobBorderSize); // Initialize last operation ROI first
        roiConvert.InitChild(&roiSobel); // Initialize next operation as a dependent
        // Allocate intermediate buffer
        cvtImage.Alloc(roiConvert.GetDstBufferSize(), ipp8u, 1);
        // Joined pipeline threading
        #pragma omp for
        for(IppSizeL row = 0; row < dstImage.m_size.height; row += tileSize.height)
        {
            roiSobel.SetTile(ipp::IwiRect(0, row, tileSize.width, tileSize.height)); // Set IwiRoi chain to current tile coordinates
            // Run functions
            ipp::iwiColorConvert_RGB(&srcImage, iwiColorRGB, &cvtImage, iwiColorGray, IPP_MAXABS_64F, &roiConvert);
            ipp::iwiFilterSobel(&cvtImage, &dstImage, iwiDerivHorFirst, ippMskSize3x3, ippBorderRepl, 0, &roiSobel);
        }
    }
}

2. Getting Started

2.1 Getting Started Document

Getting Started instructions are provided in the Integration Wrappers Developer Guide and Reference.  You can find this document the following folder available after you install the Intel® IPP Integration Wrappers Preview package: /interfaces/integration_wrappers.

You can find the following getting started information in the referenced above document:

  • Building Integration Wrappers and Examples
  • Using Integration Wrappers Examples
  • C/C++ API Reference for the Integration Wrappers

2.2 Examples Code

Intel® IPP Integration Wrappers Preview package contains code samples demonstrating how to use these APIs. The example files are located at:  interfaces/integration_wrappers/examples/iw_resize.
These examples demonstrate some of the IW features and help you get started with the IW library.

3. Support

If you have any problems with Intel® IPP Integration Wrappers Preview, post your questions at Intel® IPP forum.  If you already register your Intel® software product at the Intel® Software Development Products Registration Center, you can also submit your question by Intel® Premier Support.

4. Download and Installation

  1. Intel® IPP Integration Wrappers is an add-on library for Intel IPP package. Please install Intel® IPP main package first before using Intel IPP Integration Wrappers.Intel IPP is available as part of Intel® Parallel Studio XE, or Intel® System Studio products. It is also available as a standalone package with the Community License. Any of these products can work with Intel IPP Integration Wrappers.
  2. Use the links in the table below to download the Intel IPP IW package for Linux*, Windows*, or OS X*. To install the Libraries, put the archive file into the IPPROOT/ interfaces folder, and extract all files from the archive.   
      By downloading any sample package you accept the End User License Agreement
  3. Check the “Getting Started” document in the package to learn the library.
    Windows*

    w_ippiw_p_2017.1.010.zip

    Linux*

    l_ippiw_p_2017.1.009.tgz

    OS X*

    m_ippw_p_2017.1.009.tgz

Rewiring Shakespeare with Elsinore

$
0
0

Download   [PDF 1.05 MB]

Moonlighting game developers shake up the adventure genre to win 2016 Intel® Level Up Contest award

Making a video game on the side when you already have a full-time job is a major undertaking. Presuming to rewrite Shakespeare is quite another thing entirely. Combining the two, however, takes game development chutzpah to a whole new level.

To paraphrase the character Polonius in Shakespeare’s Hamlet: “Neither an employee nor an independent be,” to which we’d add, “not when you can be both.” This is the approach of the team at Golden Glitch Studios. Led by Katie Chironis, who in her day job is a VR game designer at Oculus, Golden Glitch is making Elsinore, a bold evolution in the point-and-click genre that won Best Adventure/Role Playing game in the 2016 Intel® Level Up Contest.

Elsinore title-screen

Figure 1:The Elsinore title screen showing the playable character Ophelia, and the hand-painted art style.

Elsinore is a real labor of love. Nearly every member of its 11-strong team holds a full-time job in the games industry and works on the project in their free time. This “moonlighting model” of game development is made possible by the lack of geographical barriers to online collaboration and a team that is motivated by more than simple financial reward.

That’s not to say that the team’s chosen modus operandi doesn’t come with its own particular challenges. How Katie, her game designer right-hand Connor Fallon, and the rest of the talented team are making it happen, is, like Hamlet itself, a story worth telling.

Questioning Shakespeare

Katie’s initial encounter with Shakespeare’s best-known opus wasn’t promising: “Like most other kids, I was forced to read Hamlet. I definitely didn’t appreciate it at the time.” A college course brought the play to her attention again, this time in a more flattering light, and Katie realized there were some questions she needed answering.

“The thing that stuck out to me was that Ophelia didn’t get what she deserved,” said Katie. “Hamlet can withstand all this crazy stuff, and manages not to lose his mind, but Ophelia, the second her dad dies and Hamlet rejects her, goes completely insane and drowns herself. That to me felt really unbalanced.”

The final impetus to turn Ophelia’s story into a game came from a Shakespeare-themed contest held by Carnegie Mellon University’s Game Creation Society, of which both Katie and Connor were members. Once they started down the path with Elsinore, they realized they were onto something big, and, after a couple of summers developing the idea, followed by graduation, they decided to knuckle down and make it a reality.

Tragic Transformation

As a reformed scholar of Shakespeare, Katie had few qualms about rewriting the Hamlet narrative to bring the balance she sought, safe in the knowledge that Shakespeare himself had indulged in something of a fan-fiction rewrite, having drawn on the Norse legend of Amleth.

In this spirit, Katie took a number of “liberties” which included making Ophelia a woman of color of Moorish descent, adding more women to the ensemble, and pouring something of herself into Ophelia’s character. “Ophelia shares a lot of flaws that I personally have,” said Katie. “I write a lot of myself in her. That’s been my personal highlight on the project.”

Elsinore option screen

Figure 2:Screenshot showing the options Ophelia has for sharing information with Hamlet, each of which bears its own consequences.

The re-imagining provided an opportunity to play around with the point-and-click adventure genre, of which the team are ardent fans, bringing new ideas and mechanics into play. The most notable of these are the time-looping story in which the player, as Ophelia, repeatedly relives the same 48-hour period and the responsive narrative system that reacts to the information you share with NPCs, none of which they forget, despite the resetting clock.

“We set out to create a game that makes you feel like you are living through hell at the end of the world, but you get to know the people who are along for the ride with you,” said Katie. “There is something very compelling about repeatedly facing down the same tragedy,” added Connor.

Moonlighting Strangers

“It is really, really hard to make a game in your spare time when you work in the games industry full time,” admitted Katie. “I didn’t fully appreciate that when I started.” Katie, Connor, and the rest of their original collaborators, were committed however, so they began the process of pulling together a complete team of like-minded compatriots.

The initial team was comprised of members of the Game Creation Society they were part of at Carnegie Mellon. After graduating from the Pennsylvania college, the team was scattered to the four winds in search of work. “Some of us are in academia, and some of us are in the games industry,” said Connor. “Oculus, ArenaNet, Double Fine, Telltale...we run the spectrum.”

Showcasing artist Wesley Martin

Figure 3:Still showcasing the artist Wesley Martin’s hand-painted work and a character’s bloody fate.

Most, however, eventually found themselves heading in the same direction: the West Coast’s game development hubs. With team members based in Seattle, San Francisco, and Los Angeles, as well as a couple of stragglers still resisting the pull of the West Coast, it remains a challenge to get people under the same roof.

To help keep things on track, they use a number of online tools. “We love Trello*,” said Katie. “We rely heavily on Trello and Google* Docs to make sure that we are synced up on workloads and current tasks. [Engineers] Eric and Kristen have also hand-developed a number of tools in Unity* that we use to track information about the game,” she added. “Those have been incredibly helpful.”

One interesting addition to the team is composer Adam Gubman, who creates music for high-profile clients including Disney and NBC, and game publishers Square-Enix, Activision, and Ubisoft. Katie credits him with more than the music on Elsinore: “He was my piano teacher when I was a kid,” she explained. “Back then he was in college to become a game composer. He was one of the first people in my life that made me realize that I could have a career in games. The fact that he decided to join the project is something I'll always be grateful for.”

Fringe Benefits

In 2015, the Golden Glitch team made the decision to run a Kickstarter* campaign to help fund the nascent Elsinore. Despite the campaign’s intensity and its baptism of fire in community and social media marketing, it proved worthwhile. “I’m really glad we did it,” said Katie. “It was stressful at the time, but we didn’t want to seek out a publisher because it’s not our full-time job, so there was no other avenue of funding open to us.”

Not only did they hit the initial target in three days and smash through numerous stretch goals to reach more than USD $32,000, they also found themselves Greenlit on Steam* in under 48 hours. Katie fondly remembers receiving an email from a Valve* staffer along the lines of, “Hey, in my former life I was an English teacher and I taught Hamlet to my students, I love your game. It’s been passed though.”

Storyboard art
Figure 4:Storyboard art showing Hamlet and the ghost.

One side-effect of any successful Kickstarter campaign is a committed community of fans following and supporting the project, but what Golden Glitch didn’t anticipate was tapping into the huge community of Shakespeare fans on Tumblr*. In addition, many members of the current team contacted Golden Glitch as a direct result of the Kickstarter, offering their professional expertise to make the game happen.

“After the Kickstarter, we took on a wave of people: our composer, Adam; our sound designer, Steve; our 3D-animator, Becca; and our cinematic artist, Tati,” said Connor. And while the original core team continued to work for free, the Kickstarter funding meant they could pay their new hires. “I think a Kickstarter is something that every indie game should consider,” added Katie.

Rough and Smooth

One obvious handicap with the moonlighting model is the limited time the team can dedicate to the game. “Elsinore moves more slowly than other indie games,” affirmed Katie. “We can’t iterate as quickly, or devote time to creating. It’s really frustrating not being able to move and react as quickly as a full-time game.”

“Real life gets in the way a lot of the time. I have so little time to spend on Elsinore already, that when other things blow up, the game has to be put on the back burner,” continued Katie. “That’s just how it has to be, because it’s not making us any money right now.”

The part-time approach means that efficiency is vital to the development process, which Katie sees as a definite plus: “The upside is that we really carefully consider every single decision that goes into the game, whereas, if you’re working under a tight deadline at work, you might be rushing decisions because you just have to get it in.” The hope is that the careful deliberation about how to best use the limited resources available will result in a better game. Based on Elsinore’s reception to date, that theory appears to be accurate.

Side-by-side screenshots

Figure 5:Side-by-side screenshots showing the visual evolution of Elsinore’s dungeons.

Ultimately, the combination of Kickstarter funding, the lack of daily overheads, and moonlighting colleagues working for love makes for a creative freedom without which Elsinore may not have happened. “We don’t have a publisher, we don’t need anyone’s money, and we can work to a schedule that makes us happy,” affirmed Kate.

But while Katie, Connor, and the team naturally want to see Elsinore succeed, some of their immediate goals are more humble and symptomatic of the remote-working model. “We have not yet had the chance to all meet up in the same place, at the same time,” admitted Katie. “It’s on our bucket list.”

Levelling Up

In early 2016, the team decided to enter Elsinore in the Adventure/Role Playing category of the Intel Level Up Contest. “We’ve had our eye on the contest for a couple of years,” said Katie. “I think it’s a little more democratic than a lot of indie game festivals and submission groups. I was immediately drawn to it.”

Looking at the game from the point-of-view of the first-time players who would judge the entries was a valuable exercise for the team. “Submitting your project to a contest forces you to consider all the little things that affect how people see the game,” said Connor. “It encourages you to zero-in on what areas need touching up, that you might have been putting off.”

From that perspective, the impetus gained from entering would have been reward in itself. The contest judges, however, had other ideas. The panel, comprised of games industry luminaries including writers Chris Avellone and Anne Toole, Vlambeer’s Rami Ismail, and Double Fine’s Tim Schafer, saw fit to bestow the Best Adventure/Role Playing Game award on Elsinore. “We thought there’s no way in hell that we’ll win this thing, but we should submit anyway just to see,” said Katie. “We were very, very happy when we won.”

Intel Level Up Contest award

Figure 6:The Intel Level Up Contest award for Elsinore.

The benefits of winning went far beyond the cash prize. Following the win, Intel invited the team to demo Elsinore on the show-floor at PAX West, giving them an opportunity to put the game into the hands of hundreds of players and gather valuable feedback. “The exposure that we have gotten as a result has been incredible, and something that would never have come to us otherwise,” said Katie.

Just as important was the morale and motivational boost to the team. “This is our side project, so we don’t get a lot of the normal feedback, so the fact that we were selected was this enormous motivating push for us,” said Katie. “Motivation is basically your currency when it’s a side project, so that’s huge.”

That’s not to say the extra cash isn’t being put to good use. “It actually helped us bring team members up for PAX to demo at the Intel booths,” said Katie. “It’s also going to be really useful in getting our voice acting as top notch as it can be.”

Elsinore at PAX West

Figure 7:Katie Chironis (left), with a visitor playing Elsinore, on the Intel stand at PAX West 2016.

The benefits of entering, and ultimately winning, the contest have turned the team into committed Intel Level Up Contest advocates. “When you work on something for so long, it’s really nice to be validated,” said Connor. “The whole experience has given us another boost of momentum.” Katie added her endorsement: “I would absolutely encourage people to enter.”

The Home Straight

It’s an easy assumption to make that the members of the Elsinore team harbor dreams of quitting their day jobs, and turning Golden Glitch Studios into a full-time gig. However, that’s not the goal at all. “Honestly, I really like my day job,” said Katie. “I don’t think any of us have any plans to leave our jobs.”

In fact, they believe that working on a personal game project on the side can bring important benefits, and not only to the individual. “I personally like the setup of having a day job, and working on artsy games like Elsinore on the side,” said Connor. “It only helps our professional lives; things you learn on one project benefit the other, and it gives you an opportunity to stretch yourself in different ways.”

For this reason, Katie believes gaming companies should actively encourage their staff to develop side projects. “It has allowed us to gain skills that we never would have otherwise, and bring them back to the job for free,” she said. “I now have skills in marketing and PR, releasing a game, and showing it publicly that cost my employer nothing. It’s basically self-motivated training.”

And should the game find its audience, they expect more extra-curricular opportunities to arise. “I’d say the biggest benefit that would come with success would be having more clout and reputation to assemble and promote future side projects,” said Connor, with the clear intention of making the “moonlighting model” an ongoing feature of his working life.

Courtyard of Elsinore

Figure 8:The courtyard of Elsinore showing the game’s main interface, top left.

For now, however, Golden Glitch Studios has a game to finish. Thanks to the visibility Elsinore has gained through its Kickstarter, from the Intel Level Up Contest, and exposure at GDC and PAX shows, the game has a growing fan base. “So many people have reached out to tell us they’re connecting with it,” Katie said. “It’s become something way larger than any of us thought it would. It’s kind of wild, to tell you the truth.”

Elsinore by Golden Glitch Studios is coming to PC via Steam in 2017.

For more information about Elsinore and Golden Glitch Studios, visit https://elsinore-game.com/

For details on the Intel® Level Up Game Developer Contest and this year’s winners, go to: https://software.intel.com/sites/campaigns/levelup2016/

Elsinore is an IndieCade* Festival 2016 finalist. Read more about the festival here: http://www.indiecade.com/2016/games.

Follow Golden Glitch Studios on Twitter: https://twitter.com/goldenglitch.

Analyzing Intel® MPI applications using Intel® Advisor

$
0
0

Many of today’s HPC applications use Intel® MPI to implement their parallelism. However, using Intel’s analyzer tools in a multi-process environment can be tricky. Intel® Advisor can be very helpful to maximize your vectorization, memory and threading performance. To analyze Intel MPI applications using Intel Advisor you should follow these steps to get the best value out of your results.

 

Analyzing Intel® MPI applications using Intel® Advisor

Remote analysis flow

Collecting results using –no-auto-finalize

Generating an MPI command-line using the Intel Advisor GUI

Generating the command line for Survey or Trip Counts analyses

Generating the command line for memory access pattern analysis

Generating the command line for dependencies analysis

Viewing the collected results in the GUI

Viewing the collected results without the GUI

Conclusion

 

Remote analysis flow

  1. Collect data using the command-line on the target
    1. mpirun -n 1 -gtool"advixe-cl -collect survey –no-auto-finalize -project-dir /user/test/vec_project:0" /user/test/vec_samples/vec_samples
  2. Pack (optional) & retrieve results
    1. advixe-cl --snapshot --project-dir /user/test/vec_project --pack --cache-sources --cache-binaries -- /tmp/my_proj_snapshot
    2. Copy vec_project or my_proj_snapshot to the host
  3. View on the host in the Advisor GUI
    1. Open the project
      1. advixe-guivec_project
    2. Open Project Properties
      1. Set up search paths in Project Properties
    3. Open the results

 

Collecting results using –no-auto-finalize

On some platforms like the Intel® Xeon Phi processor result finalization may take long time. In such cases you can specify the –no-auto-finalize option so that finalization does not happen on your target but when open the results on your host. If you specify this option then the results will finalize when you open them in the GUI.

MPI command line examples

Collect survey

mpirun -n 1 -gtool "advixe-cl -collect survey –no-auto-finalize -project-dir /user/test/vec_project:0" /user/test/vec_samples/vec_samples

To run non-Intel® MPI use the –trace-mpi option as follows:

mpirun -n 1 -gtool "advixe-cl -collect survey –trace-mpi –no-auto-finalize -project-dir /user/test/vec_project:0" /user/test/vec_samples/vec_samples

Collect tripcounts

mpirun -n 1 -gtool "advixe-cl -collect tripcounts –no-auto-finalize -project-dir /user/test/vec_project:0" /user/test/vec_samples/vec_samples

Collect dependencies

Note: You need get the list of loops to analyze from either the report command or the Intel Advisor GUI.

mpirun -n 1 -gtool "advixe-cl -collect dependencies -mark-up-list=6,7,8,9,10 –no-auto-finalize -project-dir /user/test/vec_project:0" /user/test/vec_samples/vec_samples

Collect map

Note: You need get the list of loops to analyze from either the report command or the Intel Advisor GUI.

mpirun -n 1 -gtool "advixe-cl -collect map –no-auto-finalize -mark-up-list=6,7,8,9,10 -project-dir /user/test/vec_project:0" /user/test/vec_samples/vec_samples

Generating an MPI command-line using the Intel Advisor GUI

For MPI applications you need to collect your Intel Advisor results using the command-line. We make this process easy by having the Intel Advisor GUI give you the precise command-lines you need to run. There are two ways to get the command-line; the first is using the project properties.

You have the option of choosing Intel MPI or another version of MPI. You can also specify the number of ranks you would like to run.

Generating the command line for Survey or Trip Counts analyses

You can also get the command-line by clicking on command-line button , right next to the collect button as shown here. Once you have generated the command-line you would then need to cut and paste this line to a terminal window and run the command. It is sometimes helpful to specify the –no-auto-finalize option. If this option is specified then the results will finalize when you open them in the GUI.

Here is a Survey command:

Here is a Trip Counts command:

Notice the –gtool option used above. This is an Intel MPI option; it allows our analyzers to only analyze the selected group of ranks. In this case we are only analyzing rank 0. If you were to not use –gtool and specified an MPI application with 10 ranks then ten invocations of Intel Advisor would be launched.

Generating the command line for memory access pattern analysis

To analyze the memory patterns in your application, you can select the loops in the survey view.

Then click on the command-line button.

Generating the command line for dependencies analysis

To check the dependencies of your loop, you again would need to select the loops you would like to analyze and then select the command-line button.

Viewing the collected results in the GUI

Once you have collected your results, you will need to view them. The best way to do this is using the Intel Advisor GUI. If you specified the –no-auto-finalize option it is important to open your Project and then use the “Project Properties” to set the Paths to your binaries and sources. You need to do this before you open the results so we will be able to finalize them properly.

Then click on the "Survey" tab

 

Viewing the collected results without the GUI

 

You also have the option to view your Intel Advisor results without using the GUI. You can either generate a text report or a CSV report.

Text mode:

advixe-cl -report summary -project-dir ./advi -format text -report-output ./out/summary.txtadvixe-cl -report survey -project-dir ./advi -format text -report-output ./out/survey.txtadvixe-cl -report map -project-dir ./advi -format text -report-output ./out/map.txtadvixe-cl -report dependencies -project-dir ./advi -format text -report-output ./out/dependencies.txt

CSV mode:

advixe-cl -report summary -project-dir ./advi -format csv -csv-delimiter tab -report-output summary.csvadvixe-cl -report survey -project-dir ./advi -format csv -csv-delimiter tab -report-output survey.csvadvixe-cl -report map -project-dir ./advi -format csv -csv-delimiter tab -report-output map.csvadvixe-cl -report dependencies -project-dir ./advi -format csv -csv-delimiter tab -report-output dependencies.csv

Conclusion

Intel Advisor is a must-have tool for getting the most performance out of your MPI programs.

  • To obtain Advisor results for an MPI application:
  • Collect using CLI. You can generate command line from Advisor GUI. If finalization is too slow, use “-no-auto-finalize” option
  • If you collect and view results on different machines, copy the result directory. You can pack the results into archive to avoid additional configuration, if results were finalized.
  • Open the result on GUI. If the results were collected without finalization, configure search paths prior to opening the result.

 

 

What's new? Intel® SDK for OpenCL™ Applications 2016, R3

$
0
0
  • Support for 7th Generation Intel® Core™ Processors on Microsoft Windows* and Linux* operating systems
  • Windows 10 Anniversary Update support
  • Yocto Project* support
    • These processors are supported as target systems when running the Apollo Lake Yocto BSP (other OSes are not supported for these processors): 7th Generation Intel® Pentium® Processor J4000/N4000 and 7th Generation Intel® Celeron® Processor J3000/N3000 Series for Desktop
    • Offline compiler support with GPU assembly code generation
    • Debug OpenCL™ kernels using the Yocto* GPU driver on host targets (6th and 7th Generation Intel® Core Processor)
  • OpenCL™ 2.1 and SPIR-V* support on Linux* OS
    • OpenCL 2.1 development environment with the experimental CPU-only runtime for OpenCL 2.1
    • SPIR-V generation support with Intel® Code Builder for OpenCL™ offline compiler and Kernel Development Framework including textual representation of SPIR-V binaries
  • New analysis features in Kernel Development Framework for Linux* OS
    • HW counters support
    • Latency analysis on 6th and 7th Generation Intel® Core™ Processors

Sensor to Cloud: Connecting Intel® NUC to Amazon Web Services (AWS)*

$
0
0

Introduction

This paper will show you how to use an Intel® NUC to connect sensors on an Arduino 101* (branded Genuino 101* outside the U.S.) to the Amazon Web Services (AWS)* IoT service. You’ll see how to read real-time sensor data from the Arduino 101, view it locally on the Intel® NUC, and send it to AWS IoT where the data can be stored, visualized and processed in the cloud. We’ll use Node-RED* on the Intel® NUC to create processing flows to perform input, processing and output functions that drive our application.

Setup and Prerequisites:

  • Intel® NUC connected to the Internet and applicable software package updates applied
  • Arduino 101 connected to Intel® NUC through USB
  • Grove* Base Shield attached to Arduino 101 and switched to 3V3 VCC
  • Grove sensors connected to base shield: Light on A1, Rotary Encoder on A2, Button on D4, Green LED on D5, Buzzer on D6, Relay on D7
  • An active AWS cloud account and familiarity with the AWS IoT service

Read Sensors and Display Data on Intel® IoT Gateway Developer Hub

Log into the Intel® NUC’s IoT Gateway Developer Hub by web browsing to the Intel® NUC’s IP address and using gwuser as the default username and password. You’ll see basic information about the Intel® NUC including model number, version, Ethernet address, and network connectivity status.

Click the Sensors icon and then click the Program Sensors button. This will open the Node-RED canvas where you’ll see Sheet 1 with a default flow for a RH-USB sensor. We won’t be using the RH-USB sensor so you can use your mouse to drag a box around the entire flow and delete it by pressing the Delete key on your keyboard. You’ll be left with a blank canvas.

Along the left side of the Node-RED screen you’ll see a series of nodes. These are the building blocks for creating a Node-RED application on the Intel® NUC. We’ll use several nodes in this application:

Read button presses Set LED indicator on/off
Measure light level Format chart display on Intel® NUC
Measure rotary position Send data to Intel® NUC's MQTT chart listener and to AWS IoT
Control relay and buzzer   

Drag and drop nodes onto the canvas and arrange them as shown below. For some of the nodes we'll need multiple copies. Use your mouse to connect wires between the nodes as shown. We'll make the connection to AWS IoT later so only one MQTT node is needed right now.

When nodes are first placed on the canvas they are in a default state and need to be configured before they'll work. Nodes are configured by double-clicking them and setting parameters in their configuration panels.

Double-click each node on the canvas and set its parameters as shown in the table below. In some cases the Name field is left blank to use the default name of the node. Pin numbers correspond to the Grove Base Shield jack where the sensor or actuator is connected.

Node

Parameters

Grove Button

Platform: Firmata, Pin: D4, Interval (ms): 1000

Grove Light

Platform: Firmata, Pin: A1, Unit: Raw Value, Interval (ms): 1000

Grove Rotary

Platform: Firmata, Pin: A2, Unit: Absolute Raw, Interval (ms): 1000

Grove LED

Platform: Firmata, Pin: D5, Mode: Output

Grove Relay (upper)

Platform: Firmata, Pin: D7

Grove Relay (lower)

Name: Grove Buzzer, Platform: Firmata, Pin: D6 (we'll use a relay node to control the buzzer instead of using the native Grove Buzzer node)

chart tag connected to Grove Button

Title: Button, Type: StatusText

chart tag connected to Grove Light

Title: Light, Type: Gauge, Units: RAW

chart tag connected to Grove Rotary

Title: Rotary, Type: Gauge, Units: RAW

mqtt

Server: localhost:1883, Topic: /sensors, Name: Charts

Verify your settings and wiring connections, then click the Deploy button to deploy your changes and make them active on the Intel® NUC. After deploying the flow, you should see a data display towards the top of the Intel® IoT Gateway Developer Hub screen with live values for Rotary, Light and Button. Turning the rotary knob and covering the light sensor should make the numbers change up and down, and pressing the button should turn on the LED, sound the buzzer, and energize the relay.

Configure AWS* IoT and Node-RED*

  1. Log into your AWS account and navigate to the AWS IoT console.
  2. Create a new device (thing) named Intel_NUC and a Policy named PubSubToAnyTopic that allows publishing and subscribing to any MQTT topic.
  3. Create and activate a new Certificate and download the private key file, certificate file, and root CA file (available here) to your computer.
  4. Attach the Intel_NUC device and PubSubToAnyTopic policy to the new certificate.

While logged into the Intel® NUC via ssh as gwuser, create the directory /home/gwuser/awsiot and then use SFTP or SCP to copy the downloaded private key file, certificate file and root CA files from your workstation to the /home/gwuser/awsiot directory on the Intel® NUC.

Connect Intel® NUC to AWS* IoT

  1. Drag a mqtt output node onto the Node-RED canvas and then double-click it.
  2. In the Server pick list select Add new mqtt-broker… and then click the pencil icon to the right.
  3. In the Connection tab, set the Server field to your AWS IoT endpoint address which will look something like aaabbbcccddd.iot.us-east-1.amazonaws.com. You can find the endpoint address by using the AWS CLI command aws iot describe-endpoint on your workstation.
  4. Set the Port to 8883 and checkmark Enable secure (SSL/TLS) connection, then click the pencil icon to the right of Add new tls-config… In the Certificate field enter the full path and filename to your certificate file, private key file, and root CA file that you copied earlier into the /home/gwuser/awsiot directory. For example, the Certificate path might look like /home/gwuser/awsiot/1112223333-certificate.pem.crt and the Private Key path might look like /home/user/awsiot/1112223333-private.pem.key. The CA Certificate might look like /home/gwuser/awsiot/VeriSign-Class-3-Public-Primary-Certification-Authority-G5.pem.
  5. Checkmark Verify server certificate and leave Name empty.
  6. Click the Add button and then click the second Add button to return to the main MQTT out node panel.
  7. Set the Topic to nuc/arduino101, set QoS to 1, and set Retain to false.
  8. Set the Name field to AWS IoT and then click Done.

Send Data to AWS* IoT

Drag a function node onto the Node-RED canvas. Double-click to edit the node and set the Name to Format JSON. Edit the function code so it looks like this:

msg.payload = {
  source: "arduino101",
  rotary: Number(msg.payload),
  timestamp: Date.now()
  };
return msg;

Click Done to save the function changes. Draw a wire from the output of the Grove Rotary node to the input of Format JSON, and another wire from the output of Format JSON to the input of AWS IoT. These changes will convert the rotary angle measurements from the Grove Rotary sensor (connected to the Arduino 101) into a JSON object and send it to AWS IoT via MQTT. Click the Deploy button to deploy and activate the changes. The finished flow should look like this:

Back in the AWS IoT console, start the MQTT Client tool and subscribe to the topic nuc/arduino101. You should see messages arriving once a second containing rotary sensor readings. Rotate the rotary sensor and observe the values changing in near real-time.

When you're done testing this application be sure to stop your Node-RED flow (e.g. by turning off the NUC or removing the wire between Format JSON and AWS IoT and then re-deploying the flow) in order to avoid continuously sending MQTT messages to AWS IoT and consuming AWS IoT processing resources.

Where to Go From Here

This application provides the basic foundation for connecting your Arduino 101 and Intel® NUC to AWS IoT. From here you would typically wire up other sensors and send their data to AWS IoT, then build more complex applications that listen to AWS IoT messages and store, process and/or visualize the sensor data.

Improve Performance of K-Means with Intel® Data Analytics Acceleration Library

$
0
0

How do banks identify risky loan applications or credit card companies detect fraudulent credit-card transactions? How do universities monitor students’ academic performance? How do you make it easier to analyze digital images? These are just a few situations that many companies face when dealing with huge amounts of data.

To deal with risky loan or credit card problems, we can divide data into clusters of similar characteristics and look for abnormal behaviors when comparing this to other data in the same cluster. For monitoring students’ performance, school faculties can base on the students’ score range to sort them into different groups. Using a similar concept, we can partition a digital image into many segments based on a set of pixels that closely resemble each other. The idea is to simplify the representation of a digital image making it easier to identify objects and boundaries in an image.

Dividing data into clusters or sorting students’ scores into different groups can be done manually if the amount of data is not large. However, it would be impossible to do it manually if data is in the range of terabytes and petabytes. Therefore machine-learning1 approach is a good way to solve these types of problems when dealing with large amount of data.

This article discusses an unsupervised2 machine-learning algorithm called K-means3 that can be used to solve the above problems. It also describes how Intel® Data Analytics Acceleration Library (Intel® DAAL)4 help optimize this algorithm to improve the performance when running it on systems equipped with Intel® Xeon® processors.

What is Unsupervised Machine Learning?

In the case of supervised learning,5 the algorithm is exposed to a set of data in which the outcome is known so that the algorithm is trained to look for similar patterns in new data sets. In contrast, an unsupervised learning algorithm explores the data set with an unknown outcome. Further, input samples are not labeled and the system has to label them by itself. The system will scan the data and group the ones with similar characteristics/behaviors into what we call clusters. Basically, the system partitions the data set into clusters of similar characteristics and behaviors.

What is K-means?

K-means is an unsupervised machine-learning algorithm.

In order to create clusters, K-means first assigns an initial value of centroids, normally by randomly selecting it. These are the centers for the clusters. Ideally these centers should be as far apart from each other as possible. Next, take the objects in the data set and associate them to the nearest centers to form the initial clusters. Then calculate the new centroids based on the newly formed clusters. Again, re-associate the objects base on these new centroids. Keep repeating the steps of recalculating new centroids and re-associating the objects until the centroid locations are no longer changed or the algorithm goes through all the specified iterations.

The goal of the K-means algorithm is also to minimize the cost function J below. Sometimes, J is also called the objective or square-error function:

Where:

J = Square-error function

xi = Object i

cj = Centroid for cluster j

k = Number of clusters

nj= Number of objects in jth cluster

|| xi– cj || = Euclidean distance8 between xi and cj

Figures 1–5 show how the K-means algorithm works:


Figure 1. Data set layout showing the objects of the data set are all over the space.


Figure 2. Shows the initial positions of the centroids. In general, these initial positions are chosen randomly, preferably as far apart from each other as possible..


Figure 3. Shows new positions of the centroids after one iteration. Note that the two lower centroids are re-adjusted to be closer to the two lower chunks of objects


Figure 4. Shows the new positions of the centroids after many iterations. Note that the positions of the centroids don’t vary too much compared to those in Figure 3. Since the positions of the centroids are stabilized, the algorithm will stop running and consider those positions final.


Figure 5. Shows that the data set has been grouped into three separate clusters.

Applications of K-means

K-means can be used for the following:

  • Clustering analysis
  • Image segmentation in medical imaging
  • Object recognition in computer vision

Advantages and Disadvantages of K-means

The following lists some of the advantages and disadvantages of K-means.

  • Advantages
    • It’s a simple algorithm.
    • In general it’s a fast algorithm except for the worst-case scenario.
    • Work best when data sets are distinct and well separate from each other.
  • Disadvantages
    • Requires an initial value of k.
    • Cannot handle noisy data and outliers.
    • Doesn’t work with non-linear data sets.

Intel® Data Analytics Acceleration Library (Intel® DAAL)

Intel DAAL is a library consisting of many basic building blocks that are optimized for data analytics and machine learning. These basic building blocks are highly optimized for the latest features of the latest Intel® processors. More about Intel DAAL can be found at 4. The K-means algorithm is supported in Intel DAAL. In this article, we use PyDAAL, the Python* API of Intel DAAL, to invoke K-means algorithm,. To install PyDAAL, follow the instructions in 6.

Using the K-means Algorithm in Intel Data Analytics Acceleration Library

This section shows how step-by-step how to use the K-means algorithm in Python7 with Intel DAAL.

Do the following steps to invoke the K-means algorithm from Intel DAAL:

  1. Import the necessary packages using the commands from and import
    1. Import the necessary functions for loading the data by issuing the following command:
      from daal.data_management import FileDataSource, DataSourceIface
    2. Import the K-means algorithm and the initialized function ‘init’ using the following commands:
      import daal.algorithms.kmeans as kmeans
      from daal.algorithms.kmeans import init
  2. Initialize to get the data. Assume getting the data from a .csv file
    dataSet = FileDataSource(
        dataFileName,
        DataSourceIface.doAllocateNumericTable,
        DataSourceIface.doDictionaryFromContext
      )

    Where dataFileName is the name of the input .csv data file
  3. Load the data into the data set object declared above.
    dataSet.loadDataBlock()
  4. Create an algorithm object for the initialized centroids.
    init_alg = init.Batch_Float64RandomDense(nclusters)
    Where Nclusters is the number of clusters.
  5. Set input.
    init_alg.input.set(init.data, dataSet.getNumericTable())
  6. Compute the initial centroids.
    initCentroids_ = init_alg.compute().get(init.centroids)
    Where initCentroids is the initial value of centroids.
    Note: The above initCentroids value is randomly calculated using the above function, Batch_Float64RandomDense. Users can also assign a value to it.
  7. Create an algorithm object for clustering.
    cluster_alg = kmeans.Batch_Float64LloydDense(nclusters, nIterations)
  8. Set input.
    cluster_alg.input.set(kmeans.data, dataSet.getNumericTable())
    cluster_alg.input.set(kmeans.inputCentroids, initCentroids)
  9. Compute results.
    result = cluster_alg.compute()

    The results can be retrieved using the following commands:
    self.centroids_ = result.get(kmeans.centroids)
    self.assignments_ = result.get(kmeans.assignments)
    self.goalfunction_ = result.get(kmeans.goalFunction)
    self.niterations_ = result.get(kmeans.nIterations)

Conclusion

K-means is one of the simplest unsupervised machine-learning algorithms that is used to solve the clustering problem. Intel DAAL contains an optimized version of the K-means algorithm. With Intel DAAL, you don’t have to worry about whether your applications will run well on systems equipped with future generations of Intel Xeon processors. Intel DAAL will automatically take advantage of new features in new Intel Xeon processors. What you need to do is link your applications to the latest version of Intel DAAL.

References

1. Wikipedia – machine learning

2. Unsupervised learning

3. K-means clustering

4. Introduction to Intel DAAL

5. Supervised learning

6. How to install Intel’s distribution for Python

7. Python website

8. Euclidean distance


Getting Started with Intel® IoT Gateways - Python

$
0
0

This article was written for Python*. To get started using JavaScript*, see Getting Started with Intel® IoT Gateways - Python

Introduction

The Internet of Things (IoT) market is booming. Gartner forecasts that in 2016, 6.4 billion connected things will be in use worldwide, and support total services spending of $235 billion. They went on to predict that the number of connected things will reach 20.8 billion by 2020. The International Data Corporation (IDC) estimates the IoT market will reach $1.7 trillion in 2020. When it comes to connecting new and legacy systems to the Internet, there has never been a better time.

Internet of Things (IoT) solutions have a number of moving parts. At the heart of all these solutions sits the IoT gateway, providing connectivity, scalability, security, and management. This getting started guide will help you understand:

  • What an IoT gateway is.
  • How it can be used as the hub of commercial and residential IoT solutions.
  • How to choose the right gateway for you.
  • What software development tools are available.
  • How to write a “Hello World” application that will run on your gateway.

Let’s get started!

What is an IoT Gateway?

What is a Gateway For?

An IoT gateway is the heart of an IoT solution that ties all of the pieces together. On one side we have all the “things”, which can include sensors, smart devices, vehicles, industrial equipment, or anything that can be made to be “smart”, and produce data. On the other side we have network and data infrastructure, which stores and processes all the data the things produce. Gateways are the connection between the things and the network and data infrastructure; they are the glue that holds it all together.

Figure 1: A high-level overview of an IoT solution

However, gateways are so much more than just the glue; they are a solution to the connectivity challenge that all developers face. The connectivity challenge has two major needs:

  1. Robust and secure access to the Internet or Wide Area Network (WAN).
  2. Ability to support access to a multitude of devices, many of which have limited to no processing capability.

Connecting a single sensor to the Internet can get complicated and expensive. What happens when you have varying types of sensors, each with a different type of interface, and want to aggregate the data into a single interface?

Gateways help overcome these challenge by providing:

  1. Communications and connectivity
  2. Scalability
  3. Security
  4. Manageability

Communications and Connectivity

Wired and wireless connectivity are standard on many devices. Protocols you’ll find in use include Cellular 2G/3G/4G, Bluetooth*, Serial, USB, Virtual Private Network (VPN), Wi-Fi Access Point, MQ Telemetry Transport (MQTT) messaging protocol, and ZigBee*. These enable you to connect to sensors and systems using a variety of methods. With such a wide range of available protocols, you’ll be hard pressed to find a sensor or device you can’t connect to.

Scalability

Much like network routers, IoT gateways can be connected together to form even larger solutions. Whether you’re creating a home automation system with a single gateway, or have a multiacre industrial facility with new and legacy systems that need connecting, you can connect everything together into a single system.

Security

Data encryption and software lockdown are a couple of the security features you’ll find on IoT gateways. Additionally, many devices offer whitelisting, change control, secure storage, and secure boot, as well as a wide array of protocols, services, and malware protection. All of these features combine to ensure that your systems and data are kept secure at all times (a critical aspect, as the IoT continues to expand at exponential rates, becoming an even greater target for hackers and thieves).

Manageability

Manageability refers to the deployment, maintenance and management of your solutions. With the potential of complexity, simplicity in management is key. To help you’ll find web-based interfaces you can securely access to maintain the gateway itself, manage the connected sensors, and control how data flows through it. Many gateways use some form of embedded linux*, so the admin tools you know and love like ssh and scp are available.

Usage Scenarios

Commercial

In a commercial setting, a gateway can connect a series of sensors (for example: light, temperature, smoke, energy, RFID) and systems (for example: HVAC, vending, security, transportation) to control and monitoring devices such as data stores and servers to be retrieved by laptops, tablets, and smart watches.

Figure 2: An Intel example of an end-to-end commercial IoT deployment

Specific examples include:

  • Commercial trucking companies collecting GPS and loading information from their fleets. Each truck has an Internet-connected gateway which filters and relays data from the truck’s systems.
  • Construction companies monitoring the noise levels on their sites in order to comply with local noise regulations. Each site has noise and vibration sensors connected to one or more gateways which send the data to the onsite supervisors.

Residential

The most common residential application of IoT is home automation. In this scenario, a gateway helps provide a single point of control by intelligently connecting your security system, thermostat, lighting controls, smoke detector, and more. Typically, a web interface accessed from within your home or securely over the Internet provides a unified view of all these systems.

Smart meters are another example in common use today; they detect energy consumption information and send it back to the electric company as frequently as every hour, sometimes in even shorter intervals. These meters also allow for two-way communication between the meter and the electric company.

Which Gateway is Right for Me?

With many options available on the market, which is right for you? ultimately that depends mainly on two factors:

  1. The type of Internet connectivity available (wired, wireless, cellular).
  2. The types of sensors you’ll be using and the types of interfaces they have (USB, serial, Bluetooth*).

Intel has a large ecosystem of manufacturing partners which provide a variety of options. On the IoT section of the Intel® Developer Zone you’ll find two useful tools: the Solutions Directory and the Gateway Comparison Tool. Using both of these tools you’ll find solutions with the following features:

Processors

  • Single-core Intel® Quark™ SoC X1000 400 MHz processors
  • Single, dual, and quad-core Intel® Atom™ processors
  • Single, dual, and quad-core Intel® Core™ processors

Networking and Communications

  • Wi-Fi (single and multiple-radio)
  • Dual LAN
  • Bluetooth*
  • CAN bus
  • ZigBee*
  • 6LoWPAN
  • GPRS
  • 2G/3G/LTE
  • Analog and digital I/O
  • RS-232

Operating Systems

  • Wind River* linux* 7
  • Snappy Ubuntu* Core
  • Microsoft Windows® 10 IoT

This guide was written using the Advantech* UTX-3115 gateway with an OMEGA* RH USB sensor which measures temperature and relative humidity.

Industry Verticals Applying IoT Technology

We’ve seen a number of applications of IoT gateway technology in both the commercial and residential sectors, but where specifically can this technology be applied?

Here’s a partial breakdown of industries and the verticals where IoT technology is being applied:

IndustryVerticalsExample Use Cases
Public SectorCitiesCity Wi-Fi, parking, traffic
Public SafetySchools, border, law enforcement 
ManufacturingFactoriesEnergy management, security, automation
Energy and MineralsUtilitiesMobile workforce, substation and distribution automation
Oil and GasPipeline monitoring, refinery systems, secure operations 
MiningAsset visibility and monitoring, predictive maintenance 
TransportationTransportationRoadways, trains, stations
Business to Consumer (B2C)RetailRemote expert / mobile adviser, digital media store experience
Sports and EntertainmentStadium, stadium Wi-Fi, stadium vision 
SP & Machine-to-Machine (M2M)Remote tower management, fleet/asset management 
HealthcareVirtual patient observation, patient wayfinding 
Financial Services IndustryIn-branch customer experience, energy management 

Software Overview

Wind River* linux* in the Context of Python*

The operating system of the Intel® IoT Gateway is Wind River* linux*, a commercial embedded linux distribution. Because it’s linux, you can run just about anything on it, including Python*. In fact, the latest version of the Intel® IoT Gateway comes with Python 2.7.3 preinstalled. In addition, you can download updated Python version packages and other applications from the Intel Open Source Technology Center, or using the built-in IoT Gateway Developer Hub that’s running on the gateway.

MRAA / UPM

MRAA (pronounced em-rah) is a low-level library written in C. The purpose of MRAA is to abstract the details associated with accessing and manipulating the basic I/O capabilities of a platforms, into a single, concise API. MRAA serves as a translation layer on top of the linux General Purpose Input/Outputs (GPIO) facilities. Although linux provides a fairly rich infrastructure for manipulating GPIOs, and its generic instructions for handling GPIOs are fairly standard, it can be difficult to use. Having said that, you can use MRAA to communicate with both analog and digital devices. Be sure to check out the MRAA API Documentation.

To install MRAA on your gateway, download the latest version from the Intel Open Source Technology Center using curl, and then use the rpm command to install. As an example, if you’re running the current system version - 7.0.0.13 - the commands would be as follows:

>> curl -O https://download.01.org/iotgateway/rcpl13/x86_64/libmraa0-0.8.0-r0.0.corei7_64.rpm
>> rpm -ivh libmraa0-0.8.0-r0.0.corei7_64.rpm

IDEs and Text Editors

There are a number of IDE’s and text editors available on the market today. If you already have a favorite, go ahead and use that. Otherwise, below are three available options to choose from.

PyCharm* from JetBrains

Figure 3: PyCharm* from JetBrains

From the makers of IntelliJ IDEA comes PyCharm*, a fully-featured IDE for developing Python applications. PyCharm packs a ton of features, including:

  • Intelligent Python assistance (code completion)
  • Support for web development frameworks including Django*, Flask, and Google App Engine* platform
  • Integration with Jupyter Notebook
  • Ability to run, debug, test, and deploy applications on remote hosts or virtual machines
  • A wealth of built-in developer tools
  • Even more!

PyCharm comes in two flavors: a free community edition and a more fully-featured professional edition available via a subscription model.

Eclipse* and PyDev

Figure 4: Eclipse* and PyDev

The Eclipse* IDE is an open-source platform that provides an array of convenient and powerful code editing and debugging tools. PyDev is a Python IDE for Eclipse, which can be used for Python, Jython and IronPython development. like PyCharm, PyDev is a fully-featured IDE that includes:

  • Django integration
  • Code completion
  • Type hinting
  • Refactoring
  • Debugger with remote debugging capability
  • Application performance analysis using PyVmMonitor
  • Even more!

Per the PyDev website, the best way to obtain PyDev is to download and install liClipse.

Sublime Text

Figure 5: Sublime Text

If you prefer something more lightweight yet still very powerful then a text editor is the way to go. Sublime Text is one such editor. Supporting most programming languages, a handful of featured you’ll see in Sublime Text are:

  • Split window editing– edit files side by side, or edit two locations in the one file.
  • Distraction free mode– full screen, chrome-free editing, with nothing but your text in the center of the screen.
  • Instant project switch– instantly switch between projects.
  • Command Palette– search for what you want, without ever having to navigate through the menus or remember obscure key bindings.
  • Plugin API – powerful, Python-based plugin API with a built-in Python console to interactively experiment in real-time.

Although Sublime Text is not free, the $70 cost may be worth the investment.

Development Environment

There are very rich development environments built around the Intel® IoT Gateways. These include both desktop and web-based tools. In this section of the guide you’ll learn how to flash the gateway’s operating system, and then program and debug a ‘Hello World’ application using the PyCharm IDE.

These instructions will work on Windows, Mac and linux.

What You Need to Get Going

In order to begin developing on your gateway you’ll need:

  • An IoT gateway (for this guide we used the Advantech UTX-3115).
  • A USB sensor that measures temperature and relative humidity (for this guide we used the OMEGA Temperature and Humidity USB Sensor).
  • Power
  • An Ethernet cable to plug into your router (this is how the gateway will reach the Internet).
  • An IDE or text editor (for this example, we will use the PyCharm IDE).

In order to connect to the gateway itself you’ll need network connectivity. This guide assumes that the gateway is sitting on the same network as your development computer. If network connectivity is unavailable for some reason, you can connect to the gateway via a serial terminal.

Figure 6 shows the setup used in writing this guide:

Figure 6: IoT Solution Diagram

Getting Started / Hello World

Flashing the OS

In order to upgrade to the latest system version, you’ll need to flash the OS. To do so, follow the steps below:

  1. Obtain a USB drive that is at least 4 GB in size.
  2. Download the latest Gateway OS image.
  3. Unzip the image to a location of your choice on a linux host system.
  4. Open a terminal window.
  5. Use the df command to verify the device on which the usb drive is mounted. The df command shows the amount of available disk space being used by file systems.
  6. Use the following command to copy the OS image to the USB drive:
    sudo dd if= <path to recovery image file> of=/dev/sdb bs=4M; sync
  7. Unplug the USB drive from the host machine and boot the gateway from the USB drive.
  8. Log in to the gateway (root/root) and execute the following command:
    # /sbin/deploytool –d /dev/sda --reset-media -F
  9. Power off the gateway and then power it back on.

When the gateway comes back up, log in and verify that you are now running the latest version of the OS by logging in to the gateway and viewing the system version number on the dashboard.

First Time Setup

Now that you can log into the gateway, set it up by following the steps below:

XXXX is the last four digits of the MAC address of the gateway’s wireless network adapter (br-lan). You can find this MAC address by booting the gateway, and once it’s up, log in as root and type ‘ifconfig’. Get the last 4 digits from the br-lan adapter.

  1. Unpack the gateway.
  2. Plug the Ethernet cable from your router into the necessary Ethernet port. For the Advantech, use the right side (eth0) Ethernet port.
  3. Connect a VGA or HDMI monitor.
  4. Optional – connect a mouse and keyboard. (The example in this guide uses a USB hub to plug both into the Advantech. The mouse is completely optional, though a keyboard is recommended).
  5. Connect the USB Sensor to the gateway.
  6. Connect the gateway to power and press the power button.
  7. Once the gateway boots, use your development computer’s wireless network adapter to connect to the gateway’s built-in Wi-Fi using the SSID and password.
    • SSID: IDPDK-XXXX
    • Password: windriveridp
  8. Open a browser on your PC – Google Chrome is recommended – and go to http://192.168.1.1. This will open the login page of the Intel® IoT Gateway Developer Hub, a web-based interface to manage sensors and prototype with visual programming tools.
  9. Log in using the following credentials:
    • Username: gwuser
    • Password: gwuser

That’s it! You’re ready to develop.

Programming Hello World Using PyCharm

In this section we’ll create a basic “Hello World” application using PyCharm.

  1. After installing PyCharm, run it. On the splash screen select, “Create New Project”.
    Figure 7: PyCharm main menu
  2. Next, select the location of your project files and the Python interpreter you’ll be using, and click the “Create”button.
    Note: It is highly suggested to develop using the same version of Python that is installed on the gateway. By default, both Python 2.7.3 and 3.3.3 are installed on the gateway.
    Figure 8: Pycharm new project
  3. After you create your project, the project window appears. In this window, right-click the name of your project and select “New File” to create a new blank file. Name the file “hello_world.py”.
    Figure 9: Pycharm new project > new file
  4. Once the ‘hello_world.py’ file is created, add the following code and save the file:
    #!/usr/bin/env python
    # encoding: utf-8
    """The standard hello world script."""
    print "Hello World!"
  5. To ensure your Python script runs, right-click the file and select “Run ‘hello_world’”.
    Figure 10: Run “hello_world”
  6. Once the script runs you can view the output in the console that appears at the bottom of the IDE.
    Figure 11: hello_world output

Next we want to run the script on the gateway. To do that we will first copy the file from our development computer to the gateway using a secure copy (SCP) client application on the development computer.

  1. First, download and install the latest version of WinSCP. When installing it, I recommend selecting the Commander user interface style, as it allows drag-and-drop transferring of files.
    Figure 12: WinSCP Setup
  2. At the end of the installation, choose to open WinSCP.
  3. Log in to the gateway by configuring a login in WinSCP. Ensure that the file protocol you are using is ‘SCP’. Your settings will look similar to this:
    Figure 13: Configure a Login with WinSCP
  4. With the connection created, next we need a folder for the script. Click the Login button to log in to the gateway. This will connect you to the root folder on the gateway and open the folder in the right-hand pane.
  5. Next, right-click the right pane and select New > Directory.
  6. Name the directory ‘apps’.
  7. Double-click on the apps directory to open it up and create another directory named “helloworld” using the same steps. Double-click on the “helloworld” directory to open it if it isn’t already open.
  8. In the left-hand pane of the WinSCP application, navigate to the folder where you create the hello_world.py file. Drag-and-drop the file to the right-hand pane to copy the file. You should see something like this:
    Figure 14: WinSCP hello_world.py file folder
  9. With the file on your gateway, on your development computer, open a command prompt and use the ssh command to securely connect to the gateway:
    ssh root@192.168.1.4
  10. Next, change into the helloworld directory you created and use the python command to run the file:
    cd apps\helloworld
    python hello_world.py
  11. You should see the output of the script:
    Figure 15: Script output

Coding Basics

Intel provides a number of how-to articles and videos on using the IoT Gateway on the IoT section of the Intel® Developer Zone. The following videos and articles will help you get started:

Additionally, the following guides contain useful information and instructions:

Debugging Hello World with PyCharm

To debug your Hello World application, first open up the Hello World project you created in a previous step. Run it as before to ensure that everything is in working order, following the steps below:

  1. To debug the application, create a breakpoint on the line which you want debugging to start by clicking to the left of the code. When the breakpoint is created, you will see a solid red dot beside the line.
    Figure 16: hello_world.py breakpoint
  2. With the breakpoint created, click the Debug button in the top right corner (it’s the button that looks like a bug).
    Figure 17: Debugging hello_world.py
  3. PyCharm will run your Python application to the breakpoint at which the debug panel becomes available.
    Figure 18: Running hello_world.py to breakpoint
  4. The debug panel has a lot of useful information about the state of your program at which it is stopped, including all of the objects created thus far.
  5. Once you are finished with the debug panel, click the Resume Program Execution button on the left side of the debug panel, second from the top (it looks like a green arrow pointing to the right).
    Figure 19: Resume program execution of hello_world.py

Where to Go From Here

At this point, you’ve accomplished quite a bit! In this guide you’ve:

  • Learned how to select the gateway that’s appropriate for your application.
  • Discovered a number of IDE and text editor options.
  • Learned how to flash the gateway and upgrade it to the latest system version.
  • Set up the gateway for development.
  • Written a simple hello world application in Python, copied it to the gateway, ran it and debugged it.

As a next step, read and implement the lessons in the articles and videos listed in the Coding Basics section. These will show you how to pull data from a sensor, as well as publish the data you capture. Once you have the data, there are a wealth of options to both analyze and visualize the data.

Getting Started with Intel® IoT Gateways - JavaScript

$
0
0

This article was written for JavaScript*. To get started using Python*, see Getting Started with Intel® IoT Gateways - Python.

Introduction

The Internet of Things (IoT) market is booming. Gartner forecasts that in 2016, 6.4 billion connected things will be in use worldwide, and support total services spending of $235 billion. They went on to predict that the number of connected things will reach 20.8 billion by 2020. The International Data Corporation (IDC) estimates the IoT market will reach $1.7 trillion in 2020. When it comes to connecting new and legacy systems to the Internet, there has never been a better time.

Internet of Things (IoT) solutions have a number of moving parts. At the heart of all these solutions sits the IoT gateway, providing connectivity, scalability, security, and management. This getting started guide will help you understand:

  • What an IoT gateway is.
  • How it can be used as the hub of commercial and residential IoT solutions.
  • How to choose the right gateway for you.
  • What software development tools are available.
  • How to write a “Hello World” application that will run on your gateway.

Let’s get started!

What is an IoT Gateway?

What is a Gateway For?

An IoT gateway is the heart of an IoT solution that ties all of the pieces together. On one side we have all the “things”, which can include sensors, smart devices, vehicles, industrial equipment, or anything that can be made to be “smart”, and produce data. On the other side we have network and data infrastructure, which stores and processes all the data the things produce. Gateways are the connection between the things and the network and data infrastructure; they are the glue that holds it all together.

Figure 1: A high-level overview of an IoT solution

However, gateways are so much more than just the glue; they are a solution to the connectivity challenge that all developers face. The connectivity challenge has two major needs:

  • Robust and secure access to the Internet or Wide Area Network (WAN).
  • Ability to support access to a multitude of devices, many of which have limited to no processing capability.

Connecting a single sensor to the Internet can get complicated and expensive. What happens when you have varying types of sensors, each with a different type of interface, and want to aggregate the data into a single dashboard?

Gateways help overcome these challenge by providing:

  • Communications and connectivity
  • Scalability
  • Security
  • Manageability

Communications and Connectivity

Wired and wireless connectivity are standard on many devices. Protocols you’ll find in use include Cellular 2G/3G/4G, Bluetooth*, Serial, USB, Virtual Private Network (VPN), Wi-Fi Access Point, MQ Telemetry Transport (MQTT) messaging protocol, and ZigBee*. These enable you to connect to sensors and systems using a variety of methods. With such a wide range of available protocols, you’ll be hard pressed to find a sensor or device you can’t connect to.

Scalability

Much like network routers, IoT gateways can be connected together to form even larger solutions. Whether you’re creating a home automation system with a single gateway, or have a multiacre industrial facility with new and legacy systems that need connecting, you can connect everything together into a single system.

Security

Data encryption and software lockdown are a couple of the security features you’ll find on IoT gateways. Additionally, many devices offer whitelisting, change control, secure storage, and secure boot, as well as a wide array of protocols, services, and malware protection. All of these features combine to ensure that your systems and data are kept secure at all times (a critical aspect, as the IoT continues to expand at exponential rates, becoming an even greater target for hackers and thieves).

Manageability

Manageability refers to the deployment, maintenance and management of your solutions. With the potential of complexity, simplicity in management is key. To help you’ll find web-based interfaces you can securely access to maintain the gateway itself, manage the connected sensors, and control how data flows through it. Many gateways use some form of embedded Linux*, so the admin tools you know and love like ssh and scp are available.

Usage Scenarios

Commercial

In a commercial setting, a gateway can connect a series of sensors (light, temperature, smoke, energy, RFID) and systems (HVAC, vending, security, transportation) to control and monitoring devices such as data stores and servers to be retrieved by laptops, tablets and smart watches.

Figure 2: An Intel example of an end-to-end commercial IoT deployment

Specific examples include:

  • Commercial trucking companies collecting GPS and loading information from their fleets. Each truck has an Internet-connected gateway which filters and relays data from the truck’s systems.
  • Construction companies monitoring the noise levels on their sites in order to comply with local noise regulations. Each site has noise and vibration sensors connected to one or more gateways which send the data to the onsite supervisors.

Residential

The most common residential application of IoT is home automation. In this scenario, a gateway helps provide a single point of control by intelligently connecting your security system, thermostat, lighting controls, smoke detector, and more. Typically, a web interface accessed from within your home or securely over the Internet provides a unified view of all these systems.

Smart meters are another example in common use today; they detect energy consumption information and send it back to the electric company as frequently as every hour, sometimes in even shorter intervals. These meters also allow for two-way communication between the meter and the electric company.

Which Gateway is Right for Me?

With many options available on the market, which is right for you? Ultimately that depends mainly on two factors:

  1. The type of Internet connectivity available (wired, wireless, cellular).
  2. The types of sensors you’ll be using and the types of interfaces they have (USB, serial, Bluetooth*).

Intel has a large ecosystem of manufacturing partners which provide a variety of options. On the IoT section of the Intel® Developer Zone you’ll find two useful tools: the Solutions Directory and the Gateway Comparison Tool. Using both of these tools you’ll find solutions with the following features:

Processors

  • Single-core Intel® Quark™ SoC X1000 400 MHz processors
  • Single, dual, and quad-core Intel® Atom™ processors
  • Single, dual, and quad-core Intel® Core™ processors

Networking and Communications

  • Wi-Fi (single and multiple-radio)
  • Dual LAN
  • Bluetooth*
  • CAN bus
  • ZigBee*
  • 6LoWPAN
  • GPRS
  • 2G/3G/LTE
  • Analog and digital I/O
  • RS-232

Operating Systems

  • Wind River* Linux* 7
  • Snappy Ubuntu* Core
  • Microsoft Windows® 10 IoT

This guide was written using the Advantech* UTX-3115 gateway with an OMEGA* RH USB sensor which measures temperature and relative humidity.

Industry Verticals Applying IoT Technology

We’ve seen a number of applications of IoT gateway technology in both the commercial and residential sectors, however where specifically can this technology be applied?

Here’s a partial breakdown of industries and the verticals where IoT technology is being applied:

IndustryVerticalsExample Use Cases
Public SectorCitiesCity Wi-Fi, parking, traffic
Public SafetySchools, border, law enforcement
ManufacturingFactoriesEnergy management, security, automation
Energy and MineralsUtilitiesMobile workforce, substation and distribution automation
Oil and GasPipeline monitoring, refinery systems, secure operations
MiningAsset visibility and monitoring, predictive maintenance
TransportationTransportationRoadways, trains, stations
Business to Consumer (B2C)RetailRemote expert / mobile adviser, digital media store experience
Sports and EntertainmentStadium, stadium Wi-Fi, stadium vision
SP & Machine-to-Machine (M2M)Remote tower management, fleet/asset management
HealthcareVirtual patient observation, patient wayfinding
Financial Services IndustryIn-branch customer experience, energy management

Software Overview

Wind River* Linux* in the Context of Python*

The operating system of the Intel® IoT Gateway is Wind River* Linux*, a commercial embedded Linux distribution. Because it’s Linux, you can run just about anything on it, including Python*. In fact, the latest version of the Intel® IoT Gateway comes with Python 2.7.3 preinstalled. In addition, you can download updated Python version packages and other applications from the Intel Open Source Technology Center, or using the built-in IoT Gateway Developer Hub that’s running on the gateway.

MRAA / UPM

MRAA (pronounced em-rah) is a low-level library written in C. The purpose of MRAA is to abstract the details associated with accessing and manipulating the basic I/O capabilities of a platforms, into a single, concise API. MRAA serves as a translation layer on top of the Linux General Purpose Input/Outputs (GPIO) facilities. Although Linux provides a fairly rich infrastructure for manipulating GPIOs, and its generic instructions for handling GPIOs are fairly standard, it can be difficult to use. Having said that, you can use MRAA to communicate with both analog and digital devices. Be sure to check out the MRAA API Documentation.

To install MRAA on your gateway, download the latest version from the Intel Open Source Technology Center using curl, and then use the rpm command to install. As an example, if you’re running the current system version - 7.0.0.13 - the commands would be as follows:

>> curl -O https://download.01.org/iotgateway/rcpl13/x86_64/libmraa0-0.8.0-r0.0.corei7_64.rpm
>> rpm -ivh libmraa0-0.8.0-r0.0.corei7_64.rpm

IDE(s)

There are a number of IDE options available to developers - the Intel® XDK IoT Edition, Node-RED*, Wind River* Helix* App Cloud and Eclipse*. In addition, you can always ssh directly into your gateway and use vi to write your application, or scp to securely transfer your project to the gateway. If you’re just getting started, I recommend using either Node-RED or the Wind River Helix App Cloud.

Intel® XDK IoT Edition

Figure 3: Intel® XDK IoT Edition

Use the InteXDK IoT Edition with Node.js* to create web interfaces, add sensors to your project, and work with the cloud. In addition to working with your gateway, you can also program your Intel® Edison and Galileo boards.

Node-RED*

Figure 4: Node-RED flow

The official pitch for Node-RED* is that it’s a tool for “wiring together hardware devices, APIs and online services in new and interesting ways.” What it provides is browser-based flow editing built on top of Node.js*.

Wind River* Helix* App Cloud

Figure 5: Wind River* Helix* App Cloud

Once you register your gateway on the Wind River* Helix* App Cloud, Cloud9* – a web-based IDE – becomes available. The great thing about the Helix App Cloud is that you can develop your application from anywhere, and once it’s ready you can instantly run it on your device.

Development Environment

There are very rich development environments built around the Intel® IoT Gateways. These include both desktop and web-based tools. In this section of the guide you’ll learn how to flash the gateway’s operating system, and then program and debug a ‘Hello World’ application using the Intel® XDK IoT Edition (desktop) and the Wind River Helix App Cloud (web-based).

These instructions will work on both Windows and Mac.

What You Need to Get Going

In order to begin developing on your gateway you’ll need:

  • An IoT gateway (for this guide we used the Advantech UTX-3115).
  • A USB sensor that measures temperature and relative humidity (for this guide we used the OMEGA Temperature and Humidity USB Sensor).
  • Power
  • An Ethernet cable to plug into your router (this is how the gateway will reach the Internet).

In order to connect to the gateway itself you’ll need network connectivity. This guide assumes that the gateway is sitting on the same network as your development computer. If network connectivity is unavailable for some reason, you can connect to the gateway via a serial terminal.

Figure 6 shows the setup used in writing this guide:

Figure 6: IoT Solution Diagram

Getting Started / Hello World

Flashing the OS

In order to upgrade to the lastest system version, you’ll need to flash the OS. To do that, use these steps:

  1. Obtain a USB drive that is at least 4GB in size.
  2. Download the latest Gateway OS image.
  3. Unzip the image to a location of your choice on a Linux host system.
  4. Open a terminal window.
  5. Use the df command to verify the device on which the usb drive is mounted. The df command shows the amount of available disk space being used by file systems.
  6. Use the following command to copy the OS image to the USB drive:
    sudo dd if= <path to recovery image file> of=/dev/sdb bs=4M; sync
  7. Unplug the USB drive from the host machine and boot the gateway from the USB drive.
  8. Log in to the gateway (root/root) and execute the following command:
    # /sbin/deploytool –d /dev/sda --reset-media -F
  9. Power off the gateway and then power it back on.

When the gateway comes back up, log in and verify that you are now running the latest version of the OS by logging in to the gateway and viewing the system version number on the dashboard.

First Time Setup

Now that you can log into the gateway, set it up by following the steps below:

XXXX is the last four digits of the MAC address of the gateway’s wireless network adapter (br-lan). You can find this MAC address by booting the gateway, and once it’s up, log in as root and type ‘ifconfig’. Get the last 4 digits from the br-lan adapter.

  1. Unpack the gateway.
  2. Plug the Ethernet cable from your router into the necessary Ethernet port. For the Advantech, use the right side (eth0) Ethernet port.
  3. Connect a VGA or HDMI monitor.
  4. Optional – connect a mouse and keyboard. (The example in this guide uses a USB hub to plug both into the Advantech. The mouse is completely optional, though a keyboard is recommended).
  5. Connect the USB Sensor to the gateway.
  6. Connect the gateway to power and press the power button.
  7. Once the gateway boots, use your development computer’s wireless network adapter to connect to the gateway’s built-in Wi-Fi using the SSID and password.
    • SSID: IDPDK-XXXX
    • Password: windriveridp
  8. Open a browser on your PC – Google Chrome is recommended – and go to http://192.168.1.1. This will open the login page of the Intel® IoT Gateway Developer Hub, a web-based interface to manage sensors and prototype with visual programming tools.
  9. Log in using the following credentials:
    • Username: gwuser
    • Password: gwuser

That’s it! You’re ready to develop.

Programming Hello World with the XDK

In this section we’ll create a JavaScript* “Hello World” application using the Intel® XDK IoT Edition.

After installing and signing in to the XDK, click the Start a New Project button on the bottom left of the IDE. Under the Internet of Things Embedded Application section, click the Templates link, and then select Blank Template.

Figure 7: Writing “Hello World” with the XDK – Select blank template

After that, click the Continue button on the bottom right. Add a project name in the popup that opens, and then click the Create button to create your project.

Figure 8: Writing “Hello World” with the XDK – New project name and location

Once your project is open, select your gateway from IoT Device dropdown in the bottom left of the XDK. In this example, the gateway has been given an IP address of 192.168.1.9.

Figure 9: Writing “Hello World” with the XDK – Select your gateway

Note: In order for the XDK to automatically find your gateway, your development computer must be on the same subnet. If you have connected to the gateway using its built-in wireless router (as we did above), then you are on the same subnet as the gateway. If your computer is not on the same subnet, but you can ping the IP address of the gateway - for example, if your gateway is plugged in to your network using a network cable -  you can use the Add Manual Connection option from the dropdown to manually connect to your device.

Next, in the editor, type the following code on line 5:
console.log(“Hello World! This is the Intel XDK”); Your editor window should look like this:

Figure 10: Writing “Hello World” with the XDK – Editor window

Save your changes by selecting File > Save.

With your application created, you need to upload the project to the gateway. To do so, click the Upload button, which is a downward facing arrow.

Figure 11: Writing “Hello World” with the XDK – Uploading the project to the gateway

Now that your application is on the gateway, you can run it. To do so, clicking the Run button. The run button has a green circle with a white arrow in it. This will run your application.

Figure 12: Writing “Hello World” with the XDK – Run the application

When the application runs you will see the output on the console.

Figure 13: Writing “Hello World” with the XDK – Console output

Programming Hello World Using Wind River® Helix™ App Cloud

In this section we’ll create a JavaScript “Hello World” application using the Wind River Helix App Cloud.

The first thing you need to do is create an account on App Cloud and register your device. To do that, login to your gateway, click the Administration image just under the dashboard, and under the Quick Tools section, click the Launch button underneath the App Cloud image. Follow the directions there to register your gateway.

Note: The unique ID the gateway creates expires after 20 minutes, so you’ll want to verify your email address and log back in within that time period. If you miss your window, you can generate a new code and register at that point.

Once logged into the App Cloud, click the Create new project button under the Application Projects section. On the popup that appears, enter a project name and select the JavaScript Hello World template.

Figure 14: Writing “Hello World” with Wind River Helix – Create a new project

Hit the OK button to create your project. Once created, click the Open button to open it in the Cloud9 editor. Once the editor opens, click the hello.js file in the workspace tab.

If you want, change the text that will show up on the console. I updated the text to say, “Hello World. This is the Cloud9 IDE!”. Save your changes by going clicking File > Save. Your project is now ready to run! To do so, click the green Run button. The application is downloaded to your gateway and run by Node.js. We can see in the console on the bottom part of the editor that our project did indeed run on the gateway.

Figure 15: Writing “Hello World” with Wind River Helix – Running “Hello World”

To deploy this application to your gateway:

  • In the Cloud9 editor, download the project by selecting File -> Download Project
  • Scp the compressed file to your gateway. In my case the command was:
    scp ~/Downloads/HelloWorldTestOne.tar.gz root@192.168.1.4:/users/robertonrails
  • Use the tar command to uncompress the project.
    tar -zxvf HelloWorldTestOne.tar
  • Use node to run hello.js without the debugger.
    node --nodead_code_elimination --nolazy --nocrankshaft ./HelloWorldTestOne/hello.js

Coding Basics

Intel provides a number of how-to articles and videos on using the IoT Gateway on the IoT section of the Intel Developer Zone. The following videos and articles will help you get started:

Additionally, the following guides contain useful information and instructions:

Debugging Hello World with the XDK

To debug your application using the XDK, first open up the Hello World application you created in a previous step. Re-upload the application to the gateway and run it to ensure that everything is working well.

To debug the application, click the Debug button. The debug button is an image of a bug with a green arrow on it.

Figure 16: Debugging “Hello World” with the XDK

After you click the button, the debugger window will open.

Figure 17: Debugging “Hello World” with the XDK – Application state

You can use this window to see the current state of the application including all local variables and the call stack.

To create a breakpoint, select the desired line. You will then see the breakpoint you’ve created in the Breakpoints section on the left of the debugger window.

Figure 18: Debugging “Hello World” with the XDK – Creating a breakpoint

When you run the debugger the application will stop at this point and you can debug your application.

Debugging Hello World with the Wind River Helix App Cloud

Let’s debug our Hello World application.

To do so, the first thing we need to do is open our Hello World application. Next, open hello.js. After that, click the space to the left of our one line of code. This should add a red dot beside line 25. To debug the app, click the green Run button. The application will automatically stop and the debug panel will open on the right hand side of the editor.

Figure 19: Debugging “Hello World” with the Wind River Helix

In the image above the debugger area is expanded so we can see more of what’s going on. From here we can browse the current state of our application at the breakpoint we specified, including all local variables and the call stack. If we wanted to, we could also enter watch expressions.

To resume the running of our application, either click the green arrow at the top of the debug window or hit F8 on your keyboard. The program will then resume and we’ll see our familiar message printed to the console.

Where to Go From Here

In this guide you’ve accomplished quite a bit:

  • Learned how to select the gateway that’s appropriate for your application.
  • Discovered a number of IDE and text editor options.
  • Learned how to flash the gateway and upgrade it to the latest system version.
  • Set up your gateway for development.
  • Written a simple hello world application in JavaScript, deployed it to the gateway, ran it and debugged it.

As a next step, read and implement the lessons in the papers listed in the Coding Basics section . These papers will show you how to connect sensor output to cloud databases, as well as saving a copy of the gateway’s operating system and deploying it to additional gateways.

Fluid Simulation for Video Games (Part 21)

$
0
0

Download Article

Download Fluid Simulation for Video Games (Part 21) [PDF 830KB]

Recapitulation

We want games to be fun and look pretty and plausible.

Fluid simulation can augment game mechanics and enhance the aesthetics and realism of video games. Video games demand high performance on a low budget but not great accuracy. By low budget, I mean both computational and human resources: the game has to run fast, and it can’t take a lot of developer or artist time. There are many ways to simulate fluids. In this series, I explain methods well suited to video games: cheap, pretty, and easily written.

If you want to simulate fluids in video games, you have to overcome many challenges. Fluid mechanics is a complicated topic soaked in mathematics that can take a lot of time to understand. It’s also numerically challenging—naïve implementations are unstable or just behave wrong—and because fluids span every point in space, simulating them costs a lot of computational resources, both processing and memory. (Although fluid simulations are well suited to running on a graphics processing unit [GPU], in video games, the GPU tends to be busy with rendering.) The easiest and most obvious way to improve numerical stability—use more and smaller time steps—adds drastically more computational cost, so other techniques tend to be employed that effectively increase the viscosity of the fluid, which means that in-game fluids tend to look thick and goopy. The most popular techniques, like smoothed particle hydrodynamics, aren’t well suited to delicate, wispy motions like smoke and flame. A simulation approach that could meet these challenges would help add more varieties of fluids, including flames and smoke, to video games.

To meet these challenges, I presented a fluid simulation technique suited to simulating fine, wispy motion and that builds on a particle system paradigm found in any complete three-dimensional (3D) game engine. It can use as many CPU threads as are available—more threads will permit more sophisticated effects.

This approach has many synergies with game development, including the following:

  • Game engines support particle systems and physics simulations.
  • CPUs often have unused cores.
  • Fluid simulation readily parallelizes.

The approach I present uses the vortex particle method (VPM), an unusual technique that yields the following benefits:

  • It’s a particle-based method that can reuse an existing particle engine.
  • Vortex simulations are well suited to delicate, wispy motion like smoke and flame.
  • The simulation algorithm is numerically stable, even without viscosity, either explicit or implicit.

This series explains the math and the numerics. I presented variations on the theme of particle-based fluid simulation and included a model of thermal convection and combustion so that the system can also model flames. I showed two numerical approaches—integral and differential—compared their relative merits, and presented a hybrid approach that exploits the benefits of each approach while avoiding their pitfalls. The result is a fast (linear in the number of particles) and smooth fluid simulation capable of simulating wispy fluids like flames and smoke.

Despite its apparent success in certain scenarios, the VPM has significant limitations in other scenarios. For example, it has difficulty representing interfaces between liquids and gases, such as the surface of a pool of water. I took a brief detour into smoothed particle hydrodynamics (SPH) to explore one way you could join VPM and SPH in a common hybrid framework, but (to phrase it generously) I left a lot of room for improvement.

This series of articles leaves several avenues unexplored. I conclude this article with a list of ideas that I encourage you to explore and share with the community.

Part 1 and part 2 summarized fluid dynamics and simulation techniques. Part 3 and part 4 presented a vortex-particle fluid simulation with two-way fluid–body interactions that run in real time. Part 5 profiled and optimized that simulation code. Part 6 described a differential method for computing velocity from vorticity. Part 7 showed how to integrate a fluid simulation into a typical particle system. Part 8, part 9, part 10, and part 11 explained how to simulate density, buoyancy, heat, and combustion in a vortex-based fluid simulation. Part 12 explained how improper sampling caused unwanted jerky motion and described how to mitigate it. Part 13 added convex polytopes and lift-like forces. Part 14, part 15, part 16, part 17, and part 18 added containers, SPH, liquids, and fluid surfaces. Part 19 provided details on how to use a treecode algorithm to integrate vorticity to compute vector potential.

Fluid Mechanics

With the practical experience of having built multiple fluid simulations behind us, I now synopsize the mathematical and physical principles behind those simulations. Fluid simulation entails running numerical algorithms to solve a system of equations simultaneously. Each equation governs a different aspect of the physical behaviors of a fluid.

Momentum

The momentum equation (one version of which is the famous Navier-Stokes equation) describes how momentum evolves and how mass moves. This is a nonlinear equation, and the nonlinearity is what makes fluids so challenging and interesting.

Vorticity is the curl of momentum. The vorticity equation describes where fluid swirls—where it moves in an “interesting” way. Because vorticity is a derivative of momentum, solving the vorticity equation is tantamount to solving the momentum equation. This series of articles exploits that connection and focuses numerical effort only where the fluid has vorticity, which is usually much sparser than where it has momentum. The vorticity equation also implicitly discards divergence in fluids—the part that relates to the compressibility of fluids. Correctly dealing with compressibility requires more computational resources or more delicate numerical machinations, but in the vast majority of scenarios pertinent to video games, you can neglect compressibility. So the vorticity equation also yields a way to circumvent the compressibility problem.

Advection describes how particles move. Both the momentum equation and the vorticity equation have an advective term. It’s the nonlinear term, so it’s responsible both for the most interesting aspects of fluid motion and the most challenging mathematical and numerical issues. Using a particle-based method lets us separate out the advective term and handle it by simply moving particles around according to a velocity field. This makes it possible—easy, in fact—to incorporate the VPM into a particle system. It also lets the particle system reuse the velocity field both for the “vortex particles” the fluid simulation uses and for propagating the “tracer” particles used for rendering visual effects.

The buoyancy term of the momentum and vorticity equations describes how gravity, pressure, and density induce torque. This effect underlies how hot fluids rise and so is crucial for simulating the rising motion of flames and smoke. Note that the VPM simulation technique in this series did not model pressure gradients explicitly but instead assumed that pressure gradients lie entirely along the gravity direction. This supposition let the fluid simulate buoyancy despite not having to model pressure as its own separate field. To model pressure gradients correctly, you must typically model compressibility, which, as mentioned elsewhere, usually costs a lot of computational resources. So by making the simplifying assumption that the pressure gradient always lies along the gravity direction, you see a drastic computational savings. Computing density gradients require knowing the relationship between adjacent particles. In this series, I presented two ways to solve this: a grid-based approach and a particle-based approach. The grid-based approach directly employs a spatial partitioning scheme that is also used in computing viscosity effects. The particle-based approach uses a subset of the algorithms that SPH uses. Both can yield satisfactory results, so the decision comes down to which approach costs less.

The stress and strain terms in the momentum and vorticity equations describe how pressure and shears induce motion within a fluid. This is where viscosity enters the simulation. Varying the magnitude and form of viscosity permits the simulation to model fluids ranging from delicate, wispy stuff like smoke or thick, goopy stuff like oil or mucous. The fluid simulation in this series used the particle strength exchange (PSE) technique to exchange momentum between nearby particles. This technique requires that the simulation keep track of which particles are near which others—effectively, knowing their nearest neighbors. I presented a simplistic approach that used a uniform grid spatial partition, but others could work, and this is one of the avenues I encourage you to explore further.

The stretch and tilt terms of the vorticity equation describe how vortices interact with each other over distance as a result of configuration. This is strictly a 3D effect, and it leads to turbulent motion. Without this effect, fluids would behave in a much less interesting way. The algorithms I presented compute stretch and tilt using finite differences, but others could work. At the end of this article, I mention an interesting side effect of this computation that you could use to model surface tension.

Conservation of Mass

The continuity equation states that the change in the mass of a volume equals inflow/outflow of mass through volume surfaces. As described earlier, the simulation technique in this series dodged solving that equation explicitly by imposing that the fluid is incompressible.

Equation of State

The equation of state describes how a fluid expands and contracts (and therefore changes density) as a result of heat. Coupled with the buoyancy term in the momentum equation, the equation of state permitted the algorithm to simulate the intuitive behavior that “hot air rises, and cold air sinks.”

Combustion

The Arrhenius equation describes how components of fluid transform: fuel to plasma to exhaust. It also describes how fluid heats up, which feeds into the equation of state to model how the fluid density changes with temperature, hence, causing hot air to rise.

Drag

Drag describes how fluids interact with solid objects. I presented an approach that builds on the PSE approach used to model viscosity: I treat fluid particles and solid objects in a similar paradigm. I extended the process to exchange heat, too, so that solid objects can heat or cool fluids and vice versa.

Spatial Discretization

Fluid equations operate on a continuous temporal and spatial domain, but simulating them on a computer requires discretizing the equations in both time and space. You can discretize space into regions, and those regions can either move (for example, with particles) or not (for example, with a fixed grid).

As its name suggests, the VPM is a particle-based method rather than a grid-based method. The algorithm I presented, however, also uses a uniform grid spatial partition to help answer queries about spatial relationships, such as knowing which particles are near which others or which particles are near solid objects interacting with the fluid. Many spatial partitions are available and within each implementation are possible. For this article series, I chose something reasonably simple and reasonably fast, but I suspect that it could be improved dramatically, so I provide some ideas you can try at the end of this article.

Note: Other discretizations are possible—for example, in a spectral domain. I mention this in passing so that curious readers know about other possibilities, but for the sake of brevity I omit details.

Vortex Particle Method

In this series, I predominantly employed the VPM for modeling fluid motion, but even within that method, you have many choices for how you implement various aspects of the numerical solver. Ultimately, the computer needs to obtain velocity from vorticity, and there are two mathematical approaches to doing so: integral and differential. Each of those mathematical approaches can be solved through multiple numerical algorithms.

The integral techniques I presented are direct summation and treecode. Direct summation has asymptotic time complexity O(N2), which is the slowest of those presented but also the simplest to implement. Treecode has asymptotic time complexity O(N log N), which is between the slowest and fastest, and has substantially more code complexity than direct summation, but that complexity is worth the speed advantage. Besides those techniques, other options are possible that I did not cover. For example, multipole methods have asymptotically low computational complexity order but mathematically and numerically require much greater complexity.

The differential technique I presented entails solving a vector Poisson equation. Among the techniques I presented, this has the fastest asymptotic run time, and the math and code are not very complex. Based on that description, it seems like the obvious choice, but there is a catch that- involves boundary conditions.

Solving any partial differential equation entails imposing boundary conditions: solving the equations at the spatial bounds of the domain. For integral techniques, the simplest conditions are “open,” which is tantamount to having an infinite domain without walls. The simulation algorithm handles solid objects, including walls and floors, which should suffice to impose boundary conditions appropriate to whatever scene geometry interacts with the fluid, so imposing additional boundary conditions would be redundant.

The Poisson solver I presented uses a rectangular box with a uniform grid. It’s relatively easy to impose “no-slip” or “no-through” boundary conditions on the box, but then the fluid would move as though it were inside a box. You could move the domain boundaries far from the interesting part of the fluid motion, but because the box has a uniform grid, most of the grid cells would have nothing interesting in them yet would cost both memory and compute cycles. So ideally you’d have a Poisson solver that supports open boundary conditions, which is tantamount to knowing the solution at the boundaries, but the Poisson solver is meant to obtain the solution and so is a cyclic dependency.

To solve this problem, I used the integral technique to compute a solution at the domain boundaries (a two-dimensional surface), and then used the Poisson solver to compute a solution throughout the domain interior. This hybrid approach runs in O(N) time (faster than treecode) and looks better than the treecode solver results.

Assessment

The VPM works well for fire and smoke but does not work for liquid–gas boundaries. SPH works well for liquid–gas boundaries but looks viscous. My attempt to merge them didn’t work well, but I still suspect the approach has merit.

Further Possibilities

The techniques and code I presented in this series provide examples and a starting point for a fluid simulation for video games. To turn these examples into viable production code would require further refinements to both the simulation and the rendering code.

Simulation

Improvements to VPM

I implemented a simplistic uniform grid spatial partitioning scheme. A lot of time is spent performing queries on that data structure. You could optimize or replace it, for example, with a spatial hash. Also, you could switch the per-cell container to a much more lightweight container.

Although difficult, it’s possible to model those liquid–gas boundaries in the VPM. You could track surfaces by using level-sets, surface geometry to compute curvature, or curvature to compute surface tension and incorporate those effects into the vorticity equation. Computing curvature entails computing the Hessian, which is related to Jacobian, which is already used to compute strain and stress.

The VPM has a glaring mathematical problem: It starts with a bunch of small particles that carry vorticity in a very small region—so small it’s tempting to think of them as points. Vorticity mathematically resembles a magnetic field, and you could draw an analogy between these vortex particles and tiny magnets. These magnets, however, would have only a single “pole,” which is both mathematically and physically impossible. Likewise, there is no such thing as a vortex “point.” If you had only one vortex point, it would be possible for a vortex field to have divergence, and this is neither mathematically possible nor physically meaningful. And yet, this simulation technique has exactly this problem. One way to solve the problem is to use vortex filaments—for example, topologically forming loops. The vortex loops, being closed, would have no net divergence. (See, for example, “Simulation of Smoke Based on Vortex Filament Primitives” by Angelidis and Neyret.) The filaments could also terminate at fluid boundaries, such as at the interfaces with solid objects. The most obvious example of that would be a rotating body: Effectively, the body has a vorticity and so vortex lines should pass through the body.

Note: The article “Filament-Based Smoke with Vortex Shedding and Variational Reconnection” as presented at SIGGRAPH 2010 got that wrong: The authors had rotating bodies within a fluid, but their vortex filaments did not pass through those bodies. They seem to have corrected that error in subsequent publications, and the YouTube* videos that had the error are no longer visible.

Other Techniques

Because SPH is also a fluid simulation technique that uses particles, my intuition is that it should complement the VPM so that some hybrid could work for both wispy, and liquid or goopy fluids. I would not call my attempt successful, but I hope it inspires future ideas to unify those approaches. Even though my implementation failed, I suspect that the basic idea could still be made to work.

This article series did not cover them, but grid-based methods work well in specialized cases, such as where potential flow is important, and for shallow-water waves. Similarly, spectral methods are capable of tremendous accuracy, but that is exactly what video games can forsake.

Rendering

In the code that accompanies these articles, most of the processing time goes toward rendering rather than simulation. That’s good news because the simplistic rendering in the sample code doesn’t exploit modern GPUs and so there’s plenty of opportunity to speed that up.

The sample code performs several per-vertex operations, such as computing camera-facing quadrilaterals. That code is embarrassingly parallel, so a programmable vertex shader could execute it on the GPU quickly because the GPU has hundreds or thousands of processing units.

It turns out, though, that adding more CPU cores to those routines that operate on each vertex doesn’t yield a linear speed-up, which suggests that memory bandwidth limits processing speed. Effectively, to speed up processing, the machine would need to access less memory. Again, a solution is readily available: Inside the vertex buffer, instead of storing an element per triangle vertex, store only a single element per particle. It could even be possible to transmit a copy of the particle buffer as is. Because you can control how the vertex shader accesses memory, that vertex buffer can be in any format you like, including the one the particle buffer has. This implies using less memory bandwidth.

Note that the GPU would likely still need a separate copy of the particle buffer, even if its contents were identical to the particle buffer the CPU used. The reason is that those processors run asynchronously, so if they shared a buffer, it would be possible for the CPU to modify a particle buffer in the middle of the GPU accessing that data, which could result in inconsistent rendering artifacts. In that case, it might be prudent to duplicate the particle buffer. (Perhaps a direct memory access engine could make that copy, leaving the CPU unencumbered.) In contrast, the visual artifacts of rendering the shared particle buffer might be so small and infrequent that the user might not notice. It’s worth trying several variations to find a good compromise between speed and visual quality.

For the fluid simulation to look like a continuous, dense fluid instead of a sparse collection of dots, the sample code uses a lot of tracer particles—tens of thousands, in fact. Arguably, it would look even better if it had millions of particles, but processing and rendering are computationally expensive—both in time and memory. If you used fewer particles of the same size, the rendering would leave gaps. If you increased the particle size, the gaps would close but the fluid would look less wispy—that is, unless the particles grew only along the direction that smaller particles would appear. There are at least three ways to approach this problem:

  1. Use volumetric rendering instead of particle rendering. Doing so would involve computing volumetric textures and rendering them with fewer, larger camera-facing quads that access the volumetric texture; the results can look amazing.
  2. Elongate tracer particles in the direction they stretch. One way to do that is to consider tracers as pairs, where they are initialized near each other and are rendered as two ends of a capsule instead of treating every particle as an individual blob. You could even couple this with a shader that tracks the previous and current camera transform and introduce a simplistic but effective motion blur; the mathematics are similar for both.
  3. Expanding on the idea in option 2, use even more tracers connected in streaks. For example, you could emit tracer particles in sets of four (or some N of your choice) and render those as a ribbon. Note, however, that rendering ribbons can be tricky if the particle cluster “kinks”; it can lead to segments of the ribbon folding such that it has zero area in screen space.

About the Author

Dr. Michael J. Gourlay works at Microsoft as a principal development lead on HoloLens* in the Environment Understanding group. He led the teams that implemented tracking, surface reconstruction, and calibration. He previously worked at Electronic Arts (EA Sports) as the software architect for the Football Sports Business Unit, as a senior lead engineer on Madden NFL* and original architect of FranTk* (the engine behind Connected Careers mode), on character physics and ANT* (the procedural animation system used by EA), on Mixed Martial Arts*, and as a lead programmer on NASCAR*. He wrote Lynx* (the visual effects system used in EA games worldwide) and patented algorithms for interactive, high-bandwidth online applications.

He also developed curricula for and taught at the University of Central Florida, Florida Interactive Entertainment Academy, a top-rated interdisciplinary graduate program that teaches programmers, producers, and artists how to make video games and training simulations.

Prior to joining EA, he performed scientific research using computational fluid dynamics and the world’s largest massively parallel supercomputers. Michael received his degrees in physics and philosophy from Georgia Tech and the University of Colorado at Boulder.

How to install Windows 10 IoT Core on Intel Joule

$
0
0

During the last Intel® IDF in San Francisco, the Intel Joule board was presented supporting 3 different OS BSP: Ostro, Ubuntu and Windows 10 IoT Core.

For the first two OS the images was published at IDF time. For Windows 10 IoT Core the public image and support has published in mid October.

As all the other Windows 10 IoT Core images for other supported boards, the distribution is located in an unique site:

www.WindowsOnDevices.com .

I'll try to graphically describe the step by step procedure that Microsoft publish to prepare and flash the board.

The previous link show the following page:

 

Lessons from the “Other” Side: Duskers and the Intel® Level Up Contest

$
0
0

Download [PDF 1.77 MB]

One of the greatest strengths in the independent game-development industry is the universal belief in trying something radically different. When they succeed, "indie" games don’t just tweak the edges—they blow up the boundaries, and go where their vision takes them, no matter what. So when indie game-developer Misfits Attic learned its game Duskers was the clear winner of the "Other" category in the 2016 Intel® Level Up Contest, company co-founders Tim and Holly Keenan felt elated and vindicated in equal measure.

“Maybe it sounds weird,” Tim admitted, “but I was almost more proud of being in the ‘Other’ category than anything else. Winning in that category was really special for me.”

Unlike many developers that face a long divide between submitting their game to a contest, and then taking it live, Tim was able to launch Duskers right after submitting it to the Intel® Level Up Contest judges, because it was already far enough along to get into production. But that wasn’t the only thing different about his own unique developer’s journey. While many of the contest entrants use a touch-screen for interaction, Duskers relies on the old command-line interface (CLI). Many of the winning games from this year’s competition feature lush, colorful landscapes, with soothing, bright colors; but Duskers is dark and bleak, befitting a game that takes place on derelict spaceships drifting in the cosmos. And where most commercial titles offer catchy, engaging music, Duskers relies on mysterious clanking and groaning noises to capture an eerie feeling of being alone and vulnerable.


Figure 1:Limited visibility and lack of resources make exploration dangerous for the drones.

You might be thinking that there’s no way a game like that could even get funded—how would you even pitch such a title? “I almost designed this game so I couldn’t pitch it,” Tim laughingly admitted. He believes that’s the beauty of indie gaming in a nutshell—it’s a game that you can’t easily explain, you can’t easily franchise, you won’t be exploring movie rights, and it won’t work on a console or mobile device. It’s just a great game that stays true to itself all the way through.

Despite the complex backstory, the premise is fairly simple. Your job is to pilot a small group of drones as they remotely explore abandoned spaceships. Through typed-in commands you can power up, acquire scrap metal, fire off sensors, and go about your job. There are unseen enemies inhabiting the vessels, and you can’t fight them—you have to lock them in rooms or send them out an airlock. Players are completely alone—there are no other humans to interact with, and the drones have limited light to play across the landscape. Plus, the laws of physics apply—things deteriorate and run out of power. There is a strong feeling of isolation, of helplessness, of anxiety—and it’s all according to plan.


Figure 2:Players can pull up an overview of the sector they are exploring.

Misfits Attic Background Reveals “Other” Tendencies

Tim Keenan graduated from Georgia Tech with a bachelor’s degree in computer science, but his heart has always been in computer graphics. “I knew at a young age that I wanted to do video games,” he recalled. “I thought computer graphics were super cool.”

He quickly landed at Rainbow Studios*, then after a couple of years he moved on to DreamWorks Animation SKG*, where he worked on several films. His jobs ran the gamut between art and science—working on effects systems to create lush foliage in Madagascar, and creating beautiful fire for How to Train Your Dragon, among other tasks. Tim also took classes in screenwriting, did some improv comedy, and tried a little acting and directing. He credits that diverse background with giving him a better perspective on the creative process that goes into producing a title.

His wife Holly is the other half of Misfits Attic. She has parlayed her fine-arts background and graphic design degree into UX and interaction design, which is her day job. Tim and Holly co-founded Misfits Attic in 2011, and their first game, A Virus Named TOM, did well enough to keep the lights on. It’s a quirky action-puzzle game with a co-op mode, “like trying to defuse bombs while people throw potatoes at you,” Tim said.


Figure 3:The glowing red colors against a dark black background give battle sequences a special graphical appeal.

That limited success led Tim to create Duskers. Holly was working full time, and stayed away from this new project. Tim had already noodled around with an idea for a game that would have as its core design-pillar that it was as close to a real experience as he could get. “I really wanted you to feel like you were actually there, and you were actually doing this thing,” he said. The design decisions that followed were giving him fits, but once he settled on the way to play the game, he felt freed up to pursue his concept. “Once I created this idea that you were a drone operator, all of the next decisions started to fall into place.”

Duskers has sometimes been described as “roguelike” due to its role-playing aspect. The 1980 game Rogue is often credited with spawning an entire subgenre of role-playing games where players explore a dungeon or labyrinth. Tim says his inspiration came from there, but also from the movies The Road and Alien, and especially the game Capsule by Adam Saltsman and Robin Arnott. “Capsule did a lot with audio, and their sound design really made the game feel visceral and real,” he explained. “That really inspired me.”

Going Against the Grain with a CLI

Being part of the developer community, Tim got plenty of advice suggesting changes. He was told to put people in the game, because players would care more if avatars died. Friends suggested he go in the direction of a real-time strategy game, with the familiar “drag, select, right-click” model. But he stuck to his vision and kept going. “I didn’t want you to be playing the drone operator—I wanted you to feel like you were the drone operator.”

The CLI gave the game a retro feel that definitely attracted debate. “My friends in the Bay Area—game designers who were very talented—would tell me, ‘I get it, but users aren’t going to get it,’ ” he recalled. “Maybe I was just being stubborn, but the more people told me to take it out, the more I wanted to keep the CLI in.” His feeling after that was almost liberating. If he’d given up a certain market-share, why not just keep pushing as hard as he could to realize the complete vision in order to make it worth the sacrifice?

Figure 4:Players receive instruction through a dense, informative interface.

The result is an amazing game that draws you in slowly. Your drones can power up by discovering generators, and they gather scrap as they find it, if you tell them to. There are unseen aliens out there, which your sensors can pick up, and once they find you, they will destroy you. At first commands don’t come quickly to mind, and the reference manual is required reading. But at some point, after playing awhile, the commands you need start to pour automatically out of your fingers, and you can string them together with efficiency. That’s when the game clicks. It’s a feeling you’d never get in a Triple-A title, but that sense of accomplishment makes Duskers a classic indie game.

Building the Game

For their first title, Misfits Attic chose Microsoft Xbox New Architecture* (Microsoft XNA*) for a game engine. Released in 2004 as a set of tools with a managed runtime environment, it was eventually superseded by the Microsoft Windows* Phone 7 Developer Tools in 2010. So Misfits Attic knew they needed a new engine for Duskers. The team (Tim, plus another programmer) also had experience with C#, which was compatible with Unity*, so Unity became the choice for a new engine. “There was a large, strong development community behind Unity, and we knew we could do cross-platform work easier. But it was a pain learning a new tool. Every game I work on, I have to work with new technology. It seems so rare that I can just reuse something.”

By not writing his own game engine, Tim was free to push his own creativity. “As an indie, what I have to contribute is my design. I feel like I never end up pushing technology in any of my games, because I only have a limited amount of time to develop something. The existing technologies give me so much space to play in, that if I can’t work within those constraints, it’s not good. I want to spend the time iterating on the game design.”

Unity also provided a path to port from the PC to the iOS* for Mac*, and a Linux* version. Tim came up against a few technical hurdles, especially with the interface. He knew he needed a good menu system, for example. Typically, games would use text boxes, but, for Duskers, classic text boxes didn’t seem to work, because they would drop letters when players were typing frantically to get commands started. The autocomplete function didn’t work right, either. Tim and his co-worker studied other games and, because they weren’t typical game designers, they figured they would just have to build the text function from scratch. They came up with their own, hand-built system with menu buttons, with the first character in brackets, so players could open a menu with that letter.

The AI that drives the game turned out to be quite simple. “We had always intended to make everything a little bit smarter and a little more intelligent,” Tim said, but as the game construction went on, it just didn’t matter—the AI didn’t need to be that smart. For example, Tim doesn’t mind that the drones can periodically get hung up on a doorway. “It’s annoying, but it reminds you that they are just stupid little drones, and, to me, that made it so much more real,” he said. So he stopped trying to make the pathfinding perfect. To some users, that might be a show-stopper for a mass-market game. But for a leader in the “Other” category, it all made sense.

Ready to Publish

Raising money for a unique, independent project was never easy. Tim laughs as he recalls the pitch he’d make to producers for funding. “Okay, so there’s a command line,” he’d say to start.

“So, no mobile offerings, no console ports…?” the audience would respond, not altogether positively.

“Right,” Tim would say. “And it’s about feeling completely isolated, and it’s going to be hard to see things, and there’s not going to be any soundtrack, and no humans.”

That may be intimidating to explain to a room full of experienced Triple-A game-producers, but it was fine for the Intel Level Up Contest. Tim had assumed that the contest was limited to touch-control games, but he found out that touch controls were only a “nice to have” feature. He had picked up some new Intel® hardware at a Steam* Development Days event, and he felt like he should return the favor and enter. But he had no idea what to expect.


Figure 5: Duskers gives players a strong feeling of isolation, helplessness, and anxiety, thanks to screen-play dominated by black voids and a stark, almost random soundtrack. Conquering the game gives players a huge sense of satisfaction.

“When we found out about our award in the ‘Best Other’ category, I tweeted out about it right away. My friends started joking around, saying ‘Oh, you made that Other game.’ But I really dug it.”

Conclusion

By staying with his vision and producing a game that defies easy description, Tim Keenan stayed true to his indie roots. Funding has been a challenge every step of the way, but he’s explored every alternative he could find and made it all work. He’s looking forward to some help from Intel for the next phase—including some troubleshooting on integrated graphics—while basking in the glow of winning a prestigious award. In addition, Intel sponsored him at the Design, Innovate, Communicate, Entertain (DICE) Summit in 2016, which he credits with altering his perspective on the gaming industry. “I’m incredibly grateful for all of Intel’s assistance,” he said. “They have supported me more than any other corporation.”

Figure 6:Tim Keenan, left, with Mitch Lum of Intel at the PAX West 2016 conference in Seattle.

Continued funding will be an issue, he acknowledged. “We were fortunate enough to get Indie Fund-ed for Duskers, and that in itself was an amazing experience,” he said. In his blog post detailing the experience, Tim credits independent game-developers that wanted him to succeed, saying he now has a “heavy indie karma debt” to repay.

But the biggest lesson he learned is to stay true to the vision. “If you focus every decision around your artistic intent, you can actually convey that vision to players. At the end of the day, there’s a lot of financial pressure on indie game-developers,” he said. “If you don’t make money, you can’t keep doing what you love. But sometimes it’s riskier to not take risks—and especially in today’s climate, where consumers have so many choices, you have to stand out.”

Resources

Duskers main site: http://duskers.misfits-attic.com

2016 Intel Level Up Contest: https://software.intel.com/en-us/blogs/2016/05/27/2016-intel-level-up-contest-by-the-numbers

Unity Engine: https://unity3d.com

Proof of Concept: A Vital Stage of Enterprise B2B App Development

$
0
0

As we discussed in our first article on B2B enterprise apps, to develop a successful app for the enterprise market, you’ll need to build long-term relationships with your customers—these are definitely not one-off downloads. In the discovery phase, you focused on identifying the two important enterprise customer types—the end user, and the check-writer—and gathering data from both types of customers to understand their pain points, which allowed you to put together a solid plan.

Now you’re ready to build the first version of your product, or your proof of concept, which will allow you to further validate the market. Will your idea work? Will it meet your customers’ needs? To find out, you'll need to convince at least one of your established contacts to work with you more closely, converting that company into a reference customer, and gathering their insight as you build a proof of concept and begin to iterate.

Find Your Reference Customers

You talked to a lot of potential customers as you researched end-user and check-writer pain points. During that process, you likely met a few people who were as excited about your solution as you are. These are the folks to reach out to about the organization becoming a reference customer. Your ideal reference customer is an influencer in the industry you’re serving who has fairly typical needs around your solution and is willing to pilot your app. During the pilot, you will fine-tune the app based on their feedback. Once it’s to their liking, these organizations will serve as references to help you scale your solution to others in the industry.

Ideas to consider:

  • Look for a reference customer—more could get messy if you need to build out specific features for any of them.
  • Offer your app for a nominal fee in exchange for their help and feedback.
  • Plan for the pilot to last 3-6 months to gain the most useful feedback.

Leverage Your Champions

Once an organization has agreed to the pilot, you will need to gather some additional requirements before you start to build. Engage your champion(s) within the organization to help you determine the minimum barriers to entry—companywide or industry requirements, such as data security, compliance, and compatibility that aren’t exactly features of your app, but need to be built in for the company to be able to adopt it. Your champions can help you answer these key questions:

Who else needs to approve it?

Your main client will connect you to additional decision makers within their company, such as legal, IT, cross-functional partners, and even additional off-label users who might interact with the product or use it in different ways. What will they be looking for? What role will they play in the final product or purchasing decision?

What matters to these additional stakeholders?

From your research in phase 1, you probably have a good understanding of which key features you should include in your first iteration, and which can wait. (If you don’t, work with the end-user and check-writer customers in this organization to find out.) At this point, you need to also identify any requirements these additional stakeholders might have. Are there specific rules or systems that must be used for data security? Does the organization have compliance needs that absolutely must be addressed in the proof of concept before they’ll even consider it?

What objections might they have?

A corollary to the above—be sure to listen for what objections each stakeholder might have. Does the legal department have concerns about how the product will be branded? Is IT worried about compatibility? These needs of various stakeholders may well be in conflict; be prepared to keep pressing for a solution—and don’t be shy about leveraging your champion, with her inside knowledge of the organizational culture and requirements—to help.

POC vs MVP—What’s the Difference?

Once you’ve deepened your relationship with your stakeholders and have a plan for the minimum required feature set, you're ready to build a proof of concept. But what exactly is that, and how is it different from a minimum viable product, or MVP?

If you’re coming from the B2C or consumer market, the MVP is a very familiar idea. An MVP is a product that contains enough of the key features to fulfill the concept and to function, but is streamlined and minimized for the quickest possible build—so you can start getting real feedback from real customers as soon as possible.

A proof of concept, or POC, operates under a similar theory, with a focus on speed and iteration. However, because you're now working with an enterprise B2B client, even your first simple prototype will need to be a lot more baked. There's a lot more on the line, in terms of investment, and you’ll need to be a lot more intentional about the features that are included.

Let’s consider the example we used in the last enterprise B2B article, of an e-commerce portal for marketers to help them manage inventory, maintain presentations, and increase transactions. In building the POC, it's likely that you'll want to not only demonstrate key functionality, such as updating product content and tracking real-time availability, you may also need to test the connection to the existing POS system, or include metadata to get the analytics team on board.

A Word About Custom Features

In the consumer app world, you’d never create a specific feature set to serve the needs of a single customer. But in the enterprise world, you might need to do just that. Imagine that one of the biggest retailers in the world wanted to use your e-commerce portal—but required integration with a legacy system not used by the rest of the industry. Satisfying this giant might be your ticket to industrywide adoption, making the extra work of the custom build well worth it in the end.

Iterate Until You Have a Product Your Reference Customer Loves

Just like with an MVP, your proof of concept is just the beginning. Iteration is key. Your product has moved beyond theory and it's time for you, and your customers, to further refine your needs and requirements. Don't be surprised if some of your features change pretty significantly once they're implemented and tested—that's why the proof of concept phase is so important. Continue to work closely with your champion, and all of the related stakeholders, to create a product that truly serves your enterprise customers’ many needs.

Thank you

$
0
0

 

Thank You. We have received your inquiry. You will receive a response within (1) business day. 


-Intel® Developer Zone Support Team


Adaptive Screen Space Ambient Occlusion

$
0
0

Download Document  Download Code Samples

This article introduces a new implementation of the effect called adaptive screen space ambient occlusion (ASSAO), which is specially designed to scale from low-power devices and scenarios up to high-end desktops at high resolutions, all under one implementation with a uniform look, settings, and quality that is equal to the industry standard.

Screen space ambient occlusion (SSAO) is a popular effect used in real-time rendering to produce small-scale ambient effects and contact shadow effects. It is used by many modern game engines, typically using 5 percent to 10 percent of the frame GPU time. Although a number of public implementations already exist, not all are open source or freely available, or provide the level of performance scaling required for both low-power mobile and desktop devices. This is where ASSAO fills needed gaps.

This article focuses on how to understand the sample code and to further integrate or port the sample code. It also covers implementation specifics, available options, settings and trade-offs in its use. An article detailing the implementation is featured in the upcoming book GPU Zen (GPU Pro* 8).


Figure 1. Example of adaptive SSAO applied to a test scene in Unity 4*.

Full DirectX* 11 implementation is provided under MIT license in an easy-to-integrate package.

Algorithm Overview

ASSAO is a SSAO implementation tuned for scalability and flexibility. Ambient occlusion (AO) implementation is based on a solid-angle occlusion model similar to “Horizon-Based Ambient Occlusion” [Bavoil et al. 2008] with a novel progressive sampling kernel disk. The performance framework around it is based on a 2 x 2 version of cache-friendly deinterleaved rendering, “Deinterleaved Texturing for Cache-Efficient Interleaved Sampling” [Bavoil 2014], and optional depth MIP-mapping “Scalable Ambient Obscurance” [McGuire et al. 2012].

Scaling quality with respect to performance is achieved by varying the number of AO taps (enabled by the progressive sampling kernel) and toggling individual features at various preset levels.

Stochastic sampling is used to share AO value between nearby pixels (based on rotated and scaling of the sampling disk) with a de-noise blur applied at the end. De-noise blur is edge-aware in order to prevent the effect bleeding into unrelated background or foreground objects, which causes haloing. Edges can be depth-only based, or depth and normal based. (The latter results in higher quality, but of course costs more in processing). This smart blur is performed in the 2 x 2 deinterleaved domain for optimal cache efficiency, with only the final pass done at full resolution during the interleaving (reconstruction) pass.

In practice, it is a multi-pass pixel shader-based technique. At High preset, the main steps are:

  1. Preparing depths
    1. 2 x 2 deinterleave input screen depth into four quarter-depth buffers and convert values to viewspace. Also, if input screen normals are not provided, reconstruct them from depth.
    2. Create MIPs for each of the smaller depth buffers (not done in Low or Medium presets).
  2. Computing AO term and edge-aware blur for each of the four 2 x 2 deinterleaved parts
    1. Compute AO term and edges and store into a R8G8 texture.
    2. Apply edge-aware smart blur (one to six passes, based on user settings).
  3. Combine four parts into the final full resolution buffer and apply final edge-aware blur pass.

The Highest/Adaptive quality preset has an additional base AO pass used to provide importance heuristics that guide the per-pixel variable sample count for the main AO pass.

Table 1 gives an overview of performance numbers. These numbers are for reference and can vary based on driver and hardware specifics. Changing the effect settings will not change the performance, with the exception of edge-aware blur; increasing the blur pass count increases the cost.

 

Skull Canyon (Iris Pro 580)

GTX 1080

RX 480

 

1920 x 1080

1920 x 1080

3840 x 2160

1920 x 1080

3840 x 2160

Low

2.4

0.28

1.21

0.64

2.58

Medium

4.1

0.49

2.25

1.01

4.09

High

6.9

0.77

3.15

1.34

4.74

Highest

10.4

1.12

4.65

2.07

7.44

Table 1. ASSAO effect cost in milliseconds at various presets, resolutions, and hardware.

Profiled with screen normals provided, a two-pass blur and Highest adaptive target set to 0.45, getting the effect scaling (quality versus performance) between Low/Medium/High/Highest presets is done by varying the number of AO taps, as well as by toggling on/off individual features. Table 2 shows a detailed setup of these presets.

 

Sample count

2 x 2 deinterleaved

Depth MIPs

Edge-aware blur

Low

6

yes

no

no

Medium

10

yes

no

yes

(depth only)

High

24

yes

yes

yes+

(depth + normals)

Highest (Adaptive)

10–64

yes

yes

yes+

(depth + normals)

Table 2. Details of ASSAO presets.

Sample Overview

The sample uses DirectX 11 and is compatible with Windows* 7 64-bit and above, with Microsoft Visual Studio* 2015 to compile.


Figure 2. Adaptive SSAO sample layout.

The Crytek Sponza* scene included in the sample is used by default and the basic effect profiling metrics are shown in the upper-right graph. Below the graph, there are a number of dials used to change effect settings, quality, or debug the effect. The main settings are:

  1. Effect enabled

    Toggles the effect off/on. See screen images 0 (off), 1 (on).

  2. Effect radius

    Radius of ambient occlusion in viewspace units. See screen images 4, 5, 6.

  3. Effect strength

    Linear effect multiplier, useful for setting the effect strength in conjunction with addition to effect power, as well as fading the effect in/out. See screen images 7, 8, 9, 10.

  4. Effect power

    Exponential effect modifier: occlusion = pow(occlusion, effectPower). The best way to tweak the power of the effect curve. See screen images 11, 12, 13, 14.

  5. Detail effect strength

    Additional two-pixel wide kernel used to add a high-frequency effect. High values will cause aliasing and temporal instability. See screen images 15, 16, 17, 18, 19.

  6. Blur amount

    Higher number of blur passes produces a smoother effect with less high-frequency variation, which can be beneficial (reduces aliasing), but also increases cost. See screen images 20, 21, 22, 23, 24.

  7. Blur sharpness

    Determines how much to prevent blurring over distance based (and optional normal based) edges, used to prevent bleeding between separate foreground and background objects, which causes haloing and other issues. A value of 1 means fully sharp (no blurring over edges), and anything less relaxes the constraint. Values close to 1 are useful to control aliasing. See screen images 25, 26.

  8. Deferred Path

    In the deferred path, the inputs for the effect are screen depth and normalmap textures. Conversely, when forward path is used, only the depth texture is the input while the normalmap is reconstructed from the depth, which adds to the cost and produces slightly different results. See screen images 27, 28.

  9. Expand resolution

    Near the screen edges the part that the effect kernel plays lies outside of the screen. While different sampling modes (i.e., clamp/mirror) can be used to achieve different results (see m_samplerStateViewspaceDepthTap), the best solution is to expand the render area and resolution by a certain percentage while creating the depth buffer, so that the data needed by the AO effect near the edges is available. This option does that and ASSAO uses the optional scissor rectangle to avoid computing AO for the expanded (not visible) areas. See screen images 29, 30.

  10. Texturing enabled

    Toggles texturing to make the AO effect more visible (lighting is still applied). See screen images 31, 32.

  11. Quality preset

    Switches between the four quality presets, described in Tables 1 and 2. See screen images 33, 34, 35, 36.

    For the Highest/Adaptive preset, Adaptive target controls the progressive quality target that can be changed at runtime to quickly trade off quality versus performance. See screen images 37, 38, 39.

  12. Switch to advanced UI

    To debug the effect in more detail, the sample can be switched to advanced UI, which provides access to additional scenes (see screen images 40, 41, 42) and the development version of the effect, which allows for more in-depth profiling and various debug views to show normals (screen image 43), detected edges (screen image 44), all AO samples for a selected pixel (screen image 45), and adaptive effect heatmap (screen image 46).

Integration Details

For quick integration into a DirectX 11 codebase, only three files from the sample project are needed:

Projects\ASSAO\ASSAO\ASSAO.h
Projects\ASSAO\ASSAO\ASSAODX11.cpp
Projects\ASSAO\ASSAO\ASSAO.hlsl

These contain the whole ASSAO implementation with no other dependencies except the DirectX 11 API.

The basic ASSAO integration steps are:

  1. Add ASSAO.h and ASSAODX11.cpp into your project.
  2. Add the ASSAO.hlsl file where it can be loaded or, alternatively, see “USE_EMBEDDED_SHADER” defined in ASSAOWrapperDX11.cpp (and the project custom build step) for details on how to easily embed the .hlsl file into the binary.
  3. Create an ASSAO_Effect object instance after DirectX 11 device creation by providing the ID3D11Device pointer and the shader source buffer to the static ASSAO_Effect::CreateInstance(…). Don’t forget to destroy the object using a call to ASSAO_Effect::DestroyInstance() before the DirectX device is destroyed.
  4. Find a suitable location in your rendering post-processing pipeline: SSAO is often applied directly onto the light accumulation or post-tonemap color buffers, before other screen-space effects, usually using multiplication blend mode. A more physically correct approach sometimes used is to render the AO term into a separate buffer for later use in the lighting pass. In any case, since the required inputs are the scene depth (and screen space normals, if available), it means that ASSAO can be drawn once those become available.
  5. Set up the per-frame inputs structure by filling in the ASSAO_InputsDX11:
    1. ScissorLeft/Right/Top/Bottom are only needed if the effect output needs to be constrained to a smaller rectangle, such as in the case when the Expand resolution approach is used. Otherwise, defaults of 0 indicate that the output goes into the whole viewport.
    2. ViewportX/Y must be set to 0 and ViewportWidth/Height to the output render target and input depth and screen space normals texture resolution. Custom viewports are not (yet) supported.
    3. ProjectionMatrix must be set to the projection used to draw the depth buffer. Both LH and RH projection matrices are supported, as well as the reversed Z (http://outerra.blogspot.de/2012/11/maximizing-depth-buffer-range-and.html).
    4. NormalsWorldToViewspaceMatrix (optional) is needed if the input screen space normals are not in the viewspace, in which case this matrix is used to convert them.
    5. MatricesRowMajorOrder defines the memory layout of the input ProjectionMatrix and NormalsWorldToViewspaceMatrix.
    6. NormalsUnpackMul and NormalsUnpackAdd default to 2 and -1 respectively, and are used to unpack normals into [-1, 1] range from the UNORM [0, 1] textures that they are commonly stored in. When normals are provided in a floating point texture, these two values need to be set to 1 (mul) and 0 (add).
    7. DrawOpaque determines the blending mode: if true, the contents of the selected render target will be overwritten; if false, multiplicative blending mode is used.
    8. DeviceContext (DirectX 11-specific) should be set to the ID3D11DeviceContext pointer used to render the effect.
    9. DepthSRV (DirectX 11-specific) should be set to input depth data.
    10. NormalSRV (DirectX 11-specific) should be set to input screen space normals or nullptr if not available (in which case normals will be reconstructed from depth data).
    11. OverrideOutputRTV (DirectX 11-specific) should be set to nullptr or to the output render target. If is it set to nullptr the currently selected RTV is used.
  6. Set up the effect settings structure defined in ASSAO_Settings. They are detailed in the Sample overview section.
  7. Call the ASSAO_Effect::Draw function. All current DirectX 11 states are backed up and restored after the call to ensure seamless integration.

The following files from the sample project provide an example of integration:

Projects\ASSAO\ ASSAOWrapper.h
Projects\ASSAO\ ASSAOWrapper.cpp
Projects\ASSAO\ ASSAOWrapperDX11.cpp

The latest source code can be downloaded from https://github.com/GameTechDev/ASSAO.

Citations

[Bavoil et al. 2008] Bavoil, L., Sainz, M., and Dimitrov, R. 2008. "Image-Space Horizon-Based Ambient Occlusion.” In ACM SIGGRAPH 2008 talks, ACM, New York, NY, USA, SIGGRAPH ’08, 22:1–22:1.

[McGuire et al. 2012] Morgan McGuire, Michael Mara, David Luebke. “Scalable Ambient Obscurance.” HPG 2012.

[Bavoil 2014] Louis Bavoil, “Deinterleaved Texturing for Cache-Efficient Interleaved Sampling.” NVIDIA 2014.

Notices

This sample source code is released under the Intel Sample Source Code License Agreement.

Intel® XDK FAQs - IoT

$
0
0

Where can I download the Intel XDK?

The Intel XDK main page includes download links for the Linux, Windows and OSX operating systems.

How do I update the MRAA library on my Intel IoT platforms?

The simplest way to update the mraa library on an Edison or Galileo platform is to use the built in "Update libraries on board" option which can be found inside the IoT settings panel on the Develop tab. See the screenshot below:

Alternatively, on a Yocto Linux image, you can update the current version of mraa by running the following commands from the Yocto Linux root command-line:

# opkg update
# opkg upgrade

If your IoT board is using some other Linux distribution (e.g. a Joule platform), you can manually update the version of mraa on the board using the standard npm install command:

# npm install -g mraa

...or:

$ sudo npm install -g mraa

...for a Linux distribution that does not include a root user (such as Ubuntu).

All command-line upgrade options assume the IoT board has a working Internet connection and that you are logged into the board using either an ssh connection or over a serial connection that provides access to a Linux prompt on your IoT board.

Can the xdk-daemon run on other Linux distributions besides Yocto?

The Intel XDK xdk-daemon is currently (November, 2016) only supported on the Yocto and Ostro Linux distributions. Work is ongoing to provide a version of the xdk-daemon that will run on a wider range of IoT Linux platforms.

How do I connect the Intel XDK to my board without an active Internet connection?

The Intel Edison Board for Arduino supports the use of an RNDIS connection over a direct USB connection, which provides a dedicated network connection and IP address. Other boards can connect to a local network using either a wireless or wired LAN connection. The wired LAN connection may require attaching a USB Ethernet adaptor to the IoT board, in order to provide the necessary physical wired Ethernet connection point. Access to your local network is all that is required to use an IoT device with the Intel XDK, access to the Internet (by the IoT board) is not a hard requirement, although it can be useful for some tasks.

Most Intel IoT platforms that are running Linux (and Node.js) can be "logged into" using a USB serial connection. Generally, a root Linux prompt is available via that USB serial connection. This serial Linux prompt can be used to configure your board to connect to a local network (for example, configure the board's wifi connection) using Linux command-line tools. The specific details required to configure the board's network interface, using the board's Linux command-line tools, is a function of the board and the specific version of Linux that is running on that board. Please see the IoT board's installation and configuration documentation for help with that level of setup.

How do I use a web service API in my IoT project from my main.js?

Your application's main.js file runs on a standard Node.js runtime engine; just as if you were in a server-based Node.js environment, you can create a simple HTTP server as part of your IoT Node.js app that serves up an index.html to any client that connects to that HTTP server. The index.html file should contain a reference to the JavaScript files that update the HTML DOM elements with the relevant web services data. You are accessing the index.html (HTML5 application) from the http server function in the main.js file. A web services enabled app would be accessed through a browser, via the IoT device's IP address.

See this blog, titled Making a Simple HTTP Server with Node.js – Part III, for more help.

Error: "Cannot find module '/opt/xdk-daemon/current/node-inspector-server/node_modules/.../debug.node"

In some IoT Linux images the xdk-daemon was not compiled correctly, resulting in this error message appearing when a debug session is started. You can work around this issue on an Edison or Galileo platform by using the "Upgrade Intel xdk-daemon on IoT device" option, which can be found in the IoT settings panel on the Develop tab. See the screenshot below:

Error: "Cannot find module 'mime-types' at Function.Module ..."

This error usually indicates than an npm install may not have completed correctly. This can result in a missing dependency at runtime for your IoT Node.js app. The best way to deal with this is:

  1. Remove the node_modules directory in the project folder on your development system.

  2. Switch to another Intel XDK project (if you don't have another project, create a blank project).

  3. Switch back to the problem project.

  4. Click the "Upload" icon on the Develop tab and you should be prompted by a dialog asking if you want to build.

  5. Click the build button presented by the dialog prompt in the previous step.

  6. Wait for a completion of the build, indicated by this message in the console:
    NPM REBUILD COMPLETE![ 0 ] [ 0 ]

Now you should be able safely run the project without errors.

Error: "Write Failed" messages in console log, esp. on Edison boards.

This can be caused by your Edison device running out of disk space on the '/' partition. You can check this condition by logging into the Edison console and running the df command, which should give output similar to this:

# df -h /
Filesystem  Size    Used    Available  Use%  Mounted on
/dev/root   463.9M  453.6M  0          100%  / 

A value of "100%" under the "Use%" column means the partition is full. This can happen due to a large number of logs under the /var/log/journal folder. You can check the size of those logs using the du command:

# cd /var/log/journal
# du -sh *
 11.6M 0ee60c06f3234299b68e994ac392e8ca
 46.4M 167518a920274dfa826af62a7465a014
  5.8M 39b419bfd0fd424c880679810b4eeca2
 46.4M a40519fe5ab148f58701fb9e298920da
  5.8M db87dcad1f624373ba6743e942ebc52e
 34.8M e2bf0a84fab1454b8cdc89d73a5c5a6b 

Removing some or all of the log files should free up the necessary disk space.

Be sure not to delete the /var/logs/journal directory itself!!

Back to FAQs Main 

Learning About Microsoft Azure* IoT Gateway SDK Modules

$
0
0

Introduction

The Microsoft Azure* IoT Gateway SDK gives you a myriad of tools that allow you to enable gateway devices in multiple ways. It can also enable almost any device with an internet connection to become a gateway. It works for both Windows* and Linux* development environments that have the ability to compile C and C++ code. It’s also extremely modular, having a lightweight core to drive the modules you can include within it. This core handles how the modules communicate with each other, apathetic of the environment it’s in. This broker is the key to having effective modules, and an overall effective gateway. It also simplifies communicating with the Microsoft Azure* cloud service.

Modules

The SDK includes several modules by default, which can help you understand their structure, application, and communication. They can also provide a good testbed for a gateway, or your custom modules. To begin we will take a look at some of the modules created by Microsoft, and how they play in to the SDK as a whole. Each module is “wrapped” differently depending on whether it’s being used in a Windows or Linux development environment, but is otherwise the same.

hello_world

The hello_world module is designed to output a simple “hello world” message to the systems log. The majority of the code is error checking, to ensure the environment is properly setup by the core features of the SDK before executing. This module is a publisher, this means its goal is to publish messages to the broker, which can then send the message to whoever needs it. In this case it simply sends “helloWorld", “from Azure IoT Gateway SDK simple sample!” to the broker, but other modules could send sensor information, or instructions.

Logger

The Logger module is another simple module, which listens to the broker for any messages, before saving them to a JSON file. The logger does not output any data to the broker, but instead retains all data that has been through the broker. It appends several things to them, like the time of the event the content and the origin of the message, before appending it to the specified JSON log file. This simple module is good to use for error checking, as it can show you in real time, the series of events that lead to an unexpected output.

Building Your “Gateway”

The SDK has a built in function to build your gateway. Of course it doesn’t assemble the hardware through magic blue smoke. Instead it builds the object that acts as a configuration for the SDK to properly interact with modules and hardware. This function takes input in the form of a JSON file, which needs to instruct the program which modules to include, and how the broker needs to act towards them.

Modules

The module portion of the JSON file must include three things. Firstly, the modules name, which must be unique in your SDK. The next field that must be filled out is the path of the module. This path must end in .so or .dll, depending on the operating system your using for your gateway. Finally you must enter the arguments your module is expecting. Modules like the logger expects an argument for the file it’s meant to output to. The hello_world module expects no arguments, and therefore you pass it “null”.

Links

This section of the JSON is used to instruct the broker on how to handle messages that are sent to it. Source modules are designated to send messages to the broker. Modules designated as sinks accept messages from the broker. In the case of the “Hello World” sample, the hello_world module is designated a source, and the logger module a sink. Below is an example of a JSON to build the gateway environment on a Linux host machine, taken from the Azure IoT Gateway SDK github.

Conclusion

A developer wishing to design their own module must look through the current modules provided by Microsoft. This article should have given you a good idea of the relationship between modules and the core of the SDK. Upon building your own modules, you need to take into consideration how they are going to react, and be applied in the world of the SDK, and the broker. The true power of a module lies in how it communicates to other modules to do what they need to. So go out there and design your own modules, test them out, and make your gateways act the exact way you want them to!

Resources

The primary source for this documentation is the Azure IoT Gateway SDK GitHub page.

Intel® RealSense™ SDK-Based Real-Time Face Tracking and Animation

$
0
0

Download Code Sample [ZIP 12.03 MB]

In some high-quality games, an avatar may have facial expression animation. These animations are usually pre-generated by the game artist and replayed in the game according to the fixed story plot. If players are given the ability to animate that avatar’s face based on their own facial motion in real time, it may enable personalized expression interaction and creative game play. Intel® RealSense™ technology is based on a consumer-grade RGB-D camera, which provides the building blocks like face detection and analysis functions for this new kind of usage. In this article, we introduce a method for an avatar to simulate user facial expression with the Intel® RealSense™ SDK and also provide the sample codes to be downloaded.

Figure 1: The sample application of Intel® RealSense™ SDK-based face tracking and animation.

System Overview

Our method is based on the idea of the Facial Action Coding System (FACS), which deconstructs facial expressions into specific Action Units (AU). AUs are a contraction or relaxation of one or more muscles. With the weights of the AUs, nearly any anatomically possible facial expression can be synthesized.

Our method also assumes that the user and avatar have compatible expression space so that the AU weights can be shared between them. Table 1 illustrates the AUs defined in the sample code.

Action UnitsDescription
MOUTH_OPENOpen the mouth
MOUTH_SMILE_LRaise the left corner of mouth
MOUTH_SMILE_RRaise the right corner of mouth
MOUTH_LEFTShift the mouth to the left
MOUTH_RIGHTShift the mouth to the right
  
EYEBROW_UP_LRaise the left eyebrow
EYEBROW_UP_RRaise the right eyebrow
EYEBROW_DOWN_LLower the left eyebrow
EYEBROW_DOWN_RLower the right eyebrow
  
EYELID_CLOSE_LClose left eyelid
EYELID_CLOSE_RClose right eyelid
EYELID_OPEN_LRaise left eyelid
EYELID_OPEN_RRaise right eyelid
  
EYEBALL_TURN_RMove both eyeballs to the right
EYEBALL_TURN_LMove both eyeballs to the left
EYEBALL_TURN_UMove both eyeballs up
EYEBALL_TURN_DMove both eyeballs down

Table 1: The Action Units defined in the sample code.

The pipeline of our method includes three stages: (1) tracking the user face by the Intel RealSense SDK, (2) using the tracked facial feature data to calculate the AU weights of the user’s facial expression, and (3) synchronizing the avatar facial expression through normalized AU weights and corresponding avatar AU animation assets.

Prepare Animation Assets

To synthesize the facial expression of the avatar, the game artist needs to prepare the animation assets for each AU of the avatar’s face. If the face is animated by a blend-shape rig, the blend-shape model of the avatar should contain the base shape built for a face of neutral expression and the target shapes, respectively, constructed for the face with the maximum pose of the corresponding AU. If a skeleton rig is used for facial animation, the animation sequence must be respectively prepared for every AU. The key frames of the AU animation sequence transform the avatar face from a neutral pose to the maximum pose of the corresponding AU. The duration of the animation doesn’t matter, but we recommend a duration of 1 second (31 frames, from 0 to 30).

The sample application demonstrates the animation assets and expression synthesis method for avatars with skeleton-based facial animation.

In the rest of the article, we discuss the implementation details in the sample code.

Face Tracking

In our method, the user face is tracked by the Intel RealSense SDK. The SDK face-tracking module provides a suite of the following face algorithms:

  • Face detection: Locates a face (or multiple faces) from an image or a video sequence, and returns the face location in a rectangle.
  • Landmark detection: Further identifies the feature points (eyes, mouth, and so on) for a given face rectangle.
  • Pose detection: Estimates the face’s orientation based on where the user's face is looking.

Our method chooses the user face that is closest to the Intel® RealSense™ camera as the source face for expression retargeting and gets this face’s 3D landmarks and orientation in camera space to use in the next stage.

Facial Expression Parameterization

Once we have the landmarks and orientation of the user’s face, the facial expression can be parameterized as a vector of AU weights. To obtain the AU weights, which can be used to control an avatar’s facial animation, we first measure the AU displacement. The displacement of the k-th AU

Dk is achieved by the following formula:

Where Skc is the k-th AU state in the current expression, Skn is the k-th AU state in a neutral expression, and Nk is the normalization factor for k-th AU state.

We measure AU states Skc and Skn in terms of the distances between the associated 3D landmarks. Using a 3D landmark in camera space instead of a 2D landmark in screen space can prevent the measurement from being affected by the distance between the user face and the Intel RealSense camera.

Different users have different facial geometry and proportions. So the normalization is required to ensure that the AU displacement extracted from two users have approximately the same magnitude when both are in the same expression. We calculated Nk in the initial calibration step on the user’s neutral expression, using the similar method to measure MPEG4 FAPU (Face Animation Parameter Unit).

In normalized expression space, we can define the scope for each AU displacement. The AU weights are calculated by the following formula:

Where Dkmax is the maximum of the k-th AU displacement.

Because of the accuracy of face tracking, the measured AU weights derived from the above formulas may generate an unnatural expression in some special situations. In the sample application, geometric constraints among AUs are used to adjust the measured weights to ensure that a reconstructed expression is plausible, even if not necessarily close to the input geometrically.

Also because of the input accuracy, the signal of the measured AU weights is noisy, which may have the reconstructed expression animation stuttering in some special situations. So smoothing AU weights is necessary. However, smoothing may cause latency, which impacts the agility of expression change.

We smooth the AU weights by interpolation between the weight of the current frame and that of previous frame as follows:

Where wi,k is the weight of the k-th AU in i-th frame.

To balance the requirements of both smoothing and agility, the smoothing factor of the i-th frame for AU weights, αi is set as the face-tracking confidence of this frame. The face-tracking confidence is evaluated according to the lost tracking rate and the angle of the face deviating from a neutral pose. The higher the lost tracking rate and bigger deviation angle, the lower the confidence to get accurate tracking data.

Similarly, the face angle is smoothed by interpolation between the angle of the current frame and that of the previous frame as follows:

To balance the requirements of both smoothing and agility, the smoothing factor of the i-th frame for face angle, βi, is adaptive to face angles and calculated by

Where T is the threshold of noise, taking the smaller variation between face angles as more noise to smooth out, and taking the bigger variation as more actual head rotation to respond to.

Expression Animation Synthesis

This stage synthesizes the complete avatar expression in terms of multiple AU weights and their corresponding AU animation assets. If the avatar facial animation is based on a blend-shape rig, the mesh of the final facial expression Bfinal is generated by the conventional blend-shape formula as follows:

Where B0 is the face mesh of a neutral expression, Bi is the face mesh with the maximum pose of the i-th AU.

If the avatar facial animation is based on a skeleton rig, the bone matrices of the final facial expression Sfinal are achieved by the following formula:

Where S0 is the bone matrices of a neutral expression, Ai(wi) is the bone matrices of the i-th AU extracted from this AU’s key-frame animation sequence Ai by this AU’s weight wi.

The sample application demonstrates the implementation of facial expression synthesis for a skeleton-rigged avatar.

Performance and Multithreading

Real-time facial tracking and animation is a CPU-intensive function. Integrating the function into the main loop of the application may significantly degrade application performance. To solve the issue, we wrap the function in a dedicated work thread. The main thread retrieves the new data from the work thread just when the data are updated. Otherwise, the main thread uses the old data to animate and render the avatar. This asynchronous integration mode minimizes the performance impact of the function to the primary tasks of the application.

Running the Sample

When the sample application launches (Figure 1), by default it first calibrates the user’s neutral expression, and then real-time mapping user performed expressions to the avatar face. Pressing the “R” key resets the system when the user wants to or a new user substitutes to control the avatar expression, which will activate a new session including calibration and retargeting.

During the calibration phase—in the first few seconds after the application launches or is reset—the user is advised to hold his or her face in a neutral expression and position his or her head so that it faces the Intel RealSense camera in the frontal-parallel view. The calibration completes when the status bar of face-tracking confidence (in the lower-left corner of the Application window) becomes active.

After calibration, the user is free to move his or her head and perform any expression to animate the avatar face. During this phase, it’s best for the user to keep an eye on the detected Intel RealSense camera landmarks, and make sure they are green and appear in the video overlay.

Summary

Face tracking is an interesting function supported by Intel® RealSense™ technology. In this article, we introduce a reference implementation of user-controlled avatar facial animation based on Intel® RealSense™ SDK, as well as the sample written in C++ and uses DirectX*. The reference implementation includes how to prepare animation assets, to parameterize user facial expression and to synthesize avatar expression animation. Our practices show that not only are the algorithms of the reference implementation essential to reproduce plausible facial animation, but also the high quality facial animation assets and appropriate user guide are important for better user experience in real application environment.

Reference

1. https://en.wikipedia.org/wiki/Facial_Action_Coding_System

2. https://www.visagetechnologies.com/uploads/2012/08/MPEG-4FBAOverview.pdf

3. https://software.intel.com/en-us/intel-realsense-sdk/download

About the Author

Sheng Guo is a senior application engineer in Intel Developer Relations Division. He has been working on top gaming ISVs with Intel client platform technologies and performance/power optimization. He has 10 years expertise on 3D graphics rendering, game engine, computer vision etc., as well as published several papers in academic conference, and some technical articles and samples in industrial websites. He hold the bachelor degree of computer software from Nanjing University of Science and Technology, and the Master’s degree in Computer Science from Nanjing University.

Wang Kai is a senior application engineer from Intel Developer Relations Division. He has been in the game industry for many years. He has professional expertise on graphics, game engine and tools development. He holds a bachelor degree from Dalian University of Technology.

SMB Platform Upgrade Instructions 10.8.0

$
0
0

Background

Release Notes

10.8.0

Download link

Download the following files from registrationcenter.intel.com. Use the serial number that is sent to you via email to begin the download process.

saffron-install_10_8_0.bin     
rhel6-setup-lite.tgz                

UpgradeSpecifics

  • Step 1. Uninstall your current version of SMB.
  • Step 2. Update the smbtool utility in the POSTOS Setup Script (rhsetup) IMPORTANT: This is a centralized logging-specific upgrade only. Follow the instructions below. 
  • Step 3: Install SMB 10.8.0.

General Upgrade Notes:

  • For site installations with both SMB and Streamline, ensure that the installation meets inter-product dependencies as defined by the Saffron Product Support team. 
  • The SMB installer maintains site-specific customizations in the ~saffron/smb/conf and ~saffron/smb/catalina/conf directories.
  • In general, only saffron user permissions (not root) are required to upgrade the SMB installer.
  • DO NOT RUN THE RHSETUP SCRIPT. See the instructions below for extracting rhsetup and then installing the updated smbtool utility. The root user is required to perform this upgrade.
  • Saffron recommends testing this first in your development environment to verify operation with site-specific environment and components.

Upgrade SMB 

Pre-Steps

1.  Review the 10.8.0 Release Notes for additional information that extend the instructions here. If the upgrade is over multiple releases, e.g., from 10.2.0 to 10.4.0, review each intervening set of release notes for specific installation instructions.  

2.  Download the SMB installer (saffron-install_10_8_0.bin) using the link provided in your registration email and copy to the head node of the SMB cluster in the Saffron home directory. This can be done in several ways and might be site-specific, but Saffron recommends using as few hops as possible to put the SMB installer in the ~saffron directory. 

3.  Ensure that the provided SMB installer is executable. Log in as the saffron user and enter the following command:

$ chmod u+x saffron-install_10_8_0.bin 
 

Uninstall SMB

4.  Shut down the cluster from the admin node. Log in as the saffron user and enter the following commands:

cluster stop

5.  Create a cluster-wide global backup of the Space configurations. Use the SMB archive utility. For example:

archive -g -p archivefilename -d bkup      

This tells the archive utility to make a cluster-wide global back up and place it in the bkup directory.

An archive file called archivefilename-20161017120511 is created.

If you need to restore the global backup in the future, enter the following command:

archive -r archivefilename bkup/archivefilename-20161017120511

For more information, refer to the archive information by entering the following on the command line:

man archive

6. Uninstall the current release. As the saffron user, enter the following command:

uninstall

Answer the prompt verifying the uninstall with yes.
 

Update the smbtool utility

7.  The smbtool utility (for systems tasks) in the PostOS setup (rhsetup) script has been updated to include the new centralized logging feature. Execute the following steps on all nodes in the cluster. Log in as the root user.

a.  Download rhsetup (rhel6-setup-lite.tgz) using the link provided in your registration email.

b.  Copy rhsetup into the /tmp directory of the admin node and each worker node.

cp rhel6-setup-lite.tgz /tmp 

c.  Untar rhsetup. 

tar xzf rhel6-setup-lite.tgz 

d.  Locate rhel6-setup/rpms/smbtool-8.0-8.x86_64.rpm.  

e.  Update smbtool.

rpm -e smbtool 
rpm -ivh smbtool-8.0-8.x86_64.rpm
 

Install SMB

8.  Run the installer. Logged in as the saffron user in the home directory, enter the following command:

./saffron-install_10_8_0.bin

This unpacks the installer including its embedded rpm for smb, runs a post install procedure, and copies out the software to all nodes in the cluster.

9.  Review configuration files in the following directories to see if they have been modified since the last upgrade. Modified files are appended with as-shipped. Be sure to diff your files with the changed files from the new installation. 

~saffron/smb/conf

~saffron/smb/catalina/conf     

Note: In this release, the following files have been modified from ~saffron/smb/conf:

admin-config.properties 

saffron.xml

advantage-config.properties (for users of SaffronAdvantage)

NOTE: Verify that the validFileRoots property is properly set to your File Source location (from where you ingest data). Failure to do so will result in all affected Spaces to go offline. See the SMB 10.8.0 Release Notes for information on setting this property.

10. Restart the mysql daemons on all nodes only if your mySQL server-specific configuration has changed; otherwise, it is not necessary.

As the saffron user, enter the following command:  

creset -r 

11. Restart the SMB cluster and Ganglia.  As the saffron user, enter the following commands:

cluster start

12. Restart Ganglia only if Gangila-specific configurations have been changed by the system administrator. For a general SMB update, this is not required.

ganglia restart 

13. Verify that you have version 10.8.0. Enter the following command:

cluster version

14. Verify operation of the new cluster.  Enter the following command:

cluster status

15. Verify in the latest log files in ~/smb/logs that no errors exist.

16. Log in to Saffron Admin and Saffron Advantage websites to verify proper operation. 

17. (Optional) If your site has site-specific jdbc jars (e.g., SQL Server jtds or Teradata drivers) or jars that extend SMB functionality, do the following as the saffron user:

cluster stop
cp -p dir_containing_jars/*.jar ~/smb/lib
rd    (The "rd" command syncs the worker node smb/lib directory with the head node.)  
cluster start

Repeat steps 14, 15, and 16.

Viewing all 3384 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>