TBB for AMD prosser

本文介绍了Threading Building Blocks (TBB) 在AMD Athlon 64 X2双核处理器上的安装与应用过程。TBB是一款C++模板库,支持跨平台使用。作者在Gentoo Linux环境下成功构建并验证了TBB的多线程性能。

TBB可以在AMD的处理器上运行。
解释如下:

There have been so many questions, since the announcement of the Threading Building Blocks open source project, about whether TBB works on non-Intel (for example, AMD) processors. The answer is quite simple: yes. As the TBB Product Overview states, Threading Building Blocks:

Provides a single solution for Windows*, Linux*, and Mac OS* on 32-bit and 64-bit platforms using Intel®, Microsoft, and GNU compilers.


So, the question of whether TBB is a viable solution for applications that need to run on AMD processors (and what Linux or Windows app doesn’t need to run efficiently on AMD as well as Intel processors?) is one that can and should be set aside immediately.

Threading Building Blocks is a C++ template library, constructed using standard C++ library techniques. TBB is designed to be portable to any operating system that supports standardized C++ compilation. I myself am interested in looking into applying TBB on OpenSolaris. Much of my multithreaded development experience is on Sun Solaris machines, so it will be interesting to try out TBB on a Solaris platform.

But that’s in the future. Today, I’m quite thrilled about having a fully built and tested installation of Threading Building Blocks running on my AMD dual-core Athlon 64 system, on which I’m running Gentoo 2007, optimized for 64-bit Athlon processors.

Building TBB on Gentoo


Gentoo has its own peculiarities. I like it because the portage package manager lets me easily install exactly what I want to install, and nothing more. The result is that I have a very “clean” system to work with. While installing the operating system, I had to be sure to include the options for multithreading; as usual, the Gentoo documentation is very thorough, making it easy to find the switches you need and activate them.

I went to the ThreadingBuildingBlocks.org Downloads page, navigated to the “Commercial Aligned Release” (I wanted to start out with the stablest version available), and clicked the “tbb20_010oss” link. From there, I downloaded the tbb20_010oss_src.tar.gz and tbb20_010oss_lin.tar.gz files, and unpacked them into a directory on my hard drive.

Then, following the advice that was posted in response to my TBB Forums query about the Linux install package, I copied everything beneath my tbb20_010oss_lin directory into my tbb20_010oss_src directory. Doing this copied the em64t, ia32, and itanium directories from the *lin directory into the *src directory. I copied everything, but expected that I only really needed the em64t directory.

Next, I entered my tbb20_010oss_src directory and entered: make. And the build was off and running!

“Warning: not running on genuine Intel hardware”


The system chugged away for quite a long time, building and running test programs, the examples programs, etc. At one point, the scrolling paused, showing me this scary message:

Warning: not running on genuine Intel hardware


That was true, yes… And now that I’ve thought about it a bit more, that really is a rather curious message. Let’s see where it comes from.

Ah! I see it! It’s in file src/test/test_assembly.cpp:

static void TestIsGenuineIntel() {
if( !IsGenuineIntel() )
printf("Warning: not running on genuine Intel hardware\n");
}


The IsGenuineIntel() function can be found in src/tbb/task.cpp. It’s a static inline function that accesses data defining the CPU ID. It all looks rather innocuous. No, Intel hasn’t secretly disabled portions of the TBB library if you happen to be running on a processor that’s not “genuine Intel hardware.” If you don’t believe me, look at the code.

And that, indeed, is one of the primary benefits of making software open source. There cannot be anything to hide, because the source code is all there, available for scrutiny by anyone who’d like to take a look.

Yeah, my AMD Athlon 64 X2 really is a 2-core system!


As the automated test programs that are part of the TBB installation were running, I was able to see the processing times for various runs scroll by. The timings showed that when the programs were run with more than a single thread, the execution time was approximately half of the execution time for the single thread execution – proving that, indeed, I have a working AMD Athlon 64 X2 dual-core processor, and I can successfully utilize both cores by applying TBB while running on my favorite Linux distribution, Gentoo. Yeah!

Kevin Farnham
O’Reilly Media

Original:https://software.intel.com/en-us/blogs/2007/08/02/threading-building-blocks-amd-athlon-64-x2-and-gentoo-linux/

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值