Saturday, July 14, 2012

Integration of SQLite3 and Netbeans C/C++ IDE

Few days back, I wanted to use SQLite database for one of my project. I spend couple of hours to find a way to integrate with Netbeans. Maybe many of us will be clever enough to just follow the information given on SQLite website to accomplish this task, but people like me can follow this blog post :)
I am using Netbeans C/C++ IDE ver. 7.1.2 and SQLite ver. 3.7.13 and Windows 7 OS.


Download links for:
I hope, all above files are being downloaded in one folder for future use or give away to others :P

Installation Procedure:
Installation of Cygwin, Netbeans, and SQLite Database browser is straight forward, hopefully for everyone. But in order to install SQLite source code that we downloaded before, need procedure given below.

Compile SQLite using Cygwin:
Open Cygwin Terminal, then;
  1. Locate Z:\Cygwin\home\your_name. 'Z' is the drive name where Cygwin is installed, and 'your_name' is YOUR NAME :P.
  2. Copy source code file 'sqlite-autoconf-3071300.tar.gz' to directory mentioned in point 1.
  3. Start Cygwin.
  4. Enter into Z:\Cygwin\home\your_name. By default, Cygwin terminal is in home\your_name directory. You can check using 'pwd' command, if response is negative then use 'cd' to change directory.
  5. tar -xzvf sqlite-autoconf-3071300.tar.gz (To unzip)
  6. Enter sqlite-autoconf-3071300, e.g. cd sqlite-autoconf-3071300. Then
  7. ./configure
  8. make
  9. make install
Great, we compiled the SQLite, but what we are interested in are two library files which are located in C:\cygwin\usr\local\lib, and SQLite3 Header file located in C:\cygwin\usr\local\include. These header and library files will be used in linking Netbeans project with SQLite database;
  • sqlite3.h
  • libsqlite3.a
  • libsqlite3.dll.a
Include Header and Library files in Netbeans:
  • Include header file; #include <sqlite3.h>
  • Go to project settings of your Netbeans project. Then 'build->linker->libraries', and give reference to above two libraries.
And we are done here, now we can write queries and access database using C/C++ code.

Thursday, November 17, 2011

SESC: Simulator Configuration with CMP

Note: I am using LINUX with following specifications, g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1.

Installing SESC first time, then follow this post SESC Simulator: First Time Installation for instructions.

Building SESC:
Make new directory ‘buildcmp’ in ‘sesc’ folder;
Simulator can be configured as many set of operations, so recommendation is to create different ‘build’ directory for each configuration.
> mkdir buildcmp
> cd buildcmp

Configuring SESC For SMP:

> ../sesc/configure --enable-smp

Executable SESC with SMP:

> make
’sesc.smp’ is the executable file for further testing. 

Configuration File:
In case, you want to test simulator with CMP configurations without changing any parameter, there is one file ‘cmp.conf’ present in ‘/sesc/confs/’ folder.

Copy cmp.conf and shared.conf file in the build folder;
> cp ../sesc/confs/cmp.conf /home/user/build/
> cp ../sesc/confs/shared.conf /home/user/build/

Running FFT Benchmark:
There are few benchmark applications are available in ‘/sesc/tests/’ folder to test previously build simulator. While running this test simulation, crafty benchmark is used. 
> ./sesc.smp -c cmp.conf ../sesc/benchmark/fft.mips

Output:
The generated simulator output file will be with the name ‘sesc_fft.xxxxxx’. The extension ‘xxxxxx’ is random and will be different every time benchmark is tested.

static[0x1006b810-0x10085ec4] heap[0x10086000-0x18086000] stack[0x18086000-0x1887e000] -> [0xae000000-0xb68127f0]

FFT with Blocking Transpose
   1024 Complex Doubles
   1 Processors
   65536 Cache lines
   16 Byte line size
   4096 Bytes per page

                 PROCESS STATISTICS
            Computation      Transpose     Transpose
 Proc          Time            Time        Fraction
    0                66             13       0.19697

                 TIMING INFORMATION
Start time                                 :       1735893725
Initialization finish time              :       1735893730
Overall finish time                     :       1735893796
Total time with initialization       :               71
Total time without initialization  :               66
Overall transpose time             :               13
Overall transpose fraction        :          0.19697

SPLASH2 Benchmarks:
SPLASH2 Benchmark consists of different applications that can be run on SESC Simulator in order to evaluate cycles, power, and energy performance according to the parameters set in configuration file (sesc.conf).
Download Splash2 Benchmark Kernels Applications.

Other Links: