Hide
Easily highlight source code for your blog with our Syntax Highlighter. Join Siafoo Now or Learn More

Random Developments Subscribe

Like you care.

Boost and Intel Compiler

over 7 years ago

I recently rediscovered the Intel C++ Compiler's free availability for non-commercial use and decided to try it on my own code and see what performance improvement I can achieve on my simulation code.

Installation was easy enough... unlike what the script tells you, you can disable SELinux enforcement by using:

setenforce 0

Anyway as soon I actually tried to compile my code I was faced with a ton of errors:

/usr/include/boost/type_traits/remove_reference.hpp(39): error: expected a ">"
 struct remove_rvalue_ref<T&&>
                          ^
/usr/include/boost/type_traits/is_rvalue_reference.hpp(21): error: expected a ">"
 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_rvalue_reference,T&&,true)
 ^

/usr/include/boost/type_traits/is_volatile.hpp(60): error: expected a ">"
  struct is_volatile_rval_filter<T&&>
                                 ^
/usr/include/boost/type_traits/remove_cv.hpp(44): error: expected a ">"
  struct rvalue_ref_filter_rem_cv<T&&>
                                  ^
/usr/include/boost/type_traits/is_const.hpp(69): error: expected a ">"
  struct is_const_rvalue_filter<T&&>
                                 ^
/usr/include/boost/type_traits/make_unsigned.hpp(38): error: expected a type specifier
     BOOST_STATIC_ASSERT(
     ^
/usr/include/boost/type_traits/make_unsigned.hpp(41): error: expected a type specifier
     BOOST_STATIC_ASSERT(
     ^

I tracked down the problem to the following type of statement:

template <class T>
struct remove_rvalue_ref<T&&>
{
  typedef T type;
};

And the solution was to add -std=c++0x to the Intel compiler flags.

Also another thing to note is that the to use OpenMP with the Intel Compiler you only need to specify the -openmp flag.

Only free, if your time is.

over 8 years ago

For the past week I have been completely unable to use eclipse due to a horrible horrible nasty nasty hard crash, when I tried to open a project. The crash looked like:

[stou@cipher tools]$ ./eclipse/eclipse
*** glibc detected *** /usr/bin/java: free(): invalid pointer: 0x000000000145cdb0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x32ec279714]
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server/libjvm.so(+0x42e658)[0x7f4f3de77658]
/home/stou/tools/eclipse/configuration/org.eclipse.osgi/bundles/197/1/.cp/libswt-pi-gtk-
    3655.so(Java_org_eclipse_swt_internal_gtk_OS__1g_1data_1input_1stream_1read_1line+0xe7)[0x7f4f30a80b52]
[0x7f4f39ec9ca8]
======= Memory map: ========
00400000-00408000 r-xp 00000000 08:03 13107694  /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java
00608000-00609000 rw-p 00008000 08:03 13107694  /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java
00f6d000-0645b000 rw-p 00000000 00:00 0         [heap]
d8000000-db7d0000 rw-p 00000000 00:00 0
db7d0000-e8000000 rw-p 00000000 00:00 0
e8000000-e9ab0000 rw-p 00000000 00:00 0
e9ab0000-f8000000 rw-p 00000000 00:00 0
f8000000-100000000 rw-p 00000000 00:00 0
32c9800000-32c9804000 r-xp 00000000 08:03 3145814                        /lib64/libuuid.so.1.3.0
<a few pages of similar crap>

best of all the Automatic Bug Reporting Tool that comes with Fedora , and I just got used to using, was totally useless in this instance.

I was too busy with grading and other school related activities to try to get to the bottom of this crash... until today. After a 5 minute internet search I found the cause and solution to this problem. It turns out that something in KDE sets MALLOC_CHECK_=3 which catches some bug in eclipse... which somehow crashes the whole JVM. Anyway doing an unset MALLOC_CHECK_ fixed the issue.

Someone, probably an Apple/Microsoft fan boy, said... "open source is only free if your time is"...

Crapps Be Gone

over 8 years ago

Every AT&T mobile phone (except the iPhone) comes with a ton of crappy AT&T branded applications (henceforth known as crapps or crapplets). These crapplets generally don't add any functionality to your phone since they either duplicate exiting [better] solutions (e.g. AT&T Maps ) or are generally useless (Mobile TV). My new Android powered Samsung Captivate came with a bunch of them too:

http://www.siafoo.net/image/200

Since I have always hated the fact that I could not remove these apps from my phone I decided to root it and remove them. This is what you can do to free yourself:

Note

There's probably an easier / better way to do this...

Warning

If you brick your phone (which is unlikely)... it's not my fault.

  1. Root your phone. It took me less than 5 minutes to root my (AT&T's Galaxy S variant) using instructions found on the internets.
  2. Launch the super user application (Ninja icon)

There are two ways to continue: With the Android SDK and without.

If you have the Android SDK:

  1. Connect your phone to your computer and open a shell into the phone using the adb shell command.

  2. (optional) Make a backup of the files using the File Explorer feature of the Dalvik Debug Monitor (ddms:

    http://www.siafoo.net/image/201
  3. Type su in the shell and you should see the Superuser Request box on your phone.

    http://www.siafoo.net/image/204
  4. cd /system/app and delete the application packages you don't want, such as AT&T Maps, AT&T Navigator, YP Mobile, What, IM service, and MobiTV using the usual shell command rm.

If you don't have the SDK:

  1. Get Connectbot the Android SSH client

    http://www.siafoo.net/image/198
  2. Connect to a local root session:

    http://www.siafoo.net/image/199?w=250

Note

Connectbot and Swype have some issues together (i.e. backspace doesn't work) so you should switch your input to another keyboard until this is fixed.

  1. Type su in the shell and you should see the Superuser Request box:

    http://www.siafoo.net/image/203
  2. cd /system/app and delete the application packages you don't want, such as AT&T Maps, AT&T Navigator, YP Mobile, What, IM service, and MobiTV using the usual shell command rm.

    http://www.siafoo.net/image/205

Some crapps lead to web address but those still live in /system/app you just have to use something like AStro File Manager to figure out what is what:

http://www.siafoo.net/image/206

On my Captivate AT&T Family Map was called androidlauncher2.1-61x612010_06_11t15_49.apk and AT&T Hotspots was called WISPr_v41.apk

Anyway eventually you end up with something like this:

http://www.siafoo.net/image/202

OpenCL screen corruption

over 8 years ago

One of the things I've been working on lately involves smooth particle hydrodynamics (SPH) with OpenCL... anyway last night I tried to simulate 100k particles on my GeForce 9800 (and naive memory management)... it ran out of resources and crashed resulting in total and massive screen corruption:

http://www.siafoo.net/image/197?w=600

Everything still worked and I could use the KDE 4.4 with compositing and everything but the whole screen was speckled. The problem only cleared up after I rebooted the machine (i.e. restarting X did nothing).

Python bindings for OpenCL

over 8 years ago

A Google query for "OpenCL python bindings" makes it seem that the only option for using OpenCL from Python is the Python-OpenCL library. However the better option, and the one listed on the Khronos OpenCL resource page, is PyOpenCL.

I tried Python-OpenCL but it didn't actually work and there is no documentation... even the auto-generated docs point to missing pages. PyOpenCL on the other hand seems fairly active, well documented, works, and uses Boost::Python. Anyway save yourself an hour and use PyOpenCL.