Search This Blog

Thursday, 12 January 2017

OpenCL or CUDA

AMD vs. Nvidia: Should I go with OpenCL or CUDA? 

Which will perform best with applications?


If you’re looking for more information on CUDA and OpenCL, this is the article for you. We’ll give you a brief overview of what GPGPU is and look at how AMD, Nvidia, OpenCL & CUDA fit into the mix. Finally we will explain which applications work best with which brand of graphics cards, providing a list that gives a brief overview of CUDA/OpenCL support in a wide variety of professional apps.

Introduction to GPGPU(General Purpose computing on Graphics Processing Units)

If you’ve never heard of GPGPU or GPU acceleration, don’t worry, most people haven’t. OpenCL and CUDA, however, are terms that are starting to become more and more prevalent in the professional computing sector. OpenCL and CUDA are software frameworks that allow GPGPU to accelerate processing in applications where they are respectively supported.
So what exactly is GPGPU, or general purpose computing on graphics processing units? GPGPU is the utilisation of a GPU (graphics processing unit), which would typically only handle computer graphics, to assist in performing tasks that are traditionally handled solely by the CPU (central processing unit).
In traditional computing, data can be passed from the CPU to the GPU, the GPU then renders the data, but the GPU cannot pass information back. GPGPU allows information to be transferred in both directions, from CPU to GPU and GPU to CPU. Such bidirectional processing can hugely improve efficiency in a wide variety of tasks related to images and video. If the application you use supports OpenCL or CUDA, you will normally see huge performance boosts when using hardware that supports the relevant GPGPU framework.
So now you know what GPGPU is, how do OpenCL and CUDA fit into the equation? OpenCL is currently the leading open source GPGPU framework. CUDA, on the other hand, is the leading proprietary GPGPU framework.
Image result for AMD vs. Nvidia
Fortunately, AMD & Nvidia have made the debate slightly more black and white than it may have originally seemed. To cut to the chase, AMD support OpenCL and Nvidia support their own proprietary CUDA framework. So which framework do the major applications support you may ask? This is where things can get a little more complicated. Different apps support different GPGPU frameworks, in fact, some support both OpenCL and CUDA and some support neither.
Naturally your next question will be “does my application of choice support CUDA or OpenCL?”. Or “so if my application supports both, which should I go for?”. Don’t worry, that’s what we’re going to help you with today.
It should be noted that Nvidia cards actually support OpenCL as well as CUDA, they just aren’t quite as efficient as AMD GPUs when it comes to OpenCL computation. This is changing though as the recently released Nvidia GTX 980 is a very capable OpenCL card as well as a CUDA monster. We can only see Nvidia’s OpenCL performance getting better and better in the future and this is definitely something worth considering.
Image result for Where do Nvidia & AMD sit in the GPGPU spectrum?

What are the strengths of CUDA acceleration?

As we have already stated, the main difference between CUDA and OpenCL is that CUDA is a proprietary framework created by Nvidia and OpenCL is open source. Each of these approaches bring their own pros and cons which we will highlight in this section.
The general consensus is that if your app of choice supports both CUDA and OpenCL, go with CUDA as it will generate better performance results. The main reason for this is that Nvidia provide top quality support to app developers who choose to use CUDA acceleration, therefore the integration is always fantastic. For example, if we look at the Adobe CC, which supports both CUDA and OpenCL, CUDA accelerates more features and provides better acceleration to the features that both frameworks are able to power. If we look at Premiere Pro CS6, without CUDA only software based playback is available (source). For further reading, in a forum thread on Creative Cow an Adobe employee stated that in most cases CUDA will out-perform OpenCL (source).
Another good example of the difference between CUDA and OpenCL support can be seen in REDCINE-X. If you enable OpenCL only 1 GPU can be utilised, however, when CUDA is enabled 2 GPUs can be used for GPGPU.
Obviously because CUDA is a proprietary framework it requires Nvidia’s support and time to integrate it into applications, this means that the functionality is always fantastic. However, CUDA is not as easy for apps to adopt as OpenCL (as it is open-source). Regardless of this, CUDA is still supported by a wide variety of apps of which the list continues to grow.
As an easy rule of thumb, if your app supports CUDA, grab an Nvidia card, even if it also supports OpenCL.
Image result for nvidia cuda card

What are the strengths of the OpenCL platform?

So now onto OpenCL, the open-source GPGPU framework. We’ve already mentioned that if your software supports both OpenCL and CUDA, then go for CUDA, but what if OpenCL is the only choice?
Simply put, if OpenCL is your only option, go for it. For example Final Cut Pro X only supports OpenCL and we usually recommend that our users put AMD OpenCL cards into their systems if they use the popular video editing app. On a whole OpenCL integration generally isn’t as tight as CUDA, but OpenCL will still produce significant performance boosts when used and is far better than not using GPGPU at all.
As we stated earlier, Nvidia cards also utilise the OpenCL framework, but they aren’t as efficient currently as AMD cards (however, they are catching up fast). So if the apps you use are all exclusively OpenCL based and don’t have CUDA support, such as Final Cut Pro X, we recommend you equip your system with an OpenCL AMD GPU.
Image result for amd radeon graphics card

Conclusion

It’s pretty clear that GPGPU is a move in the right direction for all professional users. When supported it brings huge performance benefits to apps, especially when they deal with image and video.
Right now CUDA and OpenCL are the leading GPGPU frameworks. CUDA is a closed Nvidia framework, it’s not supported in as many applications as OpenCL (support is still wide, however), but where it is integrated top quality Nvidia support ensures unparalleled performance. OpenCL is open-source, and is supported in more applications than CUDA, however, support is often lackluster and it does not currently provide the same performance boosts that CUDA tends to.
In our view, Nvidia GPUs (especially newer ones) are usually the best choice for users, built in CUDA support as well as strong OpenCL performance for when CUDA is not supported. The only situation in which we would recommend an AMD GPU to professionals is when they are exclusively using apps that support OpenCL and have no CUDA option.
Should you be looking for a CUDA/OpenCL based Mac Pro 5,1 system then head over to our ‘Configure Your Mac Pro‘ page to put a system together or email us at build@create.pro.

Core Vs Clock

What Is a Core?

Each CPU “core” is actually a separate central processing unit, which is the part of the CPU that actually does the work. For example, a dual-core chip may look like a single CPU chip, but it actually has two physical central processing units on the chip.
Additional central processing units allow a computer to do multiple things at once. If you’ve ever used a single-core CPU and made the upgrade to a dual-core CPU, you should have noticed a significant difference in how responsive your computer is.
For example, let’s say you’re extracting an archive file and browsing the web at the same time. If you had a single-core CPU in your computer, web browsing wouldn’t be very responsive. The single core would have to split its time between web browsing and file-extraction tasks. If you had a dual-core CPU with two cores, one core would work on extracting the file while the other core did your web-browsing work. Web browsing would be much faster and more responsive.
Whether you’re doing multiple things at once or not, your computer is often doing system tasks in the background and you can benefit from additional cores to keep the operating system responsive. Applications can also be written to take advantage of multiple cores. For example, Google Chrome renders each website with a separate process. This allows Google Chrome to use different CPUs for different websites rather than using a single CPU for all browser-related tasks.
Image result for what is a core in cpu

Clock speed

Also called clock rate, the speed at which a microprocessorexecutes instructions. Every computer contains an internal clock that regulates the rate at which instructions are executed and synchronizes all the various computer components. The CPU requires a fixed number of clock ticks (or clock cycles) to execute each instruction. The faster the clock, the more instructions the CPU can execute per second.
Clock speeds are expressed in megahertz (MHz) or gigahertz ((GHz).
The internal architecture of a CPU has as much to do with a CPU's performance as the clock speed, so two CPUs with the same clock speed will not necessarily perform equally. Whereas an Intel 80286 microprocessor requires 20 cycles to multiply two numbers, an Intel 80486 or later processor can perform the same calculation in a single clock tick. (Note that clock tick here refers to the system's clock, which runs at 66 MHz for all PCs.) These newer processors, therefore, would be 20 times faster than the older processors even if their clock speeds were the same. In addition, some microprocessors are superscalar, which means that they can execute more than one instruction per clock cycle.

Clock Speed vs. Cores

CPUs have a clock speed – think of it as how fast the CPU does work. (That’s actually an imperfect analogy as the truth is a lot more complicated, but it will have to do for now.)
For example, Intel’s Core i5-3330 processor has a clock speed of 3 GHz and is a quad-core processor, which means it has four cores. All four cores in this Intel i5 processor are each running at 3 GHz.
Image result for Clock Speed vs. Cores

Dual Core, Quad Core & More

Phrases like “dual core,” “quad core,” and “octo core” all just refer to the number of cores a CPU has:
  • Dual Core: Two cores.
  • Quad Core: Four cores.
  • Hexa Core: Six cores.
  • Octo Core: Eight cores.
  • Deca Core: Ten cores.
Related image

Hyper-Threading

Intel CPUs use a technology referred to as “hyper-threading technology.” With hyper-threading, each physical core presents itself to the system as two logical cores. In the screenshot above, we’re not using an octo-core CPU – we’re using a quad-core CPU with hyper-threading.
This improves performance to some degree, but a quad-core CPU with hyper-threading is nowhere near as good as an octo-core CPU. You still only have four physical cores, although some tricks allow them to do a bit more work at once.
Have a question of your own about how technology works? Ask us on MakeUseOf Answers! This article was inspired by several good questions on MakeUseOf Answers.

Sunday, 25 December 2016

How to Install Android SDK and Android Studio

Related image
As a mobile developer, the Android SDK is an integral part of your development environment, and as such it’s important for new developers to know how to download and install Android SDK or, the more popular, Android Studio. The main difference between the two is package size, and features. The Android SDK is the bare bones version of the package and it doesn’t include either of the two IDEs (interactive development environments): Android Studio or Eclipse. Android Studio includes its own IDE as well as a second IDE, known as Eclipse. If you elect to download Android Studio, on the other hand, your package will contain both IDEs, as well as the Android SDK.
Don’t worry too much about this, as you can always download and install additional Android SDK packages later should you opt for the stand-alone SDK package as opposed to Android Studio.
Just for good measure, here’s how to install both. We’ll start with the bigger of the two packages, Android Studio.

How to Install Android Studio

Before we get started, you’ll need to ensure that you have installed JDK 6 or higher (JDK7 is required for Android 5.0 and higher) on your PC.
Note: All of the following instructions, as well as the installation tutorials are for your PC. You can’t download or install Android Studio on your Android device.
To check your version, open terminal (OS specific details below) and type:
javac -version
If the JDK doesn’t show up, or you have an older version and would like to upgrade, download JDK here.

How to Install Android Studio on Windows

windows logo
  1. Download and launch the .exe file to your PC from the Android Studio home page.
  2. Follow the instructions on the setup wizard to install Android Studio.
  3. If asked to point to where Java is installed, you need to set an environment variable in order to direct the installer to the proper location. To do that, select Start menu > Computer > System Properties > Advanced System Properties. From there you’ll open the “Advanced” tab and click “Environment Variables.” Here you’ll add a new system variable titled JAVA_HOME that points to your JDK folder.
For example:
C:Program FilesJavajdk1.7.0_21
The actual tools and other SDK packages are stored outside of the directory that contains Android Studio. To access the tools directly, open the command prompt (Apps > Windows System > Command Prompt) and use the following to find them:
Users<user>sdk

How to Set Up Android Studio on Mac OS X

mac logo
  1. Download the installer to your PC and launch the .dmg  file from the Android Studio home page.
  2. Drag and drop the .dmg into your Applications folder.
  3. Open Android Studio and follow the instructions from the setup wizard.
If you get a warning saying that the file is damaged and should be moved to the trash, go to System Preferences > Security & Privacy and under the “Allow applications downloaded from” section select “Anywhere.” From here you can repeat Step 3 and install the program.
To access Android SDK tools from the command line (Finder > Applications > Utilities > Terminal):
/users/Library/Android/sdk/

How to Set Up Android Studio on Linux

Linux  logo
  1. Download and unpack the ZIP file on to your PC. The installer is found at the Android Studio home page.
  2. Launch Android Studio by navigating to the/android-studio/bin/directory in Terminal (Applications > Accessories > Terminal) and execute the following:studio.sh
  3. Addandroid-studio/binto your PATH environmental variable so that you can start Android Studio from any directory.
  4. Follow the setup wizard and install SDK tools

Adding & Installing Packages

  1. Click “SDK manager” in the toolbar and select one of the following from the Tools directory:
    • Android SDK Tools
    • Android SDK Platform-tools
    • Android SDK Build-tools (select the highest version)
  2. And/Or select the following from the Android X.X (latest version) folder:
    • SDK Platform
    • System image for emulation, such as ARM EABI v7a System Image
  3. Click Install X packages
  4. Accept the license agreement
  5. Click Install

How to Install Android SDK

First, download the stand-alone SDK files to your Mac, Windows or Linux PC. Next…
Note: All of the following steps will take place on your PC. You cannot install Android SDK on your phone or tablet

Windows

  1. Double click the .exe
  2. Note the name and location of the SDK on your system so that you can refer back to it easily when using the SDK tools from the command line.
  3. Wait for the installation to finish, and Android SDK Manager will start automatically.

Mac

  1. Unpack the .zip file and move it to the desired location.
  2. Make a note of the name and location of the SDK directory on your system so that you can refer back to it easily when using the SDK tools from the command line.

Linux

  1. Unpack the .zip file.
  2. Make a note of the location of the SDK directory on your system so that you can refer back to it easily when using the SDK tools from the command line.

Wednesday, 23 November 2016

Electrical Power Usage Calculation in Units

Estimating Electricity Usage
When you get your electricity bill each month, you may not think a whole lot about what goes into it.
 But in reality, every appliance or electronic device adds a little something to your bill. By figuring out
what the biggest energy hogs are in your home, you can adjust your usage by unplugging or simply using the device less.
Every change you make should help whittle down your energy expenses.
Calculating the energy cost of an appliance or electronic device is fairly easy. Most devices have a label that lists how many watts it uses,
 either on the device or in the owner's manual. You will need to find this number to figure out how much the appliance is costing you.
You will also need to estimate how many hours a day you use a particular appliance.
  
The Wattage Label









If you can't find the wattage label, there are other options to determine how much power your device uses.
 For example, you can purchase a wattage measuring device, such as the Kill A Watt®. Simply plug your appliance
or electronic device into the Kill A Watt® to determine how much power it uses. Or you can contact the manufacturer,
with your model number, to find out how many watts a particular device consumes. You can also check the list at the
 bottom of the page for common wattage on household devices. Though your particular device may vary,
 it should give you a rough estimate of the energy expenses related to the device.

Calculate Electricity Consumption - 4 Easy Steps

STEP 1
Watts Per Day

To calculate energy consumption costs, simply multiply the unit's wattage by the number of hours you use it t
o find the number of watt-hours consumed each day. For example, let's say you use a 125 watt television for three hours per day.
 By multiplying the wattage by the number of hours used per day, we find that you are using 375 watt-hours per day.
125 watts X 3 hours =
375 watt-hours per day

STEP 2
Convert to Kilowatts

But electricity is measure in kilowatt hours on your electricity bill. Since we know that 1 kilowatt is equal to 1,000 watts,
 calculating how many kWh a particular device uses is as easy as dividing by 1,000.
375 watt-hours per day / 1000 =
0.375 kWh per day

STEP 3
Usage Over a Month Period

Now to find out how much that's actually going to cost you on your electric bill, you'll have to take the equation a bit further.
 First you'll need to figure out how many kWh the TV uses per month.
375 watt-hours per day X 30 days =
11.25 kWh per month

STEP 4
Figuring Out the Cost

Next, pull out your last electric bill and see how much you pay per kWh. For this example,
let's say you pay 10 cents per kilowatt hour. To find how much the TV is costing you in a month,
multiply your electricity rate by the kWh per month that you calculated above.
11.25 kWh per month X $0.10 per kWh =
$1.13 per month

Common Wattages for Household Appliances
The wattage on appliances or electronics varies by device. Typically, older model appliances
use more energy, but newer models tend to be more efficient. You can also purchase
ENERGY STAR appliances, which are among the most efficient appliances.
According to the EPA, here's a list of typical wattage levels for your everyday devices.
Coffee maker
900-1200 watts
Microwave
750-1100 watts
Toaster
800-1400 watts
Dishwasher
1200-2400 watts
Washer
350-500 watts
Dryer
1800-5000 watts
Iron
100-1800 watts
Ceiling fan
65-175 watts
Space heater (40gal)
4500-5500 watts
Hair dryer
1200-1875 watts
Laptop
50 watts
Computer monitor
150 watts
Computer tower
120 watts
Television 19"-36"
65-133 watts
Television 53"-61"
170 watts

Canan IR 3320 or 3320I

General Features
Device: printer/scanner/copier/fax;
Type of printing: black and white;
At work printing: Laser;
Placement: floor;
Sphere of application: large office;
Printer
The maximum size: A3;
Automatic two-sided printing: Yes;
The maximum resolution for b/w printing: 2400x600 dpi;
Print speed: 33 pages/minute (b/w A4);
Warm-up time: 40.2 to;
Scanner
Scanner Type: Tablet/prolonged;
Maximum Original Size: A3;
Shades of gray: 256;
Feeder originals: Bilateral;
Cam
Maximum Copy Resolution (B/W): 1200x600 dpi;
Copy speed: 33 pages/minute (b/w A4), 16 pages/minute (b/w A3);
Time to first copy: 6;
Rescaling: 25-800%;
Step zoom: 1%;
The maximum number of copies per cycle: 999;
Trays
Paper Feed: 4550 list. (Standard);
Paper output: 300 sheets. (Standard);
Finisher
Sort shift: Yes;
Expendables
Paper weight: 64-128 g/m2;
Printing on: card stock, transparencies, labels, glossy paper, envelopes, matte paper;
Drum life: 55,000 pages;
Memory/Processor
The amount of memory: 192 MB;
Hard Drive Capacity: 10 GB;
Fax
PC Fax: Yes;
Interfaces
Interfaces: Ethernet (RJ-45), USB;
Additional Information
OS Support: Windows, Mac OS;
Information Display: LCD Panel;
Power consumption (in operation): 1350 W;
Dimensions (WxHxD): 565x769x678 mm;
Weight: 80 kg;

Tuesday, 15 November 2016

Arduino lcd Tutorial

Lcd Arduino 16*2

The LiquidCrystal library allows you to control LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface.

The LCDs have a parallel interface, meaning that the microcontroller has to manipulate several interface pins at once to control the display. The interface consists of the following pins:

A register select (RS) pin that controls where in the LCD's memory you're writing data to. You can select either the data register, which holds what goes on the screen, or an instruction register, which is where the LCD's controller looks for instructions on what to do next.

A Read/Write (R/W) pin that selects reading mode or writing mode

An Enable pin that enables writing to the registers

8 data pins (D0 -D7). The states of these pins (high or low) are the bits that you're writing to a register when you write, or the values you're reading when you read.

There's also a display constrast pin (Vo), power supply pins (+5V and Gnd) and LED Backlight (Bklt+ and BKlt-) pins that you can use to power the LCD, control the display contrast, and turn on and off the LED backlight, respectively.

The process of controlling the display involves putting the data that form the image of what you want to display into the data registers, then putting instructions in the instruction register. The LiquidCrystal Library simplifies this for you so you don't need to know the low-level instructions.

Image result for 16*2 lcd


Hardware & Components

Arduino or Genuino Board
LCD Screen (compatible with Hitachi HD44780 driver)
pin headers to solder to the LCD display pins
10k ohm potentiometer
220 ohm resistor
hook-up wires
breadboard

Circuit Pin Modes 
Before wiring the LCD screen to your Arduino or Genuino board we suggest to solder a pin header strip to the 14 (or 16) pin count connector of the LCD screen, as you can see in the image above.
To wire your LCD screen to your board, connect the following pins:

LCD RS pin to digital pin 12
LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
Additionally, wire a 10k pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3). A 330 or 220 ohm resistor is used to power the backlight of the display, usually on pin 15 and 16 of the LCD connector

Connect the wire as in the Picture 

Arduino Codings  With library 

Or can get this codes from arduino, Files/Examples/LiquidCrystal 


*
  LiquidCrystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11 
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */


// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("Hello, ARDUINO");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}


                                                                                                   Follow the video for more Description