Quantcast
Channel: Intermédiaire
Viewing all 677 articles
Browse latest View live

Intel® System Studio - Solutions, Tips and Tricks

$
0
0
  • Développeurs
  • Android*
  • Tizen*
  • Unix*
  • Yocto Project
  • Android*
  • Tizen*
  • C/C++
  • Avancé
  • Débutant
  • Intermédiaire
  • Intel® System Studio
  • Intel® Advanced Vector Extensions
  • Extensions Intel® Streaming SIMD
  • Téléphone
  • Tablette
  • URL
  • Exemple de code
  • Rubriques de compilateurs
  • Recherche d’erreurs
  • Pour commencer
  • Amélioration des performances
  • Bibliothèques
  • Erreurs de mémoire
  • Développement multithread
  • Analyse de sécurité statique
  • Erreurs de thread
  • ISS-Learn
  • Learning Lab

  • Fluent Conf 2015: HTML/CSS/JS and Robotics Too

    $
    0
    0
    image

    Photo opp - me and the Javascript Rhino we all love!  :)

    Last week I attended Fluent Conf for the second time. It’s great to see the continuing trend of the Web + IoT and other hardware + Javascript goodness.

    image
     

    Though the main focus of this conference is on HTML/CSS/JS, quite a few of the talks this year were also focused connecting web technologies with other real world experiences. Robotics, WebVR, Wearables, etc. were all topics of presentation and there were some great talks on these subjects.

    image
     

    A lot of companies have adopted ES6 already and using Transpilers for browser compatibility. Almost everyone is giving a talk on React; it’s amazing how many companies are using it since React was announced last year. Here is Brian Holt giving a talk on using both ES6 and React together.

    image
     

    Javascript robotics! A few hardware vendor/projects were at the exhibit hall at Fluent. It’s great to see worlds collide and amazing things come out of it. Tessel is also back this year with their Tessel 2 board!

    image
     

     

    image
     

    I have been playing around with MQTT for a while and it’s great to see that now it has almost become the defacto protocol for IoT applications. I had the pleasure of attending a great talk about IoT and voice enabled applications using IBM’s BlueMix and Watson Text-To-Speech technology. The demo showed a Sphereo being controlled by voice!

    image
     

    I got to see the demo up close and had a quick chat with Stewart Nickolas, a distinguished engineer at IBM!

    image
     

    Writing apps for wearables using Javascript...what??!?! Actually, Pebble has already made that possible with their PebbleJS and PebbleKit, but it’s interesting to see that it’s actually possible on other platforms too. Dan Gallo gave a great talk on using JS on different wearable platforms.

    image
     

    I also attended a talk by Ron Evans and got this awesome Cylon.JS sticker after speaking to him in person. He put together a great talk on “Full Stack Robotics”!

    image
     

    I love my O’Reilly animal stickers :)

    I had a great time at Fluent this year (I do every year) and it’s quite interesting to see the convergence of web technologies/developers and hardware. I can’t wait to see what they have in store for next year at Fluent!

    Image de l’icône: 

  • Conférences
  • Événement
  • HTML5
  • JavaScript*
  • HTML5
  • Internet des objets
  • Développeurs
  • Inclure dans RSS: 

    1
  • Avancé
  • Débutant
  • Intermédiaire
  • Intel® INDE Getting Started Guide

    $
    0
    0

    Introduction

    Intel® Integrated Native Developer Experience (Intel® INDE) is a one stop productivity suite to create native applications targeting the Android* and Microsoft* Windows* platforms. This guide will help you get started with developing high performance native applications using the various features of Intel INDE. 

    Developing Windows* Applications

    Intel INDE can be used to develop Windows* applications using a Microsoft Windows* host system. For more help on using Intel INDE with this platform, refer to this guide:

    Developing Android* Applications

    Intel INDE can be used to develop Android* applications for mobile platforms using either a Microsoft Windows* host system or an Apple OS X* host system. As the tools available on each development platform are different, refer to the Getting Started Guide for your development system:

    Next Steps...

    Start developing apps with Intel INDE! See the Intel INDE Home Page for information about the different versions of the product, how to purchase it, and how to get support for the product.

     

  • Développeurs
  • Android*
  • Apple OS X*
  • Microsoft Windows* (XP, Vista, 7)
  • Microsoft Windows* 8.x
  • Android*
  • Windows*
  • C/C++
  • Java*
  • Débutant
  • Intermédiaire
  • Intel® Integrated Native Developer Experience (INDE)
  • PC portable
  • Téléphone
  • Tablette
  • Bureau
  • URL
  • Pour commencer
  • The Internet of Things—Analytics: Using the Intel® IoT Analytics Website for Data Mining

    $
    0
    0

    By Dr. Ben Lieberman

    Interconnected physical devices represent a whole new opportunity for businesses and individuals to take even greater control of their environment. We can now remotely control our homes, vehicles, and workspaces with nothing more than a handheld smartphone. With this high degree of connectivity, it is now possible to gather large amounts of data about these devices and—more specifically—the information that the sensors embedded within these devices provide. These sensors, such as those for temperature, acceleration, and position, can provide a steady stream of data, but these data have limited utility without a strong, associated set of data analytics. This article and its companion piece explore the Intel® Internet of Things (IoT) Analytics Dashboard and demonstrate how you can use that site to aggregate, organize, and facilitate large-scale data mining from a collection of geographically distributed device sensors.

    Introduction

    The power of connected devices has grown exponentially. The explosion of mobile devices, ubiquitous networking, and powerful, inexpensive applications has created a wealth of possibilities for individuals to connect in ways never before seen. Who could have predicted the phenomenal growth of social media just a decade ago? In a similar way, we are now moving toward a society where the price of connectivity has dropped to pennies per megabit, wireless communication is virtually ever present, and machines can now communicate with one another directly. This is the world of the IoT.

    One growing area of IoT development is the collection and analysis of geographically distributed device sensor data. Consider a collection of temperature sensors embedded in a roadway. These sensors are all connected via wire or wirelessly to a localized

    collection point where the data stream is collected, preprocessed, and aggregated. The steady stream of information is then fed to road managers, who are tasked with deciding when and where to deploy plows, road treatment, closures, and even temporary detours. Now, consider using these data (and a wealth of historical data collected from previous years) to create a predictive model of how roadway temperature will fluctuate as a result of local conditions. Perhaps a specific bridge has a tendency to ice over before others; an alert to this condition will allow proper treatment, thereby reducing the risk of accidents on that bridge.

    The Intel® Galileo and Edison boards were designed and built to provide just this kind of sensor data collection to the general public. A wide variety of sensors can report to the IoT integration board, where the data are temporarily collected and preprocessed before being forwarded for additional analysis. Intel created the Internet of Things Analytics website (IoT Analytics) to connect with Intel Galileo- and Edison-driven sensor networks and aggregate large quantities of time series data for further analysis.

    Sensor Types and Applications

    Today, a wide variety of small, inexpensive but powerful environmental sensors can be attached and integrated with virtually any other device (see Table 1). These sensors transmit measurements at a defined frequency (for example, seconds) and precision of measurement. The result of this data generation is a time series of regular time points and a specific value for each point. For example, consider a transmitting radio-frequency identification (RFID) chip embedded in a mine worker’s badge. The chip transmits a continuous stream of time and position data about the worker, allowing mine safety managers to know exactly where the worker is at all times. Such data have clear value if a mine accident occurs, where immediate response is critical to saving lives.

    Table 1. Sensor Types and Examples

    Sensor TypeExample
    TemperatureEngine running temperature
    Motion/VibrationSecurity motion detectors
    HumidityManufacturing room air moisture %
    ActuationLight on/off, door open/closed
    Flow RateFluid pump efficiency
    PressureTire inflation level
    ChemicalCarbon monoxide (CO2) detector
    Speed/AccelerationAir bag deployment
    Through-putFactory line production rate
    LocationRFID chip on merchandise

    Sensors can be built to transmit their measurements either over a defined physical connection, such as an RS232 serial interface, or wirelessly using one of several approaches, such as via a Bluetooth* connection. The only requirement is that the sensor be designed for the physical environment—temperature, shock, pressure, etc.—and that the connection be reasonably secure.

    Data Collection and Transport

    Sensor data are of little utility if they are not collected and transported to a point where they can be reviewed and analyzed. This is the purpose of the Intel Galileo and Edison boards (Figure 1) and the IoT Analytics site. These development boards can be connected (via wired Arduino connections or wirelessly via Bluetooth) to a variety of inputs limited only by the number of physical ports. Multiple boards can be interconnected to aggregate sensor data from a distributed network of sensor end points.

    Intel® Edison sensor data integration board
    Figure 1. Intel® Edison sensor data integration board

    The sensor data stream can be forwarded directly to the IoT Analytics site or preprocessed (to remove spurious measurements or gaps) directly on the board prior to retransmission to the IoT Analytics site. For more information, review the Intel Edison Development Board Summary (see the “For More Information” Section for a link).

    Processing and Storage

    The collected and preprocessed sensor data streams can now be collected directly at a secondary processing point, such as the IoT Analytics site (Figure 2). The IoT Analytics site provides a workspace (see the ”For More Information” Section for a link to installation instructions and more information) and a suite of tools for collecting, visualizing, processing, and alerting on sensor time series data. On the user dashboard you can see the current collection state of devices, the observations (measurements) taken over the past hour, and a running review of all user-configured alerts that have been triggered.

    The Intel® Internet of Things Analytics Dashboard
    Figure 2. The Intel® Internet of Things Analytics Dashboard

    The companion to this article uses the IoT Analytics web service application programming interface (API) to demonstrate how the collected data can be accessed for data mining and analysis. The example includes a sample application illustrating direct analysis from data collected on the IoT Analytics site.

    Qualities of Time Series

    As noted earlier, all sensor data consist of a collection of measurements taken at a specific point in time. This time series collection has a set of qualities that makes analysis of these data unique compared with other types of analysis, such as financial or product marketing:

    • Regular Interval of Collection (Temporal). Values are collected at defined, regular time points, such as seconds, minutes, or days.
    • Sequential Data Values (Dimensional). Values are collected in a sequential manner, with one following the next; the number of measurements in a particular time series set defines the “dimensionality” of the data stream.
    • Fidelity (Precision). The sensor values are reported to a well-defined accuracy of measured values (that is, instrument error). Note that the precision of the analyzed values can never exceed the precision of the original measurement—for example, if the measured value is 0.35, the analyzed values cannot have more than two decimal places of significance.
    • Range (Amplitude). The sensor values will have an expected range that is determined by the limits that the physical sensor itself imposes (that is, between −20 and 120 degrees F for a temperature sensor).

    Each element of a time series data set typically consists of a time–value pair, such as (t)ime = 0.55 sec or (v)alue = 40.5º C. If the periodicity of the sensor data stream is 0.05 seconds, then the next measurement is expected at t = 0.60 seconds, followed by t = 0.65 seconds, etc. This collection can be visualized in a two-dimensional plot, with time as the ordinate (x-axis) and reported value as the abscissa (y-axis). An example plot using the IoT Analytics site is provided in Figure 3.

    Sample time series carbon monoxide sensor plot
    Figure 3. Sample time series carbon monoxide sensor plot

    As you can see in the figure, the IoT Analytics site is capable of plotting time series data in a wide range of formats, including summarized by time period (minute, hour, date, week, month, year), as a line or area plot, and with the capability of “zooming” in on specific data sets for a more detailed view of the underlying data.

    Analysis and Modeling

    The science of time series analysis has a long and rich history. There are many approaches to processing the raw data that time points and values represent, more than can be discussed here. For a recent review of these techniques, see the article by T-C Fu, a link to which is available in the “For More Information” Section. Regardless of analysis technique, however, there are a few common features to time series data mining approaches.

    The raw time series data are only of limited use, such as visual inspection, without further analysis and modeling. Although it is certainly possible to set alarms based on maximum value limits (say, on a statistical basis of one-sigma variation), a more sophisticated approach mines the data for predictive patterns. In the example in Figure 3, imagine that a CO2 vehicle exhaust sensor is reporting measurements over a defined time period at a specific frequency. If this were part of a larger data set that collects multiple sensor data (such as engine temperature and fuel consumption), you could look for patterns by comparing variations in one plot with another to predict future vehicle maintenance.

    Regardless of the technique used to develop an analysis model, the raw data must first be modified or reduced to a workable format. A variety of techniques have been developed for time series data manipulation, but one of the most common is called Z-Normalization. This technique converts the time series raw values to values that have a median (average) of 0 and a standard deviation of 1.0. This conversion allows you to compare one time series data set directly with another, greatly simplifying the algorithm’s complexity. The restriction on this conversion is that the data points must have a Normal probability distribution, which is a standard “bell curve” of expected values within a specified range. For most sensor-sampled data, this curve has been found to be true, allowing general use of the technique.

    A predictive model that is based on “normal” (that is, nominal control) system behavior is usually required to detect anomalous system behavior. There are several ways to create such a model: using a well-established measured baseline (supervised), applying mathematical or engineering predictions of expected system behavior (semisupervised), or simply comparing the sensor data points against themselves at different times (unsupervised). In the final case, a selected time period is compared with another, perhaps using a sliding window, to check for unexpected values (see “For More Information”).

    To create these models, you apply an algorithm or approach against the data streams collected from the sensor. Common techniques include Fourier transforms (conversion of time series values to frequency of occurrence), dynamic time warping (aligning time series data sets irrespective of measurement times), and wavelet transforms (segmenting the time series data into increasingly smaller segments). A relatively new technique, termed Symbolic ApproXimation (SAX), uses a novel technique of converting the time series data to a defined symbolic set, such as letters of the alphabet, which permits the use of a variety of pattern-matching algorithms, including those developed for biologic sequence analysis of DNA, RNA, and protein (for example, bioinformatics).

    After you have selected an analytic approach, the next decision is how to detect anomalies. Traditionally, that has been accomplished either by recognizing outliers (called, statistical detection) or by calculating the difference between a “nominal” data curve and the measured series. This is known as a distance measure and is often calculated using the Euclidean or square difference between successive data points. The aggregation of these values provides a quantitative indication of difference between the two curves. If the nominal and measured time series differ by more than a given amount, the time series is flagged for further investigation. In addition, the pattern-matching (and scoring) algorithms developed for bioinformatics research can be used to quantitatively evaluate two (or more) time series.

    Presentation

    The final section of this article discusses ways to notify interested parties when anomalies are detected in a recorded time series. The IoT Analytics site provides a simple but powerful mechanism for alerting based a set of rules. As shown in Figure 4, you can define a group of specific rules for a sensor associated with a collection of devices. The conditions for rule execution can be evaluated for several common situations:

    • Basic Condition. The sensor value changes beyond or below a set limit.
    • Time-based Condition. The sensor value changes beyond or below a limit for a defined time period.
    • Statistical Variance Condition. The sensor variance (as measured by the statistical value of sigma) exceeds 2 or 3.
    • Sensor Change Detection (Single or Multiple). One or more sensors detect a change in condition (such as an activation/deactivation event).

    Figure 4. Intel® IoT Analytics anomaly alerting rule
    Figure 4. Intel® IoT Analytics anomaly alerting rule

    The registered user can then be notified of the rule activation either by email (using the address registered during account creation) or by sending an HTTP message to a specified address.

    These capabilities is adequate for most situations where sensor analysis is required, but as the next article will show, if a more in-depth analysis is required, then you can use the IoT Analytics web server API to retrieve the sensor data sets and conduct additional data-mining operations.

    Conclusion

    The proliferation of inexpensive but sensitive sensors and the ubiquitous nature of network connectivity have created the basis for a new way of evaluating and controlling the devices that surround us each day. By aggregating these sensor measurements and applying a set of simple analysis rules, it is possible to act proactively in the event of potential device failure or to more rapidly respond to changing environmental conditions. Moreover, by using a central aggregation site, such as the Intel IoT Analytics site, these sensor data can be subjected to sophisticated data-mining techniques that allow the creation and use of predictive behavioral models.

    For More Information

    About the Author

    Ben Lieberman holds a Ph.D. in biophysics and genetics from the University of Colorado, Health Sciences Center. Dr. Lieberman serves as principal architect for BioLogic Software Consulting, bringing more than 15 years of software architecture and IT experience in various fields, including telecommunications, airline travel, e-commerce, government, financial services, and the life sciences. Dr. Lieberman bases his consulting services on the best practices of software development, with specialization in object-oriented architectures and distributed computing—in particular, Java*-based systems and distributed website development, XML/XSLT, Perl, and C++-based client–server systems. Dr. Lieberman has provided architectural services to many corporate organizations, including Comcast, Cricket, EchoStar, Jones Cyber Solutions, Blueprint Technologies, Trip Network Inc., and Cendant Corp.; educational institutions, including Duke University and the University of Colorado; and governmental agencies, including the U.S. Department of Labor, Mine Safety and Health Administration and the U.S. Department of Defense, Military Health Service. He is also an accomplished professional writer with a book (The Art of Software Modeling, Benjamin A. Auerbach Publications, 2007), numerous software-related articles, and a series of IBM corporate technology newsletters to his credit.

  • Développeurs
  • Yocto Project
  • Internet des objets
  • Avancé
  • Intermédiaire
  • Informatique cloud
  • Internet des objets
  • Intégré
  • URL
  • Internet des objets
  • Internet of Things: Using MRAA to Abstract Platform I/O Capabilities

    $
    0
    0

    Contents

    1. Abstract

    This white paper explains the general usage of the MRAA APIs that can greatly simplify working with various types of devices, such as:

    • Analog input
    • Digital input and output
    • Pulse width modulation (PWM)
    • Inter-Integrated 2-wire bus (I2C) devices
    • Devices that use Universal Asynchronous Receiver-Transmitter (UART) hardware

    Instead of complete program examples, this document contains excerpts of C code that demonstrate the central principles of the MRAA APIs. To get the most out of the information in this document, you should know or have the following things in hand:

    • Familiar with the Linux operating system and C programming language.
    • Basic understanding of digital electronics and the use of GPIOs.
    • Have specification sheets for the devices that are to be used.

    Note: This document does not explain compiling or linking code, or installing software on a given platform.

    2. MRAA Overview

    MRAA (pronounced em-rah) is a low-level library written in the C language. The purpose of MRAA is to abstract the details associated with accessing and manipulating the basic I/O capabilities of a platforms, such as the Intel® Galileo or Intel® Edison boards, into a single, concise API. See below for more details:

    • 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.
    • By definition, all platforms vary. They each have different capabilities, pin numbers, and types of GPIOs. For instance, a GPIO pin may not support the same type of capabilities from one platform to the next. A pin may not even exist on a given platform. Further, the way in which GPIOs are configured on a platform depends on various factors. For instance, using a GPIO pin in one mode may preclude using another pin in another mode, or in using another pin at all. Therefore, MRAA makes developing programs less complicated because it can be used along with other software to create platform-independent code.
    • Note: Although MRAA can be used to write platform-independent code, developers are still responsible for ensuring that code is robust enough to accommodate the various limitations of the platforms it may run on.

    2.1. Obtaining MRAA APIs and API Documentation

    The MRAA package is already installed on Intel Galileo and Edison hardware and can be linked into your code as described below. You can also obtain recent versions from the Intel source code repository.

    API documentation is available at: http://iotdk.intel.com/docs/master/mraa/

    2.2. GPIO Pin Names

    This white paper refers to various “pins.” These hardware pins are typically referred to by a number. Pin numbers may also be prefixed by a character, such as “D” for digital or “A” for analog. For example, “D0” would refer to the digital pin 0, while “A3” would refer to the analog input pin 3. A pin may also be referenced as something like GPIO6, referring to GPIO pin 6, without the “D” or “A” reference to analog or digital.

    2.3. General MRAA Usage

    Before beginning to code, certain guidelines should be followed:

    1. The MRAA library must be linked into your software. Typically, you must first initialize MRAA with a statement, such as:
      		mraa_result_t rv;
      		rv = mraa_init();
      		if (rv != MRAA_SUCCESS)<report the error, insert your own code below>
      			. . .
    2. Many MRAA functions return an mraa_result_t value. It is important for you to confirm that the specific function succeeded.
    3. The examples in this document do not provide error-checking. It is highly recommended that you error-check everything.
    4. After initialization, you should indicate to MRAA that you will use a specific pin for a given purpose. The code examples used later in this document demonstrate this action.
    5. Once done (that is, before exiting the program), you should tell MRAA to release the pin(s) so that it cleans up any internal states. The code examples used later in this document demonstrate this action.

    2.4. MRAA Include Files

    The main Include file used for MRAA is mraa.h, along with any device-dependent Include files, for example:

    • An analog device would include:

    #include <mraa.h>
    #include <mraa/aio.h>

    • A digital device would add:

    #include <mraa/gpio.h>

    3. Using MRAA with Analog Devices

    An analog device is one that provides data in the form of a changing voltage level from 0 to the highest voltage supported. This data is typically referred to as the Analog Reference Voltage (AREF). For example, an analog pressure sensor may provide data as a voltage starting at 0 (indicating no pressure) and then increasing as the pressure increases. This sensor’s voltages are then interpreted and converted to a digital number by a device called an Analog to Digital Converter (ADC). The software controlling the sensor then reads this number generated by the ADC.

    The information below is important to have when interpreting data from an analog sensor. These items are discussed individually in the following subsections.

    1. The voltage reference (AREF) value
    2. The resolution of the ADC
    3. How to interpret thedata (depends on the type of sensor)

    3.1. Voltage Reference

    The voltage reference is typically 3.3 volts or 5.0 volts DC. However, the reference voltage may vary because some platforms, such as the Intel® Edison board, allow you to generate a custom AREF for the platform instead of using its own built-in AREF. Therefore, you need to know this AREF before you can obtain meaningful data from such devices.

    3.2. Analog to Digital Converter (ADC) Resolution

    The ADC resolution is very important, as it can determine the precision of your measurements. All ADCs in use on the Intel platforms support resolutions of 1024 (10 bits), and at least in the case of the Intel® Edison board, 4096 (12 bits).

    You can determine the approximate voltage “steps” that can be represented by dividing the AREF value by the ADC resolution. This number is then used by your application. To determine the voltage steps, divide the AREF of 5.0 volts by the ADC resolution of 1024. The result is that each step returned from the ADC represents approximately 4 millivolts.

    5.0 / 1024.0 = 0.00488 volts

    3.3. Interpreting the Data

    With the information above, you can determine the approximate voltage level present on the device’s analog input pin. The higher the ADC resolution, the more precise your voltage measurement will be.

    3.4. Analog Example

    The Grove Moisture sensor (http://www.seeedstudio.com/depot/Grove-Moisture-Sensor-p-955.html) is an example of a simple analog device. It is basically a resistor that changes the voltage level on the analog input pin based on how much moisture it detects. The example below demonstrates how the sensor works by connecting it to the A0 pin. The following code example shows how to initialize MRAA and the A0 pin, read and print its value, and then release the pin:

    		int main()
    		{
    			/* initialize MRAA */
    			mraa_init();
    			/* create an MRAA analog context */
    			mraa_aio_context m_aio;
    			/* initialize A0 for use as an analog input */
    			m_aio = mraa_aio_init(0);
    
    			/* read the value, an integer */
    			int value;
    			value = mraa_aio_read(m_aio);
    
    			/* print the value */
    			printf(“The value returned was: %dn”, value);
    
    			/* now release (close) the pin and exit */
    			mraa_aio_close(m_aio);
    			return(0)	;
    		}
    

    With an ADC resolution of 1024 (10 bits), the value returned will range anywhere from 0-1023. How you interpret this value is determined by the sensor’s design. In the Grove Moisture sensor example, assuming a 10-bit ADC resolution, the data sheet provides the following ranges for the dry, humid, and wet property values:

    • 0-300 = dry
    • 300-700 = humid
    • 700+ = wet

    Important: Each sensor is different and not all sensors are as easy to decode. Be aware of the following items:

    1. Some sensors are “jittery” (their output voltages fluctuate). If this is the case, it may be necessary to take several sample readings and then compute their average.
    2. If you are writing an MRAA driver for use on different platforms, it is important that you specify the correct AREF voltage in your code, and possibly the ADC resolution as well, that will be used in any computations. Otherwise, the data returned may not be usable. In the above example, we did not need to know the AREF voltage, but that is not the case for other more complex analog devices. On some devices, the precise value of the AREF voltage and ADC resolution will be required in order to determine the sensor's output.

    4. Using MRAA with Digital Devices

    A digital device is one that deals in LOW and HIGH values, where LOW refers to a low voltage level and HIGH refers to a high voltage level. Only two states can be represented. For example, in a 5.0v system, LOW might refer to 0 volts and HIGH might refer to 5.0 volts. Typically, however, HIGH is represented by a 1, and LOW is represented by a 0.

    Digital devices can be set up as an input or an output. For use as an input device, you would use MRAA to read the digital pin and return a value indicating whether the voltage was LOW or HIGH. Conversely, writing to a digital device causes the digital pin to be driven LOW or HIGH.

    MRAA provides an API for reading and writing the states of a digital pin. In addition, it is possible to attach a user supplied interrupt handler to a digital input. Interrupt handlers are discussed on page 9. To use MRAA’s digital input and output facilities you need this header file:

    #include <mraa/gpio.h>

    4.1. Digital Input Example

    As an example, take a simple digital input device such as a push button switch. When the switch is depressed, a HIGH voltage level is placed on the pin, otherwise a LOW level voltage is present.

    
    		int main()
    		{
    			/* initialize MRAA */
    			mraa_init();
    
    			/* create an MRAA digital context */
    			mraa_ai	o_context m_aio;
    
    			/* initialize D2 for use as a digital pin */
    			m_gpio = mraa_gpio_init(2);
    
    			/* configure the digital pin as an input */
    			mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
    
    			/* read the value into an integer */
    			int value = mraa_gpio_read(m_gpio);
    
    			/* print the value */
    			if (value != 0)
    				printf(“The button is being pushedn”);
    			else
    				printf(“The button is not being pushedn”);
    
    			/* now release (close) the pin and exit */
    			mraa_gpio_close(m_gpio);
    			return(0);
    		}
    

    As you can see, this is pretty straightforward. Notice also how we told MRAA to configure the pin as an input using mraa_gpio_dir(). Digital pins can be used for either input or output, unlike analog pins, which are always input only.

    4.2. Interrupt Handlers

    In some cases, you will not want to have to keep re-reading a digital pin to determine its status. Take for example a sensor that is attached to a motor for the purpose of counting revolutions per minute (RPM). In this case, it would be somewhat painful and error prone to keep re-reading the pin (the device) to detect changes constantly.

    MRAA provides the ability to create an interrupt handler and attach it to a pin. In this case, MRAA will ensure that your interrupt handler will be called whenever a specified change of the pin's state/transition occurs (LOW to HIGH or HIGH to LOW).

    With this capability, it is easy to write a simple counting function and tell MRAA to call this function whenever a specified transition occurs. Below is a simple example to count HIGH to LOW transitions and keep them in a counter.

    		/* first, create our counting variable */
    		volatile int counter = 0;
    
    		/* Now our simple counting function. */
    		/* This will be our interrupt handler. */
    		void intrHandler(void *arg)
    		{
    			counter++;
    		}
    
    		/* now in our main() function */
    
    		int main()
    		{
    
    			/* initialize MRAA */
    			mraa_init();
    
    			/* create an MRAA digital context */
    			mraa_aio_context m_aio;
    
    			/* initialize D2 for use as digital pin */
    			m_gpio = mraa_gpio_init(2);
    
    			/* configure the digital pin as an input */
    			mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);
    
    			/* now, setup an interrupt handler. */
    			/* Our function (intrHandler()) above will */
    			/* be called whenever the pin goes from */
    			/* HIGH to LOW */
    			 */
    			mraa_gpio_isr(m_gpio, MRAA_GPIO_EDGE_FALLING, intrHandler, NULL);
    
    			/* sleep for 5 seconds, and then print out the current */
    			/* value of counter */
    			sleep(5);
    
    			printf(“Counter = %dn”, counter);
    
    			/* now, stop the interrupt handler and cleanup */
    			mraa_gpio_isr_exit(m_gpio);
    
    			/* now release (close) the pin and exit */
    			mraa_gpio_close(m_gpio);
    			return(0);
    

    Observe the following in the example above:

    • The counting variable was declared with the volatile keyword. This is very important. The volatile keyword tells the C compiler that this variable may be modified without the knowledge of the compiler, so it prevents the compiler from doing any kind of optimization when dealing with that variable. Without the volatile keyword, the compiler may conclude that there is no way for the variable to actually change and therefore always end up printing '0' as the value in the above example due to optimization. Any variables that are manipulated in an interrupt handler that are exposed outside the interrupt handler should be marked volatile.
    • In addition to MRAA_GPIO_EDGE_FALLING, mraa_gpio_isr() also supports MRAA_GPIO_EDGE_RISING (to detect LOW to HIGH transitions), and MRAA_GPIO_EDGE_BOTH (to detect either transition).
      Note: Not all of the above transitions are supported on all platforms. The most common way to determine what is supported is checking the return value of mraa_gpio_isr().
    • The last argument passed to mraa_gpio_isr() is an optional user-supplied pointer value. This argument will be supplied to the interrupt handler intrHandler() as its only argument. We do not need this capability in the example above so we just pass NULL.
    • The call to mraa_gpio_isr_exit() disables the interrupt handler, which is highly recommended to clean up and avoid unfortunate surprises.
    • Only one interrupt handler can be in effect for a given pin. The total number of pins that can be driven via an interrupt handler at the same time is also platform-specific, as are the types of interrupts that can be used (MRAA_GPIO_EDGE_RISING or MRAA_GPIO_EDGE_FALLING or MRAA_GPIO_EDGE_BOTH). This is yet another reason to always error check the return values of MRAA functions.

    4.3. Digital Output Example

    As you can imagine, digital output is pretty straight forward. The example below causes a digital pin to be driven HIGH (1) and LOW (0) with a 1 second sleep in between. Something like this could be used to blink an LED connected to the pin.

    		int main()
    		{
    			/* initialize MRAA */
    			mraa_init();
    
    			/* create an MRAA digital context */
    			mraa_aio_context m_aio;
    
    			/* initialize D13 for use as a digital pin */
    			m_gpio = mraa_gpio_init(13);
    
    			/* configure the digital pin as an output */
    			mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
    
    			/* now run in a loop 10 times, blinking the output each second */
    			int i;
    			for (i=0; i<10; i++)
    			{
    				/* turn output on (HIGH) */
    				mraa_gpio_write(m_gpio, 1);
    				sleep(1);
    				/* turn output off (LOW) */
    				mraa_gpio_write(m_gpio, 0);
    				sleep(1);
    			}
    
    
    			/* now release (close) the pin and exit */
    			mraa_gpio_close(m_gpio);
    			return(0);
    		}
    

    As you can see, using digital I/O is pretty easy with MRAA. Interrupt handling is a little more complex, but as long as you are careful about the proper use of the volatile keyword for variables shared outside of the interrupt handler, it is simple and convenient to use for many applications.

    5. Using MRAA with Pulse Width Modulation (PWM) and Digital Devices

    Pulse Width Modulation (PWM) is a type of digital output. The output of a PWM pin is composed of two elements, the period and the duty cycle:

    • The period represents how often a pulse should be generated.
    • The duty-cycle represents how much of that period should be in the HIGH state.

    For example, if you have set a period of 2 milliseconds, and a duty cycle of 50%, then you will get a repeating pattern of 1ms HIGH and 1ms LOW, and then the period repeats. This capability can be used for a variety of functions, such as dimming an LED or controlling the speed of a motor by increasing or decreasing the duty cycle.

    5.1. General Rules of Use

    • MRAA provides the ability to configure a digital output to act as a PWM output. It is important to check your platform to find out which GPIOs can be used as a PWM output. This will vary from platform to platform.
    • Platforms vary in the lengths of the periods allowed; therefore, it's important to error check your MRAA calls.
    • Some devices have requirements for the lengths of the periods that can be used with them. For example, a servo motor will typically require a period of 20ms.
    • The header needed for using MRAA's PWM facilities is:

      #include <mraa/pwm.h>

    5.2. PWM Example

    In the example below, let’s pulse the brightness of an LED. We will do this by setting a period of 10 milliseconds and changing the duty cycle up and down every 100 milliseconds.

    		int main()
    		{
    			/* initialize MRAA */
    			mraa_init();
    
    			/* create an MRAA PWM context */
    			mraa_pwm_context m_pwm;
    
    			/* initialize D3 for use as a digital pin */
    			m_pwm = mraa_gpio_init(3);
    
    			/* set the period to 10ms */
    			mraa_pwm_period_ms(m_pwm, 10);
    
    			/* set the initial duty cycle to 0 */
    			mraa_pwm_write(m_pwm, 0.0);
    
    			/* enable PWM output */
    			mraa_pwm_enable(m_pwm, 1);
    		/* now run in a loop 10 times, dimming or brightening /*
    			/* the LED every 100ms */
    			int i;
    			float duty = 0.0;
    			for (i=0; i<10; i++)
    			{
    				/* first, start at 0% duty cycle and increase to 100% */
    				for (duty= 0.0; duty < 1.0; duty+=0.1)
    				{
    					mraa_pwm_write(m_pwm, duty);
    					usleep(100000);
    				}
    				sleep(1);
    				/* now decrease it to 0% */
    				for (duty= 1.0; duty > 0.0; duty-=0.1)
    				{
    					mraa_pwm_write(m_pwm, duty);
    					usleep(100000);
    				}
    				sleep(1);
    			}
    
    			/* disable PWM output and clean up */
    			mraa_pwm_enable(m_pwm, 0);
    
    			mraa_pwm_close(m_pwm);
    			return(0);
    			}
    

    Observe the following in the example above:

    • We used mraa_pwm_write() which accepts a floating point value between 0.0 (off, or 0% duty cycle) and 1.0 (on, or 100% duty cycle).
    • MRAA also provides a set of functions that allow you to specify the pulse width directly, rather than as a percentage of time (duty cycle). This can be useful in certain sensors that have specific requirements regarding the period and the amount of time during that period that the output must be HIGH.
    • MRAA has a variety of functions for setting the period in seconds, milliseconds (as we used in the example), and microseconds. MRAA  also has functions that allow you to set both the period and duty cycle with one function call.
    • A common issue you may run into is whether your platform supports the period your device requires. MRAA will return appropriate error codes if you set a period that is not supported by the underlying hardware.

    6. Using MRAA with Inter-Integrated Circuits (I2C)

    When using I2C, keep the following points in mind:

    • I2C is a 2-wire, bidirectional bus. It can operate at 100Khz, 400Khz, and 3.4Mhz.
    • I2C is composed of 2 signal lines: SCL (the clock) and SDA (the data).
    • I2C devices have an address that must be unique on a given I2C bus. Multiple devices can be connected to a given bus, but each must have their own unique address, and only one can be communicating at a time.
    • In addition to its address, I2C devices frequently have a set of registers (sometimes referred to as commands) that can be read or written to. It is via these register reads and writes to a given device that communication and control take place.
    • The header needed for using MRAA's I2C facilities is:

      #include <mraa/i2c.h>

    6.1. I2C Example

    In the example below, we query a real time clock I2C device module (the DS1307) and read the seconds register (0x00). We setup an MRAA I2C context on I2C bus 0, using the I2C address 0x68, and then read in the seconds register and print it every second for 10 seconds.

    Important: Many I2C devices have different requirements in terms of how data should be written to or read from the device. Refer to the device specifications for this information.

    		int main()
    		{
    			/* initialize MRAA */
    			mraa_init();
    
    			/* create an MRAA I2C context */
    			mraa_i2c_context m_i2c;
    
    			/* initialize I2C on bus 0 */
    			m_i2c = mraa_i2c_init(0);
    
    			/* now run in a loop 10 times, reading the seconds */
    			/* register and printing it.*/
    			int i;
    			for (i=0; i<10; i++)
    			{
    				char buf;
    
    				/* always specify the address */
    				mraa_i2c_address(m_i2c, 0x68);
    				/* read in 1 byte.  mraa_i2c_read() always reads */
    				/* starting at register 0x00 */
    				mraa_i2c_read(m_i2c, &buf, 1);
    
    				printf(“The seconds returned was: %dn”, buf);
    				sleep(1);
    			}
    			mraa_i2c_stop(m_pwm);
    			return(0);
    		 }
    

    Observe the following in the example above:

    • We used mraa_i2c_read(), which already starts reading at register 0x00. For more advanced usage, MRAA provides several more functions for reading and writing at a specific register, or reading/writing word (16bit) data. Which method to use depends on your device and the requirements of your software.
    • When reading word data, you may need to swap the bytes returned, depending on your device.
    • Some access methods work better with some devices. For example, one device we tried did not work properly using mraa_i2c_read(), and instead required mraa_i2c_read_byte_data(). Some experimentation may be necessary.

    7. Using MRAA with Universal Asynchronous Receivers/Transmitters (UART)

    Review the following:

    • A UART based device is basically a standard serial port device, such as the devices we used to connect to our computers using COM ports in the past. Typically, this connection is full duplex and runs at a specified speed (the baud rate). A common baud rate for many sensors is 9600 (or 9600 bits per second).
    • Essentially, you have two wires: TX (for transmitting) and RX (for receiving). In the case of most sensors, however, you will be using different voltage levels than what would be used on a traditional COM port that complies with the RS232 standard. Typically these voltages are 5.0v or 3.3v, whereas an RS232 COM port would typically use -15v to +15v. Do not connect such low voltage sensors directly to a COM port unless specifically supported by the sensor manufacturer. You could damage your equipment.
    • MRAA provides a mechanism where two digital pins D0 and D1 (on an Intel® Galileo or Intel® Edison board) can be routed to a hardware-assisted UART, allowing software to easily read and write data to a UART accessible device. Once MRAA has setup the proper routing of the pins, you then communicate to the device through a /dev/ttyX port using standard Linux read() and write().

    Note: MRAA will only arrange the proper routing of the pins to connect to a hardware UART; it is up to your software to open and setup the correct TTY device and begin communicating with it.

    • The header needed for using MRAA's UART facilities is:

    #include <mraa/uart.h>

    7.1. UART Example

    In the example below, we use a mythical UART based sensor attached to pins D0 and D1. UARTs are numbered in MRAA, so this will correspond to UART 0.

    It is important that, after opening the device, you properly enable and disable various line disciplines that are automatically applied to the serial device by the Linux kernel. We include a function called setupTTY() to do this, after we open the TTY device itself.

    		int setupTTY(int fd, speed_t baud)
    		{
    		  if (fd < 0)
    			return 0;
    
    		  struct termios termio;
    
    		  /* get current modes */
    		  tcgetattr(fd, &termio);
    
    		 /* setup for a 'raw' mode.  8bit, 1 stop bit, no parity, */
    		 /* no echo or special character handling, */
    		 /* no flow control or line editing semantics. */
    
    		  cfmakeraw(&termio);
    
    		  // set our baud rates
    		  cfsetispeed(&termio, baud);
    		  cfsetospeed(&termio, baud);
    
    		  // make it so
    		  if (tcsetattr(fd, TCSAFLUSH, &termio) < 0)
    			{
    			  fprintf(stderr, “%sn”, “tcsetattr failed”);
    			  return 0;
    			}
    
    		  return 1;
    		}
    
    		/* now our main function */
    		¬
    		int main()
    		{
    			/* initialize MRAA */
    			mraa_init();
    
    			/* create an MRAA UART context */
    			mraa_uart_context m_uart;
    
    			/* initialize UART 0 (pins D0 and D1 used for TX and RX) */
    			m_uart = mraa_uart_init(0);
    
    			/* now that we have our context, query MRAA */
    			/* to get the file name of the TTY device we need to open. */
    
    			char *devPath = mraa_uart_get_dev_path(m_uart);
    
    			/* if this fails, we can go no further */
    			if (!devPath)
    			{
    				fprintf(stderr, “%sn”, “Could not get device path”);
    				return 0;
    			}
    
    			/* now that we have a device path, open it and set it up */
    			int fd;
    			if ((fd = open(devPath, O_RDWR)) == -1)
    			{
    				fprintf(stderr, “%sn”, “Could not open device path”);
    				return 0;
    			}
    
    			/* now we are almost ready, call setupTTY() and from then on */
    			/* we can read/write to the device normally. */
    			/* We assume a baud rate of 9600/ */
    		if (!setupTTY(fd, B9600))
    			{
    				fprintf(stderr, “%sn”, “Could not setup TTY port”);
    				return 0;
    			}
    
    			/* now we can use standard read and write calls */
    			/* read(fd, ...) or write(fd, …) */
    
    			/* when we are done, close the device and exit */
    			close(fd);
    
    			return(0);
    		}
    

    Observe the following in the example above:

    • Using a UART-based device is a matter of having MRAA setup the pins properly, asking MRAA for the device path, opening and initializing the device path, and then using standard Unix* read() and write() calls.
    • Using read() and write() directly will block if there is nothing available to read. To avoid this blocking behavior, in most cases, you will want to create a function that can check to see if data is available before trying a read. This can be accomplished using the select() system call. See the UPM wt5001 driver for an example. This capability is implemented as a method called dataAvailable().
    • In the example, we assumed a baud rate of 9600, which is the most common. The 'B9600' constant is defined in the Linux system header files, and of course, other baud rates are available. You need to select the correct baud rate depending on the device you are using.
    • The setupTTY() function used in the example assumes the most common case. It is unlikely that you will run into a device that has other requirements in this regard, but it's something to keep in mind.

    8. Closing

    MRAA simplifies that process of accessing and manipulating the basic I/O capabilities of a platform like Intel® Galileo or Intel® Edison boards.  A powerful library, MRAA provides a consistent approach to using analog, digital, PWM, I2C, and UART devices with these and similar platforms. It is a key addition to anyone’s Internet of Things tool chest.

    About ICS

    Integrated Computer Solutions (ICS) fuses extensive domain knowledge and engineering expertise with a deep understanding of drivers, operating systems, and IoT sensors to develop custom, embedded systems that feature innovative, easy-to-use user interfaces that consumers have come to expect. ICS reduces complexity, costs, redundancies and development time while solving tough engineering challenges up front.

  • mraa
  • upm
  • driver
  • Edison
  • Intel
  • I2C
  • UART
  • GPIO
  • pwm
  • #intelmaker
  • I/O
  • Digital
  • analog
  • Développeurs
  • Linux*
  • Yocto Project
  • Internet des objets
  • C/C++
  • Avancé
  • Intermédiaire
  • Internet des objets
  • Contrat de licence: 

  • URL
  • Internet des objets
  • Intel® Edison Bluetooth* Guide

    $
    0
    0

    Abstract

    This document explains how to configure the Bluetooth* software stack on your Intel® Edison board.  It covers the BlueZ* software stack, basic Bluetooth operation, and the setup of various Bluetooth profiles including

    • Generic Attribute Profile (GATT)
    • Advanced Audio Distribution Profile (A2DP)
    • Human Interface Device (HID)
    • Personal Area Networking (PAN)
    • Serial Port Profile (SPP)
    • HID over GATT Profile (HOGP)
    • Heart Rate Profile (HRP)
    • Proximity Profile (PXP)
    • Time Profile (TIP)
    • File Transfer Protocol Profile (FTP)

    The complete document is in a PDF.

    http://download.intel.com/support/edison/sb/edisonbluetooth_331704004.pdf

     

     

     

  • Bluetooth
  • BLE
  • GATT
  • A2DP
  • HID
  • PAN
  • SPP
  • HOGP
  • HRP
  • TIP
  • FTP
  • BlueZ
  • Edison
  • Intel
  • intelmaker
  • Développeurs
  • Yocto Project
  • Internet des objets
  • Avancé
  • Débutant
  • Intermédiaire
  • Internet des objets
  • Intégré
  • URL
  • Internet des objets
  • Intel® Edison Wi-Fi* Guide

    $
    0
    0

    Abstract

    This document explains the configuration of the Wi-Fi* software stack on Intel® Edison development platform.  It covers

    • Wi-Fi* connections
    • Access Point setup
    • Wi-Fi* Direct

    For example, it will explain how to scan available networks, auto-reconnect after a reboot, and disable power management. The reader should have a basic knowledge of the Linux* operating system and Wi-Fi connectivity.

    The complete document is in a PDF.

    http://download.intel.com/support/edison/sb/edison_wifi_331438001.pdf

  • WiFi
  • wi-fi
  • Access Point
  • wifi direct
  • reconnect after reboot
  • Peer-to-Peer
  • wifi power management
  • ssh
  • WPA
  • Edison
  • ssid
  • p2p
  • ping
  • latency
  • Ad-Hoc
  • ad-hoc network
  • wpa_cli
  • dhcp
  • Développeurs
  • Linux*
  • Yocto Project
  • Internet des objets
  • Avancé
  • Débutant
  • Intermédiaire
  • Internet des objets
  • Intégré
  • URL
  • Internet des objets
  • Intel® Edison Native Application Guide

    $
    0
    0

    Abstract

    This document is written for software developers who are developing native software applications with C and C++ on the Intel® Edison Development platform. It covers basic preparation for setting up your host to develop apps for the Intel® Edison Development Board, and provides a sample application for a pedometer.  A pre-configured version of Eclipse can be downloaded from the Intel® IoT Software Downloads page

    The reader should have a basic understanding of C and C++ software development and knowledge of the Linux* operating system.

    The complete document is in a PDF.

    http://download.intel.com/support/edison/sb/edison_nag_331192003.pdf

  • Eclipse
  • native
  • toolchain
  • debugging
  • Edison
  • yocto plugin
  • C project
  • pedometer
  • Développeurs
  • Linux*
  • Yocto Project
  • Internet des objets
  • C/C++
  • Avancé
  • Intermédiaire
  • Internet des objets
  • Intégré
  • URL
  • Internet des objets

  • Intel® Edison Cloud and Middleware API Guide

    $
    0
    0

    Abstract

    The Intel® Edison Cloud and Middleware library,iotkit-comm, allows network-connected devices to conveniently discover and communicate with each other and the cloud. More specifically, the iotkit-comm library enables developers to write distributed applications composed of clients and servers. This library was designed primarily for Intel® Edison platform, but works well on other platforms too. Iotkit-comm comes in two flavors: C and node.js. This documentation focuses on the C version of the library.

    The complete document can be found at the link below.

    http://iotkit-comm-c.s3-website-us-west-2.amazonaws.com/api/index.html

  • Développeurs
  • Linux*
  • Yocto Project
  • Internet des objets
  • C/C++
  • JavaScript*
  • Avancé
  • Débutant
  • Intermédiaire
  • Internet des objets
  • Intégré
  • URL
  • Internet des objets
  • Flash Tool Lite User Manual

    $
    0
    0

    Introduction

    This document explains the installation procedure Flash Tool Lite for Windows*, Linux* and Mac* hosts. The tool is used to flash the firmware on Intel® Edison boards, but will expand to other IoT products in the future. Formerly, this tool was used in working with Intel® based phones and tablets for updates and now has been adapted for use on IoT products.

    This GUI based tool makes it much easier to manage firmware, and other updates, even your own. It is possible to customize the install, and include packages with the firmware update.  Rather than working in a command line interface, you can flash boards in a much easier fashion. Additionally, if you wish to use the functionality of the tool but within a command line, that is explained below.

    Prerequisites

    Operating Systems

    The tool is supported on the following operating systems:

    • Microsoft Windows* XP (32 bit)
    • Microsoft Windows* 7 (32/64 bit)
    • Microsoft Windows* 8 (32/64 bit)
    • Microsoft Windows* 8.1 (32/64 bit)
    • Ubuntu* 12.04 LTS 64 bit 
    • Mac* 10.9.5 64 bit 

    Installation

    The installation procedure is explained below for each operating system.

    Windows Installation

    1. Download and run the installation package

    2. When the setup wizard pops up, click Next.

    3. Select Standard installation and the wizard guides to completion. 

    4. Accept the License agreement, click Next. 

    5. Click next after screen documenting libraries and packages.  

    6. Select standard installation. 

    7. Retain the selections, click Next. 

    8. Click Install to complete. 

    A driver install may be specified after completion of the main wizard, answer yes and complete that install. 

    Linux Installation

    The Linux installation set up is only for 64 bit operating system. So, the versions supported in Ubuntu are Ubuntu 12.04 LTS 64 bit and above.

    1. Install dependent packages for the tool.

     Ubuntu 12.04LTS: 

    sudo apt-get install gdebi ia32-libs 

    Ubuntu 13.04 64bits and later:

    sudo apt-get install gdebi libncurses5:i386 libstdc++6:i386 

    2. Download the installation package and complete the install either through terminal or Ubunutu software center,

    a. From Ubuntu Terminal:

    sudo gdebi <name_of_flash_tool_lite.deb>

        (replace with correct name of the installation deb file)

    b. From Software center:

    The ”Ubuntu Software Center” will handle the installation, double-click on the .deb file and then click ”Install Package” and enter the password. The IPL license must be accepted. 

    Mac OS X Installation

    1. Open FlashToolLite.dmg and drag Flash Tool Lite into the Application folder.

    Configuring Edison Board

    The Edison board needs to be configured correctly for successful flashing. The Figure below shows the Adruino board. The position of the switch (between the standard USB and the micro USB) should be adjusted such that it is to be closer to the Micro USB connector (J16).

    The “J16” micro USB connector is connected to micro USB cable, with other end to the computer USB port. This provides power for the board.

    The edge or corner micro USB connector to the computer USB port through micro USB cable serves as a serial connection.

    Additionally, an external power supply can be utilized.

    Flash the Edison

    1. Launch Flash Tool Lite, Browse for FlashEdison.json, which is provided along with the package or download the latest firmware .zip file
    2. Select the FlashEdison.json file
    3. Open the file  
    4. Click Start to Flash
    5. Now disconnect and reconnect the micro USB cable for power (J16). The flashing process should continue and be completed successfully.

    Note: If the flashing on a Windows based system is extremely slow or gives a time out message, increase the rootfs timeout value by 25-50% in FlashEdison.json. Normally a firmware update flash should take less than 5 minutes. The .json file can be found in the .zip firmware archive.

    Example of firmware flash progress:

    Using the tool in command line

    The binary file for the command line tool is phoneflashtoollitecli.

    The -f option is a mandatory option, this command line tool is designed to flash a single device. Multiple instance of the phoneflashtoollitecli tool can be started in parallel for multi flash but in this case the user has to provide the android serial number (example: SERIAL95A45IE7) and/or the SOC serial number with the respective options --os-sn and --soc-sn.

    All command line options are available in the help message of the tool:

     phoneflashtoollitecli --help 

  • Développeurs
  • Arduino
  • Yocto Project
  • Internet des objets
  • Avancé
  • Intermédiaire
  • Intel® Edison platform
  • URL
  • Intel® Edison Audio Setup Guide

    $
    0
    0

    This document provides information about the audio subsystem on the Intel® Edison platform. It also provides hardware/software overviews. The audio features described in the document can be used with the latest firmware available on the Intel® Edison Software Downloads page.

    The complete document is in a PDF.

    http://www.intel.com/support/edison/sb/CS-035586.htm

  • Développeurs
  • Yocto Project
  • Internet des objets
  • Avancé
  • Débutant
  • Intermédiaire
  • Audio
  • Intégré
  • Intel® Edison platform
  • URL
  • Internet des objets
  • Die Developer Week 2015 - RealSense, IoT und noch viel mehr

    $
    0
    0

    Nächste Woche ist es soweit und einer der größten Entwicklerkonferenzen wird wieder eröffnet: Die Developer Week 2015. Ganz gleich ob man C/C++, Java, C#, JavaScript oder Objective-C Entwickler ist, für jede Welt wird ein volles Programm geboten.

    Der IoT-Day

    Es ist für mich eine Ehre, dass ich zum Adivsory Board der kommenden DWX 2015 Konferenz ausgewählt wurde. Ich war Programmverantwortlich für den IoT-Day und habe folgendes für euch kreiert:


    Der Tag beginnt mit Sascha Wolter. Er zeigt einen spielerischen Prozess, der die Ideenfindung als auch die praktische Umsetzung einbezieht und für jeden durchführbar ist: Sowohl beruflich, als auch mit Kindern.

    Nach der ersten Kaffeepause, verschafft Alexander Witkowski erstmal ein Überblick, über die aktuellen Embedded Rechner: Arduino, Raspberry Pi, Intel Galileo und Co.

    Als nächstes zeigen Johannes Hoppe und ich, die NodeJS-API des Intel Galileo Boards. Das bedeutet: Wir zeigen wie man mit JavaScript auf Sensoren zugreift.

    Gesättigt nach der großen Mittagspause, geht es mit dem großen Wissenshunger weiter. Kostja Klein zeigt, wie man mit großen Datenströmen in der Cloud umgeht und wie wertvolle Analysen durchgeführt werden.

    Wir haben nun einen Prozess zur Ideenfindung, einen Überblick zur Hardware und deren API´s und können klug mit Daten umgehen. Jetzt fehlt nur noch eins: Wie soll die zukünftige Bedienung von IoT-Lösungen aussehen? Genau das zeige ich mit meinem impulsiven Vortrag: Usability und UX für IoT.

    Gegen Ende führen dazu Thomas Endres und Martin Förtsch ein Praxisbeispiel vor: Gestensteuerung und die nächste Welle der 3D-Kameras. Ich kann nur eines zu diesem Vortrag verraten: Duckt euch! ;)

    Wie die letzten Jahre, wird dieses Jahr auch wieder Intel vor Ort einen Stand haben. Dazu wird auf jeden Fall noch mehr gezeigt, was sich hinter dem Intel Galileo Board oder dem Intel Edison verbirgt. Einen kleinen Vorgeschmack bietet mein Artikel: IoT mit dem Intel Galileo- und Edison-Board

    Kostenlose Community Night

    Wer selbst auch Hand anlegen möchte: Der kann dies kostenlos, mit dem Intel Galileo Board während der Community-Night. Hier werden Johannes Hoppe, Alexander Witkowski und ich einen gemeinsamen Workshop halten. Für die nötige Hardware ist gesorgt.

    Ich freue mich auf die ‪DWX15‬ und kann es kaum abwarten. Wer gerne dabei sein möchte, sollte mich am besten per E-Mail anschreiben. Ich habe nur noch einen „Ich kenne den Gregor“-Rabatt Gutschein (gregor.biswanger@ cleversocial.de). Wer Interesse hat, sollte sich daher ganz schnell mit mir in Verbindung setzen.

  • Intel Galileo Board
  • Intel Edison
  • Intel RealSense
  • html5 Intel XDK
  • Image de l’icône: 

  • Enseignement
  • Informatique cloud
  • Débogage
  • Éducation
  • Développement de jeu
  • Internet des objets
  • Bureau Microsoft Windows* 8
  • IU de style Microsoft Windows* 8
  • Mobilité
  • Code source libre
  • Informatique parallèle
  • Sécurité
  • Capteurs
  • Parallélisation
  • Interfaces tactiles
  • Expérience et conception utilisateur
  • Technologie Intel® RealSense™
  • Informatique perceptuelle
  • .NET*
  • C#
  • C/C++
  • Fortran
  • HTML5
  • Java*
  • JavaScript*
  • Python*
  • Qt*/QML
  • Unity
  • Wyliodrin
  • Android*
  • Client d’entreprise
  • Services Cloud
  • Code produit
  • Développement de jeu
  • HTML5
  • Technologie Intel® RealSense™
  • Internet des objets
  • Réseau
  • Serveur
  • Expérience utilisateur
  • Windows*
  • Caméra avant F200
  • Plate-forme Intel® Edison
  • Plate-forme Intel® Galileo
  • PC portable
  • Téléphone
  • Serveur
  • Tablette
  • Bureau
  • Développeurs
  • Développeurs Intel AppUp®
  • Partenaires
  • Professeurs
  • Étudiants
  • Android*
  • Apple iOS*
  • Apple OS X*
  • Arduino
  • Linux*
  • Microsoft Windows* (XP, Vista, 7)
  • Microsoft Windows* 10
  • Microsoft Windows* 8.x
  • Internet des objets
  • Inclure dans RSS: 

    1
  • Avancé
  • Débutant
  • Intermédiaire
  • 使用安卓* 电话通过英特尔® Edison的蓝牙串行端口 (SPP) 与Arduino代码通信

    $
    0
    0

    简介:

    在 Arduino 环境中,可以非常便捷地访问 BT SPP(比如串行端口),并响应 BT 串行端口 传来的命令字符串。 许多 Arduino 项目均运用这种方法支持项目的远程控制。 以前,您需要 采用额外的 BT shield 或 BT 套件在英特尔® Galileo 上存档。 现在,借助英特尔® Edison 的内置 BT 支持,您可以使用带有 Arduino breakout 开发板的 Edison 模块完成存档。 不再 需要额外的 BT shield。

    System Architecture

    要求:

    • Android* 手机或运行 Android 系统的平板电脑,且带有蓝牙。

    • 将英特尔® Edison 开发板连接至 Wi-Fi* 网络,请参阅: 英特尔® Edison 技术入门。 为您的 Edison 指定一个名称 ,比如:myedison。

    • SCP 使用连接至相同网络的主机计算机

    • 通过串行端口或 SSH 在开发板上建立 Terminal。

    背景:

    使用串行端口配置文件 (SPP) 连接英特尔® Edison 开发板和您的安卓* 手机介绍了如何运用 SPP 将 Edison 板连接至 Android* 手机。但是,无法从 Arduino 代码中的 SPP 获取输入。 蓝牙* LE (BLE) 助力英特尔® Edison 与安卓* 的连接 介绍了一种通过 Arduino 代码访问 BT 的方法,但需要采用 BT shield/套件。

    我们拥有内置 BT,为何不加以利用呢? 在此我提供一个关于使用 BT 的示例库。

    使用 mmap() 可有效地在英特尔® Edison 中实现 Arduino 与 Linux 的通信。 请参阅 Arduino* 和 Linux 本地进程实现高效通 信。 但是,使用 python 和 Arduino 进程之间的内存共享锁非常困难。

    因此,我选择了命名管道,以便轻松实施 Arduino sketch 进程和 BT SPP python 服务进 程之间的 IPC。

    Edison 蓝牙服务的设置为:

    1. 下载文件 bluetooth- service.tar.gz

    2. 将 bluetooth-service.tar.gz 复制到 /home/root/Bluetooth,并提取该文件

    mkdir /home/root/bluetooth cd /home/root/bluetooth mv
    
    /home/root/bluetooth-service.tar.gz ./ tar -xvf bluetooth-service.tar.gz

    3. 将 bluetooth-spp-pin.service 复制到 /lib/systemd/system/

    cp bluetooth-spp-pin.service /lib/systemd/system

    4. 启用 systemd 服务

    systemctl enable bluetooth-spp-pin

    5. 重启您的设备

    reboot

    6. 再次确认该服务

    systemctl status bluetooth-spp-pin

     

    Edison Arduino sketch 的设置为:

    1. 下 载库 Intel-Edison-BT-SPP- Library.zip

    2. 提 取至您的 Arduino 库路径,例如: C:\Users\username\Documents\Arduino\libraries, check it in your Arduino IDE, File->Preferences->Sketchbook Location

    3. 重 启您的英特尔® Arduino IDE v1.6.0 或更高版本

    4. 在 File->Examples->Intel Edison BT SPP Driver Library 路径下打开示例 bt_test

    5. 验 证并将 sketch 上传至您的 Edison

    6. 发 送内容后,打开 Serial Monitor 查看输出。

     

    手机的设置:

    1. 从 PlayStore 下载并安装任意 BT SPP 应用。 例如: BLE_SPP_PRO

    2. 在 手机上打开 BT,并连接至您的 Edison 模块

    3. 输 入 PIN 代码,默认 PIN 为 8888,稍后可在 bluetooth-pin-service.py 的第 70 行随意进行 更改。

    4. 在 应用中连接至 Edison,例如:myedison

    5. 向 您的 Edison 发送一些内容,Arduino IDE 的 Serial Monitor 应该会显示结果。

    Sent a string from BT SPP APP

    Recevied text via BT SPP

    结论:

    现在您拥有支持 SPP 的固定 PIN BT 设备。 您可以非常轻松地连接该设备,与连接至 BT 扬声器类似。 BT 自动启动后开始运行,您无需通过 terminal 配对该设备。 您可以访问 Arduino 代码中的BT SPP,将其当作串行设备对待,可通过带有 BT SPP 应用的安卓手机连接 至您的 Edison 项目。 这意味着您可以远程控制 Edison 项目,对项目进行任意操作。 以此 为基础,您可以借助英特尔® Edison 的内置 BT 功能开发有趣的应用。 尽情享用,并与我们 分享您的项目吧!

    后续工作:

    到目前为止,我们只能采用该方法将命令从您的 BT SPP 设备发送至 Edison。 你可以添加 其他 fifo 将命令从 Edison 返回至 BT SPP 设备。 由于是 fifo,Linux 环境下的应用还可 借此将命令发送至 Arduino 环境。 这样,创建更具多样化的方法实现与 Arduino 的互动既简 单,又轻松。 例如,您可以在 Linux 中处理音频,然后通过 fifo 将命令发送至 Arduino。 或者,您还可从 Node.js 获取 twits,然后将 JSON 发送至 Arduino 代码,以便与您的现有 Arduino shield 实现互动。 现在,一切已实现互连! 您还可以编写自己的安卓 BT SPP 应用 ,实现更多互动。

  • Intel Edison
  • Arduino IDE
  • Arduino
  • Bluetooth
  • Image de l’icône: 

    Fichiers joints: 

    https://software.intel.com/sites/default/files/managed/a7/45/Intel-Edison-BT-SPP-Library.zip
    https://software.intel.com/sites/default/files/managed/6c/16/bluetooth-service.tar.gz
  • Exemples de code
  • Article technique
  • Internet des objets
  • Bluetooth*
  • C/C++
  • Python*
  • Internet des objets
  • Intégré
  • Plate-forme Intel® Edison
  • Développeurs
  • Android*
  • Arduino
  • Projet Yocto
  • Internet des objets
  • Inclure dans RSS: 

    0

    Dernière mise à jour: 

    Samedi, 6 juin, 2015

    Co_author: 

    Hai Shen (Intel)
  • Débutant
  • Intermédiaire
  • Intel® MKL with Numpy, Scipy, Matlab, C#, Python, NAG and more

    $
    0
    0

    The following table lists links to the useful articles describing how Intel® Math Kernel Library (Intel® MKL) can be used with the third party libraries and applications.

     

    TopicsDescriptionThird Party Application/Tool
    Numpy/Scipy with Intel® MKLThis article intended to help current NumPy/SciPy users to take advantage of Intel® Math Kernel Library (Intel® MKL).Numpy/Scipy
    Using Intel® MKL in RThis article shows how to configure R to use the optimized BLAS and LAPACK in the Intel® Math Kernel Library (Intel® MKL).R
    Using Intel® MKL in GromacsThis article helps the current Gromacs* users get better performance by utilizing the Intel® Math Kernel Library (Intel® MKL). It explains how to build 64-bit Gromacs* with Intel MKL for Intel® 64 based applications.Gromacs*
    Using Intel® MKL in GNU OctaveThis article helps the current GNU Octave* users to incorporate the latest versions of the Intel® Math Kernel Library (Intel® MKL)  on Linux* platforms on Intel® Xeon® *processor-based systems.Octave*
    Using Intel MKL BLAS and LAPACK with PETScThis article describes how to build the Portable Extensible Toolkit for Scientific Computation (PETSc) with the Intel® Math Kernel Library (Intel® MKL) BLAS and LAPACK.PETSc
    Using Intel® MKL in your Python programThis article describes how to use the Intel® Math Kernel Library (Intel® MKL) from a Python* programPython*
    Performance hints for WRF on Intel® architectureThis article explains how to configure the Weather Research & Forecasting (WRF) run-time environment to achieve the best performance and scalability on Intel® architecture with Intel® software tools.Weather Research & Forecasting (WRF) Application

    HPL application note

    Use of Intel® MKL in High Performance Computing Challenge (HPCC) benchmark

    These guides helps the current HPL (High Performance LINPACK) users get better benchmark performance by utilizing Intel® Math Kernel Library (Intel® MKL) BLASHigh Performance Computing Challenge benchmarks

    Using Intel MKL with MATLAB

    Using Intel® MKL in MATLAB Executable (MEX) Files

    These guides helps the Intel® Math Kernel Library (Intel® MKL) customers use the latest version of Intel® MKL for Windows* OS with the MathWorks* MATLAB*.MATLAB*
    Using Intel® MKL with IMSL* Fortran numerical libraryThis article explains how to use the latest version of the Intel® Math Kernel Library (Intel® MKL) with IMSL* Fortran Numerical Library Version 6.0.0 on Intel® architecture systems under Microsoft Windows* systemsIMSL* Fortran
    Using Intel® MKL with the NAG* librariesThis article describes how to use the Intel® Math Kernel Library (Intel® MKL) with the NAG* libraries. Currently, Intel MKL is used for NAG's BLAS and LAPACK functionalities, with the addition of FFTs for NAG's Fortran SMP Libraries.NAG* libraries

    Using Intel® MKL in your C# program

    Some more additional tips "How to call MKL from your C# code"

    These articles describe how to call and link the Intel® Math Kernel Library (Intel® MKL) functions from your C# code. Examples are provided for calling the BLAS, LAPACK, DFTI (the FFT interface), the PARDISO direct sparse solver, and the vector math library (VML).C#
    Using Intel® Math Kernel Library and Intel® Integrated Performance Primitives in the Microsoft* .NET* FrameworkThis document explains how to call the Intel® Math Kernel Library (Intel® MKL) and Intel® Integrated Performance Primitives (Intel® IPP) from .NET Framework languages such as C#..NET Framework
    How do I use Intel® MKL with Java*?The Intel® Math Kernel Library (Intel® MKL) package contains a set of examples that demonstrate the use of Intel MKL functions with Java*. The Java example set includes Java Native Interface (JNI) wrappers. These Java examples are intended for tutorial use only.Java*
    Building MPICH1 with GNU FortranMPICH1 does not work with GNU Fortran out-of-the-box - this article describes the modifications that must be made for it to work properly.GNU Fortran
    C++ template math librariesThis article provides information about existing high-level C++ APIs available to invoke MKL functionality. 

     

     

  • scipy
  • numpy
  • matlab mkl
  • python mkl
  • C# mkl
  • java mkl
  • hpl mkl
  • nag mkl
  • hpcc mkl
  • imsl mkl
  • gromacs mkl
  • wrf mkl
  • Apple OS X*
  • Linux*
  • Microsoft Windows* (XP, Vista, 7)
  • .NET*
  • C#
  • C/C++
  • Fortran
  • Java*
  • Python*
  • Avancé
  • Débutant
  • Intermédiaire
  • Bibliothèque Intel® Math Kernel Library
  • Outils de développement
  • Code source libre
  • Optimisation
  • URL
  • Amélioration des performances
  • Développement multithread
  • Learning Lab
  • Intel® MKL VML Training Material


    英特尔®嵌入式在线培训

    $
    0
    0
    发布的英特尔® 嵌入式在线培训课堂旨在为高校教师提供基于英特尔® 凌动™ 嵌入式平台的最新技术培训及关于嵌入式课程教学交流与合作的平台,我们欢迎从事嵌入式系统开发领域的工程技术人员参与到英特尔® 嵌入式在线培训课堂学习交流。同时,我们特别安排了在线测试与反馈环节,帮助大家检验学习效果并提出反馈意见,最后还有机会获得英特尔® 软件学院的培训证书及丰富奖励。

     

    为了鼓励大家积极参与英特尔® 嵌入式
    在线培训课堂,我们为完成培训的学员准备了包括京东商城电子礼品卡,CSDN &《程序员》VIP 会员卡,英特尔® 嵌入式系列教材,ESDC 钥匙链等在内的丰富奖品。只要您完成在线培训,通过测试并提交反馈意见,就能获得英特尔® 软件学院的培训证书并有机会赢取上述丰富奖品。   【更多详情】

     

    该模块主要包含英特尔® 嵌入式大学合作
    计划及嵌入式系统发展的概要介绍。通过
    学习该模块,您可以了解英特尔® 嵌入式
    大学合作计划项目的背景及最新进展,并
    对嵌入式系统现状及未来发展有宏观上的认知。

    为了协助您确保英特尔® 嵌入式在线培训课堂的学习质量,您将在完成内容学习后通过 30 道选择题对学习效果进行检验。通过在线测试,您将全面了解自己在英特尔® 嵌入式系统方面的学习效果,并进行查漏补缺。

                       

    ..............................................................................................

    该模块介绍了英特尔® 嵌入式系统硬件方
    面的知识,包括最新的英特尔® 凌动™
    N2000 和 D2000 系列处理器平台,
    英特尔® 凌动™ 处理器平台特性及如何将
    您的嵌入式系统从其它平台移植到英特
    尔® 嵌入式平台的方法。通过学习,您将
    掌握最新的英特尔® 嵌入式系统硬件知识。

    我们邀请您在完成培训内容学习及测试后对此次在线培训进行反馈,您的意见及建议不仅有助于我们全面评估此次在线培训的效果,也能使我们改进将来的培训工作,从而能够更好的满足您学习需求。完成培训反馈后,您将获得英特尔® 软件学院培训证书及赢取奖品的机会。

                       

    ..............................................................................................

    该模块介绍了英特尔® 嵌入式系统硬件方
    面的知识,包括最新的英特尔® 凌动™
    N2000 和 D2000系列处理器平台,
    英特尔® 凌动™ 处理器平台特性及如何将
    您的嵌入式系统从其它平台移植到英特
    尔® 嵌入式平台的方法。通过学习,您将
    掌握最新的英特尔® 嵌入式系统硬件知识。

     

    ..............................................................................................

    我们特别邀请了国内外顶尖高校在嵌入式
    教学方面的资深教师分享他们的教学经验
    和教学资源。通过学习该模块,您不仅可
    以了解同行们丰富的教学经验,还可以学
    习借鉴他们的宝贵教学资源,改进嵌入式
    系统课程教学。

     
  • Curated Home
  • Développeurs
  • Professeurs
  • Étudiants
  • Débutant
  • Intermédiaire
  • Intégré
  • URL
  • 介绍一种服务器缓存结构 --- 多级 Hash

    $
    0
    0

           现在的服务器网络数据收发与存储没有不做缓存的。如果公司的重要数据存储在磁盘中,且数据接近静态但每天局有部更新而且也有大量访问,不做缓存不能发挥机器的高性能。

           一般地,公司内部都有集中固定型号的服务器,每种都有其性能极限,一般包括但不限于CPU计算能力、网卡收发包能力、内存容量以及磁盘容量和他的读写速度。多级hash即与内存容量有关。假设一台dell服务器内存是8G,如果用多级hash做缓存,那么就可以考虑给缓存的容量是6G,即一般内存容量的3 / 4 或者 2 / 3考虑用作缓存的极大容量。某种服务器为某种业务服务,简单的认为业务的值是key-value形式,一般地,key肯定有固定大小Ksize,value最大值也有极限值Vsize_max。

            由上面的一段文字,如果把多级hash作为服务器的缓存,你应该明白这个缓存有两个特点:第一,缓存有极限容量;第二,每个key-value元素有固定大小(Ksize + Vsize_max)。

           如果不考虑多级hash,只考虑上面两个特点,数据结构中最简单的hash表就可以胜任,不是么?不考虑在大内存中CPU对不懂缓存单元的寻址并把数据load到CPU cache中的时间差异(局部性原理),即认为在任何时刻CPU对缓存所有单元的访问速度是一个常数,hash表确实是极为完美的。

          一个简单的数组型hash表确实完美,但是hash表天生缺陷之一就是存储位置冲突。不考虑不同的值计算出同一个key值,我们认为不同的值有不同的key。若一个hash表的元素都存在其数组arr[hash.size]中,在简单的hash表中必有函数计算一个元素的存储位置时候,其简单的计算公式如key / hash.size。此时由于hash.size大小固定,必然存在若干个元素计算出同样的存储位置。不同的人针对这个难题有不同的解决方法。

        我的lisk中就有两种hash结构可以用来解决这个问题,一种是可伸缩的hashtable(以下称之为lisk_hashtable),一种就是多级hash(以下称之为lisk_mul_hash)。lisk_hashtable的特点以后予以介绍,现在先提下它的缺点。在内存允许的情况下lisk_hashtable可以自动扩大或缩小它自身的大小,它的极限大小的计算是不方便的。若极限大小不能方便计算出来存在的情况下,它就不方便作为服务器对外服务的缓存。而结构简单的缓存结构也方便别人维护。额外话题,服务器的特点第一是稳定,第二才是性能,一个性能很好的服务器但是她的服务时好时坏,用户会经常骂娘的,它能服务谁呢?而lisk_mul_hash是不考虑伸缩性的,你可以认为这是它的缺点,但是在服务器缓存极限容量存在的情况下,可伸缩性又有什么用?

        多级hash就能够实现上面提到的服务器缓存的两个特性。多级hash可提供插入、查找和删除操作。

        简单地,我们可以认为多级hash就是一个多维数组,行数一般在10到100之间,列数则不固定,元素大小固定。
        一般网上有一些多级hash实现,你会发现它们的关键实现就是一个多维数组。假若其关键结构是arr[3][10000],若一个元素的key是99995554,则寻找插入过程如下:
    1 在arr[0]的存储位置是99995554 / 10000 = 5554;
          2 如果arr[0]的5554位置已经被占用了,则使用arr[1]的5554位置;
    3 如果arr[1]的5554位置也被占用,则使用使用arr[2]的5554位置。
        上面每行都能存储10000个元素,同一个元素如果计算存储位置,在每一个行可以计算出同样的计算位置。考虑到离散数学中同余原理,每行最大元素数目不同且数字取质数为宜,每行的数字可依次递减。譬如第一行取比10000稍小的质数9973,第二行大小取值9969,第三行取值9949。
        所以若再次计算元素存储位置,则计算过程就稍微改变。计算过程如下:
        1 在arr[0]的存储位置是99995554 % 9973;
        2 如果arr[0]的存储位置99995554 % 9969 被占用,则使用arr[1]的99995554 %  9969位置;
        3 如果同样也被占用,则使用使用arr[2]的99995554 % 9949位置。
        考虑一个问题,上面计算key为99995554的元素的存储位置时, 如果三行的三个位置都被占用了,那么它将被存储到那里呢?这就是多级hash的一个特点,不保证所有元素都被存储下来。如果多级hash设计的好,只有很少量的元素找不到存储位置,他们被称为奇异值,这部分你可以另考虑别的方法来解决。譬如你就直接把他们存到磁盘上,文件分为索引文件和数据文件,分别存储key和value,并把索引文件通过linux的mmap接口映射到内存中来,以方便快速查找。
         即使多级hash中已经插不进新的元素,多级hash内部也肯定还有没有存储元素的位置。
         或者呢?我们可以接受多层hash不能饱和地存下所有元素的特点,其利用率达到85%就可以了,若达到90%就可以认为这个多级hash就可以被缓存不可用了。你需要升级服务器了。
        
        多级hash行数越多,其空间利用率越高,然查找速度便逐渐减慢。反之,行数越少,则多级hash查找速度越快,然空间利用率低下。所以行数应该被控制在50行以内,一般在20至35行之间为宜。


        lisk中多级hash也是一个多维数组,每行数目可以不同。如第一行实际存储数目极限是9973,则只申请9973个位置,可以不用申请10000个位置,以减少元素浪费。

        lisk中多级hash的每行列数目是递增的,lisk/exam/mul_hash_test.c利用随机数测试,这个多级hash几乎可以把所有元素存下来,即利用率几乎可达到100%。但它没有考虑如何存储奇异值。

     

          其实,关于缓存还有一些额外的话题。不管缓存的内存区是通过共享内存还是其他的os接口获得的,其中少被访问的数据几乎可能将被os swap out到虚拟内存中,一旦有访问者要访问这个数据,os需要先将数据swap in到内存中,然后再返回给访问者。如果平均访问响应时间是100ms,那么对这个数据的相应就可能在1s至2s之间。如果你认为这是不可接受的(其实我也这么认为),就可以通过mprotect接口禁止缓存中的数据被swap out。

            另外,如果银行等部门用C设计缓存时候,其对缓存中数据的可靠性是非常高的,即宁愿访问响应时间稍长一点也不会接受不可靠的数据。不考虑多线程情况,建议对共享内存数据的读取都使用volatile关键字。

            2月份曾经简要的谢过一篇多级hash的blog,里面介绍了一个windows上用vs2012编写的程序,可查看blog http://blog.csdn.net/menggucaoyuan/article/details/8617117。 

            如果对lisk感兴趣,请点击博客链接 http://blog.csdn.net/menggucaoyuan/article/details/8879898。 最近正在把它改成多线程版本,估计得半个月时间。        

  • Développeurs
  • Développeurs Intel AppUp®
  • Étudiants
  • Linux*
  • Serveur
  • C/C++
  • Intermédiaire
  • Serveur
  • URL
  • Exemple de code
  • Amélioration des performances
  • Bibliothèques
  • Développement multithread
  • PHP 多线程扩展(正儿八经的线程)pthreads 安装

    $
    0
    0

    环境CentOS 6.3 64bit,php 5.4.5

    pthreads需要线程安全环境,

    下载php的安装包,解压:

      tar zxvf php-5.4.5.tar.gz//名字是不是这个我不确定,自己去下载

    安装:

    ./configure --enable-zts --prefix=/usr/local/php-zts //或者 --enable-maintainer-zts

    make

    make install

    结果就把线程安装版的php安装到了/usr/local/php-zts,目前我不了解开启线程安全到底会带来什么影响,所以,就弄两个测试版本。

    如果遇到undefined reference to `executor_globals_id'

    make clean就可以了

    下载和安装pthreads:

    tar zxvf pthreads

    cd pthreads-0.0.45 // 本文的是第一个stable版本

    /usr/local/php-zts/bin/phpize
    ./configure --with-php-config=/usr/local/php-zts/bin/php-config
    make
    make install

     

    /usr/local/php-zts/bin/php -i|grep "php.ini"
    找出php.ini的位置,修改它把ext=pthreads.so加入进入进去,因为我原来就有php,现在新装的php.ini文件不存在我就考了一个过去……

    pthreads-0.0.45/examples目录下有些示例文件,比文档有用,在线文档根本不能说明问题,我修改了一个,执行了一下:

    <?php
    
    	/*
    
    	* Sharing symbols 101
    
    	* @NOTE Thread::fetch was never included in a release and was superceeded by object handlers
    
    	*  pthreads allows read access to thread data from any context
    
    	 pthreads allows write access to thread data from any context
    
    	 carry on reading ...
    
    	 work in progress ...
    
    	*/
    
    	class TestObject {
    
    	 public $val;
    
    	}
    
    class Fetching extends Thread {
    
    	 public function run(){
    
    	  /*
    
    	  * of course ...
    
    	  */
    
    	  $this->sym = 10245;
    
    	  $this->arr = array(
    
    	   "1", "2", "3"
    
    	  );
    
    	  echo '6'.chr(10);
    
    	  /*
    
    	  * objects do work, no preparation needed ...
    
    	  * read/write objects isn't finalized ..
    
    	  * so do the dance to make it work ...
    
    	  */
    
    	  $obj = new TestObject();
    
    	  $obj->val = "testval";
    
    	  $this->obj = $obj;
    
    	  echo '7'.chr(10);
    
    	  /*
    
    	  * will always work
    
    	  */
    
    	  $this->objs = serialize($this->obj);
    
    	  echo '8'.chr(10);
    
    	  /*
    
    	  * nooooooo
    
    	  */
    
    	  $this->res = fopen("php://stdout", "w");
    
    	  echo '9'.chr(10);
    
    	  /*
    
    	  * tell the waiting process we have created symbols and fetch will succeed
    
    	  */
    
    	  $this->synchronized(function(){
    
    	      $this->notify();
    
    	  });
    
    	  echo '10'.chr(10);
    
    	  /* wait for the process to be finished with the stream */
    
    	  $this->synchronized(function(){
    
    	      $this->wait();
    
    	  });
    
    	  echo '11'.chr(10);
    
    	 }
    
    	}
    
    	echo '0'.chr(10);
    
    	$thread = new Fetching();
    
    	echo '1'.chr(10);
    
    	$thread->start();
    
    	//sleep(1); 加了这个就不能正常工作,真奇怪
    
    	echo '2'.chr(10);
    
    	$thread->synchronized(function($me){
    
    	 echo '3'.chr(10);
    
    	    $me->wait();
    
    	 echo '4'.chr(10);
    
    	}, $thread);
    
    	echo '5'.chr(10);
    
    /*
    
    	* we just got notified that there are symbols waiting
    
    	*/
    
    	foreach(array("sym", "arr", "obj", "objs", "res") as $symbol){
    
    	 printf("$thread->%s: ", $symbol); 
    
    	 $fetched = $thread->$symbol;
    
    	 if ($fetched) {
    
    	  switch($symbol){
    
    	   /*
    
    	   * manual unserialize
    
    	   */
    
    	   case "objs":
    
    	    var_dump(unserialize($fetched));
    
    	   break;
    
    	   
    
    	   default: var_dump($fetched);
    
    	  }
    
    	 }
    
    	 printf("n");
    
    	}
    
    /* notify the thread so it can destroy resource */
    
    	$thread->synchronized(function($me){
    
    	    $me->notify();
    
    	}, $thread);
    
    	?>

    /usr/local/php-zts/bin/php Fetch.php

    结果:

    0
    1
    2
    3
    6
    7
    8
    9
    10
    4
    5
    $thread->sym: int(10245)
     
    $thread->arr: array(3) {
      [0]=>
      string(1) "1"
      [1]=>
      string(1) "2"
      [2]=>
      string(1) "3"
    }
     
    $thread->obj: object(TestObject)#2 (1) {
      ["val"]=>
      string(7) "testval"
    }
     
    $thread->objs: object(TestObject)#2 (1) {
      ["val"]=>
      string(7) "testval"
    }
     
    $thread->res: resource(3) of type (stream)
     
    11

    发个全点儿的php编译参数:

    ./configure
    --prefix=/usr/local/php-zts
    --enable-sockets
    --enable-pcntl
    --enable-maintainer-zts
    --enable-sysvmsg
    --enable-mbstring
    --with-mysql=/usr
    --with-mysql-sock=/var/lib/mysql/mysql.sock  
    --with-mysqli=/usr/lib64/mysql/mysql_config
    --with-pdo-mysql=/usr/lib64/mysql/mysql_config/configure
     

    我的QQ群:
    PHPer&Webgame&移动开发,群号:95303036

  • Curated Home
  • Développeurs
  • Étudiants
  • Linux*
  • Avancé
  • Intermédiaire
  • URL
  • Exemple de code
  • Amélioration des performances
  • Développement multithread
  • Intel® MKL PARDISO

    $
    0
    0

     

     

    The following is a compilation of the Intel® MKL PARDISO related articles from the Knowledge Base.

     

     

     

  • MKL PARDISO
  • PARDISO Landing Page
  • Avancé
  • Débutant
  • Intermédiaire
  • Bibliothèque Intel® Math Kernel Library
  • URL
  • Intel® Xeon Phi™ Coprocessor code named “Knights Landing” - Application Readiness

    $
    0
    0

    As part of the application readiness efforts for future Intel® Xeon® processors and Intel® Xeon Phi™ coprocessors (code named Knights Landing), developers are interested in improving two key aspects of their workloads:

    1. Vectorization/code generation
    2. Thread parallelism

    This article mainly talks about vectorization/code generation and lists some helpful tools and resources for thread parallelism.

    1) Vectorization

    • Intel® Advanced Vector Extensions 512 (Intel® AVX-512) will be first implemented on the processor and coprocessor and will also be supported on some future Intel Xeon processors scheduled to be introduced after Knights Landing.
      For more details on Intel AVX-512 refer to: https://software.intel.com/en-us/blogs/2013/avx-512-instructions.
    • Intel AVX-512 offers significant improvements and refinements over the Intel® Initial Many Core Instructions (Intel® IMCI) found on current Intel® Xeon Phi™ coprocessors code named Knights Corner.
    • Today’s Intel® Compiler (14.0+) has the capability to compile your code for Knights Landing and you can run your binary on Intel® Software Development Emulator (Intel® SDE).  Intel® Compilers are available as part of Intel® Parallel Studio XE (available for trial and purchase here) and product documentation can be found here.
    • Intel SDE is an emulator for upcoming instruction set architecture (ISA) extensions. It allows you to run programs that use new instructions on existing hardware that lacks those new instructions.
    • Intel SDE is useful for performance analysis, compiler development tuning, and application development of libraries.
    • Intel SDE for Sandy Bridge, Ivy Bridge, Haswell, Broadwell, Skylake (Client), Goldmont, and Knights Landing (KNL) is available here: http://www.intel.com/software/sde.
    • Please note that Intel SDE is a software emulator and is mainly used for emulating future instructions. It is not cycle accurate and can be very slow (up-to 100x). It is not a performance-accurate emulator.
    • Instruction Mix:
      • Intel SDE comes with several useful emulator-enabled pin tools and one of them in the mix histogramming tool.
      • This mix histogramming tool can compute histograms using any of the following: dynamic instructions executed, instruction length, instruction category, and ISA extension grouping.
      • The mix-mt tool can also display the top N most frequently executed basic blocks and disassemble them.
    • Plethora of information from instruction mix reports:
      • Top basic blocks in terms of instruction %, dynamic instruction execution for evaluating compiler code generation, function-based instruction count breakdown, instruction count of each ISA type etc.
      • With appropriate parser scripts you can also evaluate FLOP counts, INT counts, memory operation counts, SIMD intensity (operations/instructions), etc.

    Compiling your application for Knights Landing

    Use the latest Intel Compilers (14.0+) and compile with the “-xMIC-AVX512” compiler knob to generate Knights Landing (KNL) binary.

    To run your application on Intel SDE

    • sde –knl -- ./<knl.exe> <args.>

    OR you can run your MPI application as

    • mpirun –n <no. of ranks> sde –knl -- ./<knl.exe> <args.>

    To generate “Instruction Mix” reports using Intel SDE for different architectures:

    Intel Xeon Phi coprocessor

    Knights Landing

    • sde –knl -mix -top_blocks 100 -iform 1 -- ./<knl.exe> <args.>

    You can also run the corresponding Intel Xeon processor binary on Intel SDE for comparisons and analysis purposes:

    Intel Xeon processor

    Ivy Bridge

    • sde -ivb -mix -top_blocks 100 -iform 1 -- ./<ivb.exe> <args.>

    Haswell

    • sde –hsw -mix -top_blocks 100 -iform 1 -- ./<hsw.exe> <args.>

    It is recommended to generate instruction mix reports using single MPI/OpenMP* thread runs (OMP_NUM_THREADS=1) for analysis simplification purposes.

    For resolving thread parallelism issues refer to the thread parallelism section below.

    Example - Build and Run Application on Intel SDE

    SNAP kernel obtained from https://www.nersc.gov/users/computational-systems/cori/nersc-8-procurement/trinity-nersc-8-rfp/nersc-8-trinity-benchmarks/snap/.

    • Untar the SNAPJune13.tar.gz – tar xvzf SNAPJune13.tar.gz
    • Change directory into the ‘SNAPJune13’ directory – cd SNAPJune13
    • Change directory into the ‘src’ directory – cd src
    • Untar the src.tar – tar xvf src.tar
    • Edit the ‘Makefile’ as follows (vi Makefile):
      • Change the “FORTRAN = ftn” to “FORTAN = mpiifort”
      • Change the “FFLAGS = -O3 -mp” to “FFLAGS = -O3 –xMIC-AVX512 –g –openmp –parallel-source-info=2“
    • Source the latest Intel MPI & Intel Compiler (preferably 14+).
    • Build the executable by running make on the terminal – make
    • Copy the executable ‘snap’ from the ../SNAPJune13/src directory to the ../SNAPJune13/large directory.
    • Change directory into the ‘large’ directory – cd ../large/
    • Copy the large-2048nodes.input as large-1thread.input (cp large-2048nodes.input large-1thread.input)
    • Make the following changes to large-1thread.input file, change the following settings (vim large-1thread.input)
      • npey=1
      • npez=1
      • ichunk=8
      • nx=16
      • ny=16
      • nz=16
    • Run on the Intel SDE as follows: sde -knl -mix -top_blocks 100 -iform 1 -- ./snap ./large-1thread.input ./large-1thread.output
    • The run is completed when you see ‘Success! Done in a SNAP!’ on the stdout.
    • This will generate an ‘sde-mix-out.txt’ which contains the instruction mix information.
    • A snap shot of the instruction profile would look like –

    Example Analysis using instruction mix report from Intel SDE

    Extracted Kernel from http://www.berkeleygw.org/.

    Total Dynamic Instruction Reduction:

    • Intel AVX -> Intel AVX2 Reduction: 1.08x
    • Intel AVX2 -> Intel AVX-512 Reduction: 3.15x

    Function Level Breakdown

    Further Breakdown on isa-set categories

    Significant % of x87 code for Intel AVX and Intel AVX2 for this kernel.

    Basic Blocks

    Intel SDE also provided the top basic blocks for your run based on hot instruction execution.

    If you look at the top basic blocks, you see a significant number of x87 instructions in this kernel for the Intel AVX/AVX2 code. Below is just a snippet of the first basic block for Intel AVX2 instruction mix report.

    The corresponding source code for the above basic block is line 459 (as highlighted above).

    Looking at the source we observed there is “complex” division in line 459 involved in this statement and the compiler generates x87 sequence to conform to strict IEEE semantics and to avoid any overflows and underflows.

    The way to avoid this is to compile with -fp-model fast=2. This allows the compiler to assume that real and imaginary parts of the double precision denominator lie in the approximate range, so it generates simple code without the tricks above. It can then generate vector Intel AVX/AVX2 instructions for the entire loop.

    The EXECUTIONS count in the basic block is the number of times this basic block was executed, and ICOUNT gives the total number of instructions executed for this basic block for all the executions. Thus ICOUNT/EXECUTIONS give the total number of instructions in this basic block.

    In addition, combination of the vectorization optimization report generated by the compiler (using the –qopt-report=5) and SDE top basic blocks can be used for doing a first pass ‘vectorization study’. Compiling with –qopt-report=5 generates an optimization report file kernel.optrpt. You can look for the corresponding source line in the basic block (example the line 459 above) and map it to the optimization report generated by the compiler to find whether your loop/basic block was vectorized or not (if not, why not). In the optimization report, you can also look for messages like – if some arrays in the loop were aligned or unaligned.

    This is just an example of the kind of analysis that is possible with instruction mix reports from Intel SDE, but a lot more analysis is possible. For more details please see https://software.intel.com/en-us/articles/intel-software-development-emulator.

    Configurations for the run: The instruction mix for the extracted kernel was generated using Intel® SDE version 7.2, the application was compiled with Intel® Compilers version 14.0.2 20140120. The run was conducted by Intel Engineer Karthik Raman. For more information go to http://www.intel.com/performance.

    2) Thread Parallelism

    Efficient parallelism is key for applications in the HPC domain to achieve great performance and cluster scaling. This is more critical than before with the many core architectures (like Intel Xeon Phi coprocessor) and also the increasing core counts with Intel Xeon processors.

    The parallelism can be across several layers such as instruction level (super scalar), data level (SIMD/vectorization), thread level: shared memory (OpenMP) and/or distributed memory (MPI). Many HPC programs are moving to hybrid shared memory/distributed memory programming model where both OpenMP and MPI are used.

    You can test thread scalability and efficiency of your application using existing hardware (Intel Xeon processor and/or Intel Xeon Phi coprocessor (Knights Corner).

    Many tools are available for thread scalability analysis. A few are listed below:

    1. OpenMP scalability analysis using Intel® VTune™ Amplifier XE 2015
      Serial vs. Parallel time, Spin Overheads, Potential gains possible etc.
    2. Intel® Trace Analyzer and Collector
      To understand MPI application behavior, quickly find bottlenecks, and achieve high performance for parallel cluster applications.
    3. Intel® Inspector XE 2015
      Memory and threading error debugger and thread dependency analysis.
  • Intel® AVX-512
  • Knights Landing
  • Intel SDE
  • Intel® IMCI
  • Développeurs
  • Serveur
  • Intermédiaire
  • Compilateur Intel® C++
  • Intel® Many Integrated Core Architecture
  • Informatique parallèle
  • Vectorisation
  • Serveur
  • URL
  • Dernière mise à jour: 

    Lundi, 9 février, 2015
    Viewing all 677 articles
    Browse latest View live


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