由买买提看人间百态

topics

全部话题 - 话题: unroll
1 (共1页)
r****t
发帖数: 10904
1
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
有没有比较巧妙的 macro 可以 unroll for loop 呢? compiler #pragma unroll 失
败了,手工 unroll 发现很值得。
我写了这个,但是编译的时候错误是:
error: identifier "forloop" is undefined
#define forloop(n) if (n>0) do_something_with_n(n) ; forloop(n-1)
l******e
发帖数: 12192
2
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
可以用template unroll,很neat
不过,过度unroll不是好事
d*****u
发帖数: 43
3
来自主题: Programming版 - c++的一个诡异问题,高手请进
The difference is from inline optimization of the compiler.
When the function is inlined, the compiler has more information and
opportunities to optimize the code. At inlining, the compiler can emit
different code for the inner most loop body a+=i; .
On my VS2013, a+=i is as follows in Tempfunction():
movsd xmm0, QWORD PTR [eax] // load a
addsd xmm0, xmm1 // a += i
addsd xmm1, xmm2 // i += 1
movsd QWORD PTR [eax], xmm0 // save a
comis... 阅读全帖
a*******e
发帖数: 12169
4
帮你查到,好像Pillsbury® Crescent Recipe Creations®也行
Blueberry, Walnut and Brie Tartlets
http://www.pillsbury.com/recipes/blueberry-walnut-and-brie-tart
1
can (8 oz) Pillsbury® refrigerated reduced fat crescent dinner rolls or
1 can (8 oz) Pillsbury® Crescent Recipe Creations® refrigerated
seamless dough sheet
1/4
cup blueberry or blackberry preserves
1/3
cup coarsely chopped walnuts, toasted
1
round (8 oz) Brie cheese, rind removed, cut into 24 chunks
Fresh blueberries or fre... 阅读全帖
m*e
发帖数: 1018
5
来自主题: Tennis版 - 又中招了。
一个月前从楼梯上左脚滑了一跤,接着打了一场球后,左脚跟有些疼,没太在意,以为
慢慢可以恢复,可一个月过去了,才好了六成的样子,单左脚尖可以把自己顶起来但很
吃力。今天仔佃查了下,应该是跟腱炎achilles tendon;期间还是一直在练球,休息
不够,变成像网球肘一样的毛病了。悲惨啊,接下来打球不能跑不能跳了。。。
贴个link,以后网球新人们参考。
http://www.itftennis.com/scienceandmedicine/injury-clinic/tenni
Achilles Tendon
Diagnosis
An injury of the Achilles tendon is a degenerative condition of the tendon,
not an inflammatory process. It is therefore incorrect to describe this as
tendinitis. Tendinopathy is a better term.
The injury is caused by chronic repeti... 阅读全帖
w*******y
发帖数: 60932
6
$2.21 for 16 oz (one pound) of Germany quality Haribo Gummi Grapefuit (
grapefruit has excellent reviews on amazon), Haribo Gummi Clownfish, Haribo
Gummi Twin Cherries, Haribo Gummi Colas, Haribo Gummi Bears, so on of the
many varieties.
Bagged in 5 pounds bags for $11.07 ($2.21 for one pound of Haribo), $11.07
price for the Haribo 5 pound bags that are currently on sale for $14.77 (
then discounted down to $11.07), many varieties. The other 5 pound bag
varieties that are currently on sale at a ... 阅读全帖
w*******y
发帖数: 60932
7
Coupon code FREESHIP
Roll n' Go Keyboard, Navy $5:
http://www.pbteen.com/products/rolln-go-keyboard/?words=26-1551
Unroll this flexible full-sized keyboard and transform your desktop into an
ultracomfy workstation. High-quality waterproof silicone is quiet and
comfortable to the touch.
5.5" wide x 19.5" long
Compatible with any USB or PS/2 interface.
Sold individually
Roll n' Go Keyboard, Pink $5:
http://www.pbteen.com/products/pink-pool-violet-rolln-go-keyboa
Unroll this flexible full-sized key... 阅读全帖
y***e
发帖数: 676
8
October 1, 2011, 4:29 pm
Police Arrest About 400 Protesters on Brooklyn Bridge
By AL BAKER and COLIN MOYNIHAN
Updated, 6:12 p.m. | In a tense showdown above the
East River, the police arrested about 400 demonstrators from the Occupy Wall
Street protests who took to the roadway as they tried to cross the Brooklyn
Bridge on Saturday afternoon.
The police did not immediately release precise arrest figures, but said it
was the choice of those marchers that led to the swift enforcement.
“Protesters w... 阅读全帖
w*s
发帖数: 7227
9
注册的时候party我填的是unrolled,现在可以改吗?
d*2
发帖数: 2053
10
来自主题: USANews版 - Uber’s C.E.O. Plays With Fire(ZZ)
https://www.nytimes.com/2017/04/23/technology/travis-kalanick-pushes-uber-
and-himself-to-the-precipice.html
Travis Kalanick’s drive to win in life has led to
a pattern of risk-taking that has at times put his
ride-hailing company on the brink of implosion.
By MIKE ISAACAPRIL 23, 2017
SAN FRANCISCO — Travis Kalanick, the chief executive of Uber, visited Apple
’s headquarters in early 2015 to meet with Timothy D. Cook, who runs the
iPhone maker. It was a session that Mr. Kalanick was dreading.
Fo... 阅读全帖
a*****1
发帖数: 3817
11
WASHINGTON (AP) — The Justice Department says it won’t give cities some
law enforcement grant money unless they give federal immigration authorities
access to jails and alert them when someone facing deportation will be
released from local custody.
Attorney General Jeff Sessions unrolled the new conditions Tuesday,
escalating his promised crackdown on so-called sanctuary cities. Under old
rules, cities seeking grant money needed only to show that they weren’t
prohibiting local law enforcement fr... 阅读全帖
s****0
发帖数: 956
12
http://www.bayecho.com/content/父亲节征文活动-写给海归的父亲
父亲的节日
作者:陈开文
父亲节准确地说应该叫“贺曼节”。它其实是贺曼明信片公司和其他公司为了赚钱,用
父爱做幌子假设出来的一天而已。父亲节没有什么不好,但是在我看来,每天都应该是
父亲节,因为,无论你是否喜欢与否,我们每一个人都有自己的父亲。就我而言,我过
去喜欢过父亲节,现在依然喜欢这个特殊的节日。
我的父亲曾经伴随着我成长。我们彼此还算了解,但是了解得还不够深。在我很小
的时候,父亲回到中国开始创业,追求他自己的梦想。对于我来说,我很难接受这个事
实。起先,我以为时间不会太长,也没有那么复杂,父亲只是暂时离开我,过几年之后
他就会永远地回到我的身边。我的想法不对吗?但是我错了,迄今为止,我的父亲仍然
还在中国。
现在,我已经很适应他不在我身边的生活,对未来也不用担心。但是有父亲陪伴在
家的感觉,我再也体会不到了,这件事非常困扰我。事实上,我错过了父亲陪伴我成长
,以及从父亲那里得着教诲的好时光。在那些艰难的日子里,不仅仅是我陷入痛苦之中
,我的妹妹和妈妈也是同样如此。
... 阅读全帖
a**i
发帖数: 608
13
来自主题: Stock版 - 油可能要爆泄一把鸟
阿拉伯给大家伙放了个不小的鸽子,哈哈
Doha oil producers meeting ends without an agreement
Javier E. David | @TeflonGeek
2 Hours Ago
CNBC.com
Doha, Qatar.
Justin Solomon | CNBC
Doha, Qatar.
A summit in Doha between the world's largest oil producing countries ended
without an agreement on Sunday, as country leaders failed to strike a deal
to freeze output and boost sagging crude prices.
Initially, the conference's outcome was thrown into doubt after Iran made a
last minute decision not to attend and Saudi Arabia... 阅读全帖
z**t
发帖数: 27
14
来自主题: Boston版 - 波士顿多变的夏日 (V)
波士顿多变的夏日蓬勃着青春的活力; 古旧的朗桥(Longfellow Bridge) 见证着人间的苍
桑。
夕阳西下,最后的余晖残照中,
只见灰白,金黄的纤云一片,
在那琥珀色天穹徐徐舒展,
好象从先知身上飘落的斗篷。
The sun is set; and in his latest beams
Yon little cloud of ashen gray and gold,
Slowly upon the amber air unrolled,
The falling mantle of the Prophet seems.
我想Longfellow 写这首<海滨一夏日> ( A Summer Day by the Sea) 是不是就站
在这座桥上? Longfellow在他的<桥>(The Bridge)中告白了他是这里的常客:
How often, oh, how often,
In the days that had gone by,
I had stood on that bridge
w*********l
发帖数: 1337
15
来自主题: SanFrancisco版 - 码农们看完这个惭愧吗? (转载)
这个倒是。不考虑代码质量的话,人肉loop unrolling,确实没有压力。
i****a
发帖数: 36252
16
来自主题: Tennis版 - 怎么上套?
昨晚给把柄上grip cover. 不知为撒总包不好. 又不是第一次咯...
想想昨晚是不是包反了? 我是把整条wrap unroll, 从梢细了,有double side tape
的一头开始.
对不对?
[发表自未名空间手机版 - m.mitbbs.com]
c**i
发帖数: 6973
17
来自主题: Travel版 - Maglev for Tokyo-Nagoya Line
Dan Saltzstein, Japan Will Build World's Fastest Train. New York Times, Feb
20, 2011 (title in the print; date in the print).
http://intransit.blogs.nytimes.com/2011/02
/14/japan-plans-worlds-fastest-train/?scp=1&sq=japan%20train%20magnetic&st=
cse
(to be completed by 2027; 178 miles; in 40 minutes; will use magnetic
levitation
My comment:
(a) Central Japan Railway is private.
(b) Capital of Aichi Prefecture 愛知県, Nagoya is midway between Osaka in
the west and Tokyo in the east.
(c) Maglev (tran... 阅读全帖
L*****k
发帖数: 13042
18
来自主题: LeisureTime版 - 今天见到了xumin唉!
你是高人,我不敢比,呵呵。
汇编里面的技巧还是挺多的,中断,驱动之类觉得不好
理解。
我到大学才接触pascal. 不过那时已经fell in love with C.
logo写八皇后肯定不如pascal的。
当时八皇后用的basic.对递归倒是理解,但怎样unroll完全是
死记硬背的。
z*i
发帖数: 58873
19
来自主题: LeisureTime版 - 【读书笔记】To Kill A Mockingbird
作者Harper Lee,1960年出版,应该是这里的高中读物吧。 很简单的一本书,不但情
节简单,而且语言用词也都简单,稍微有点难度的是一些南方的习俗和俚语,不过完全
不影响通读。
故事设置是大萧条时期的美国南方阿拉巴马的一个小镇,基本是作者的准自传体,主要
写了小女孩Scout Finch在6~9岁这几年生活中发生的一些大大小小的事情。 学校,打
架,调皮捣蛋,鬼屋,狂犬,强奸,官司,死刑,谋杀。。。打趣和沉重两种笔触并存
,也不是严格意义的青少年读物。
本来想写分析点什么主题的,比如南方的种族歧视,律师的职业操守,loss of
innocence, 傲慢与偏见,陌生与宽容,成长的烦恼,等等。但是每个主题细想想,觉
得书里都写的明明白白的,实在是没什么可过多分析的。
那就简单说两点,勉强算作独立的所得吧。
1. 作为coming of age类型的书,感觉作者实际上是把同一时间段内的三个不同的人放
到了一条线上 Scout-Jem-Addicus。 三个角色按照年龄顺序体现的是一个人思想的变
化。
2. 结尾读完后建议别放下,马上回来再重读一遍第一章,呼应写的很精彩。这个是同
名... 阅读全帖
N*D
发帖数: 3641
20
牛啊,loop unrolling,优化得好啊
s**********r
发帖数: 141
21
搞得俺要翻强回复你一下: 不是笑话,某人说她loop unrolling了。。。
n**********2
发帖数: 648
22
【 以下文字转载自 Programming 讨论区 】
发信人: xykkkk (asdf), 信区: Programming
标 题: 老码农冒死揭开行业黑幕:如何编写无法维护的代码(zz)
发信站: BBS 未名空间站 (Fri Nov 28 13:28:27 2014, 美东)
如何编写无法维护的代码
让自己稳拿铁饭碗 ;-)
– Roedy Green(翻译版略有删节)
简介
永远不要(把自己遇到的问题)归因于(他人的)恶意,这恰恰说明了(你自己的)无
能。 — 拿破仑
为了造福大众,在Java编程领域创造就业机会,兄弟我在此传授大师们的秘籍。这些大
师写的代码极其难以维护,后继者就是想对它做最简单的修改都需要花上数年时间。而
且,如果你能对照秘籍潜心修炼,你甚至可以给自己弄个铁饭碗,因为除了你之外,没
人能维护你写的代码。再而且,如果你能练就秘籍中的全部招式,那么连你自己都无法
维护你的代码了!
(伯乐在线配图)
你不想练功过度走火入魔吧。那就不要让你的代码一眼看去就完全无法维护,只要它实
质上是那样就行了。否则,你的代码就有被重写或重构的风险!
总体原则
Quidquid... 阅读全帖
H******7
发帖数: 34403
23
来自主题: Joke版 - 有点动心了啊 看上去不错
I wrote the company and told them how this didn't work as advertised,but
never heard back from them. I used the 1" roll and it seemed to be partially
cured as soon as I opened it up - but the package expiration date is 18
months in the future. It isn't pliable, it isn't sticky, it didn't work. It
was very hard to unroll and it wasn't sticky. I used the gloves but didn't
need them - resin didn't rub off, it was already hard. I'm disappointed they
didn't at least acknowledge my email and oh yeah, ... 阅读全帖
w******o
发帖数: 3259
24
来自主题: Hubei版 - 网友们的弱者怨妇心态
最近的姚晨事件张雨绮事件发端的时候大家纷纷default认为女的是被分手的一方吃了
大亏,当事人不做声网友们上蹿下跳指天骂地地帮别人讨公道,结果事件一unroll,发
现女主角一个个潇洒快活得很,吃哑巴亏的反而是当初的千夫所指。男女关系当中好象
大家总认为吃亏的是女方,上床是吃亏,分手是吃亏,生娃是吃亏,多赚钱是吃亏,老
公不给力也是吃亏。女人总认为自已是弱者是吃亏的一方,有时候甚至比男人更加重男
轻女。妇女解放白搞这么多年了。
w***n
发帖数: 4358
25
☆─────────────────────────────────────☆
wowowowo (life is a journey) 于 (Wed Apr 20 23:01:50 2011, 美东) 提到:
最近的姚晨事件张雨绮事件发端的时候大家纷纷default认为女的是被分手的一方吃了
大亏,当事人不做声网友们上蹿下跳指天骂地地帮别人讨公道,结果事件一unroll,发
现女主角一个个潇洒快活得很,吃哑巴亏的反而是当初的千夫所指。男女关系当中好象
大家总认为吃亏的是女方,上床是吃亏,分手是吃亏,生娃是吃亏,多赚钱是吃亏,老
公不给力也是吃亏。女人总认为自已是弱者是吃亏的一方,有时候甚至比男人更加重男
轻女。妇女解放白搞这么多年了。
☆─────────────────────────────────────☆
yizhitumao () 于 (Wed Apr 20 23:25:54 2011, 美东) 提到:
汪也不一定就是吃哑巴亏吧,顶多就是花了点钱,再说了,嫖妓还要花钱呢,何况是个
小明星
☆────────────────────────────────... 阅读全帖
w*********l
发帖数: 1337
26
有很多编译的技术,比如loop unrolling, loop fusion, loop fission
体系结构上也能把没有dependency的操作并行用不同的alu来算。而且即使有
dependency也能用speculation来打掉,并行算。所以这种性能预测很难说啊。

b,
w*r
发帖数: 2421
27
来自主题: Java版 - improve speed
for these codes, they should compile the same way, compiler may unrolling the
body of the loop multiple times to eliminate the testing at the end/begnning
of the loop,
other sittuations may be differnet,
t=0
while(t<1000){
if(j){
then c[t]=j(p)
t++
}
else{
c=f(p,t)
t++
}
}
if compiler is smart enough, it may figure out this simple program, if the
optimization code is not good enough, it may turn into different structure, A
good c
t****t
发帖数: 6806
28
来自主题: Programming版 - A try-catch problem in C++
You are usually not supposed to throw exception in destructor.
If a dtor throw exception in the process of stack unrolling
(i.e. processing another exception), the program calls a pre-defined
function and exits immediately, there's no cure for this.
However, throwing exception in constructor is perfectly legal and will
often be met, e.g. if constructor calls new and new throws out bad_alloc.
O*******d
发帖数: 20343
29
来自主题: Programming版 - 嵌入式编程问题
google "loop unrolling"
l******r
发帖数: 156
30
来自主题: Programming版 - 嵌入式编程问题
1. figure out where your memory is located and use DM.
2. figure out how big is your I$ and do loop unrolling.
b******a
发帖数: 215
31
来自主题: Programming版 - 嵌入式编程问题
compiler的优化有时间好像也会有问题。
我以前用analog的 visual DSP在他自己的DSP上跑大规模的模拟程序,算法的核心就是
矩阵的LU变换。这个东西得C语言的算法已经很成熟了,但是在DSP上如果不做优化的话
,基本上不能用,速度太慢了。但是如果用comipler的优化选项打开,选择优化到最少
的运行时间,编译好的程序跑出来的结果总是不对,一个4x4的矩阵的LU分解都算不对
,不知道为什么。
后来就是自己手工写asm码,loop unrolling加上DSP支持的SIMD,速度差不多提高了20
多倍。
b***y
发帖数: 2799
32
来自主题: Programming版 - [合集] C代码这么写,居然没有错。
☆─────────────────────────────────────☆
kukutf (五脚蟹★酷酷豆腐) 于 (Fri Feb 22 12:30:55 2008) 提到:
今天写个switch case代码,case之间不要break断开
一不小心写错了,居然编译也对,运行也算是合乎逻辑。
感觉switch/case就是一个goto语句,跳到哪里就算是那里了
不知道编译器对这种代码该怎么优化。
for loop unroll?
int main()
{
int i;
int a=0;//a=1;
switch(a){
case 0:
for(i=0;i<3;i++)
case 1:
if(rand()>1)
case 2:
printf("Bingo\n");
}
}
☆─────────────────────────────────────☆
thrust (WoW 无限期冬眠中) 于 (Fri Feb
m***i
发帖数: 2480
33
来自主题: Programming版 - 怎么判断一块连续内存区域为零?
not sure how memcmp is implemented. It could be doing SSE instructions and
loop unrolling
l***8
发帖数: 149
34
来自主题: Programming版 - 怎么判断一块连续内存区域为零?
unroll your loops to reduce branching.
use SSE to minimize # of instructions.
use bitwise OR over your data first then compare final result with ZERO.
m***i
发帖数: 2480
35
来自主题: Programming版 - 看看人家高手写的排序代码
Is it a sorting code? I don't see < or >... It does not look like look
unrolling either
t****t
发帖数: 6806
36
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
you can't do recursive expansion with C macro. CPP specifically forbid this,
even if you use several nested macro.
you can achieve nesting through including the file itself. boost provides
some "functions". you may want to read
http://www.boost.org/doc/libs/1_43_0/libs/preprocessor/doc/index.html
but this is dangerous for inexperienced programmers. for example, even if
macro can recursively expand, your forloop(5) will expand to something like:
if (5>0) f(5); if (5-1>0) f(5-1); if (5-1-1>0) f(5-
d****p
发帖数: 685
37
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
You can do that with boost's BOOST_PP_REPEAT in boost preprocessor lib.
sth like
#define RUN_FUNC_IN_LOOP(unused, loopCount, funcToRun) funcToRun(n);
where funcToRun looks like void funcToRun(int n)
So the loop is BOOST_PP_REPEAT(1000, RUN_FUNC_IN_LOOP, yourFunc)
But it is a bad idea since the code is unreadable to most people.And if the
n is large ...
r****t
发帖数: 10904
38
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
啊。。cpp 原来不让 recusion 的?cpp 不够灵活,template class 有内存上的问题
,写起
来不容易, compiler (nvcc) 还不一定支持。搜 "preprocessor loop" 很多都指向
boost 这个 preprossesor, 不过这部分程序没法用 boost, 看来还是用个 template
engine 来生成代码好了。

this,
provides
if
like:
and
variables.
t****t
发帖数: 6806
39
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
why it can not use boost? it's just a CPP library, should work on whatever
compiler.
r****t
发帖数: 10904
40
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
This is nvcc for gpu from nvidia. For kernel code (the computation code)
my understanding is that even STL is not available. It support some c++
feature like overloading, templates and classes without device memory
members, however, mostly the kernel code is in c89.

whatever
t****t
发帖数: 6806
41
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
i said it's CPP library. you know what is CPP, don't you?
it has nothing to do with c++ or c or whatever. you can write visual basic
with it.
probably it's too twisted for you anyway. this is not designed for entry
level user.
r****t
发帖数: 10904
42
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
i did not get it that cpp is enough for this to work. thanks for
reminding, I'll have a look when I get a time.
Currently template engine works ok for me. It's very powerful when dealing
with C code: I can evaluate much of expressions in compile time even for
floats, while templates only do int for non-typed argument, and hence do
not build different instantiations for different non-int const arguments.

basic
t****t
发帖数: 6806
43
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
one correction: for large part of boost, the user do *not* need to link to a
library because they are header only, although most of boost are built on
templates. same for STL.
i once read the document of nvcc, it seems they only implement a subset of
template (i guess template is quite complex for compiler writer in any case)
. so i guess still no boost or STL, unfortunately. correct me if i am wrong.
j******n
发帖数: 271
44
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
If the current tool is not sufficient, find another tool to help. An ugly
but working solution is to add some scripts to your code.
e. g.
// a.h.in:
#include "more.h"
// my macros
`echo "#define MACRO_0(f) f(0)"; i=0; while [ $i -lt 10 ] ; do j=$((i + 1));
echo "#define MACRO_$j(f) MACRO_$i(f); f($j)" ; i=$j; done`
// Makefile:
a.h: a.h.in
cat a.h.in | (echo "cat - < a.h
would generate your macros in a.h:
#include "more.h"
// my macros
#define MACRO_0 f(0)
#d
r****t
发帖数: 10904
45
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
Only function templates are implemented. I did not test seriously if class template works, just so far so good. But since class cannot have virtual methods, there's not much juice
using classes.

a
case)
wrong.
r****t
发帖数: 10904
46
来自主题: Programming版 - 如何用 preprocessor unroll for loop?
I call this a DIY template engine method... :)

);
O*******d
发帖数: 20343
47
来自主题: Programming版 - 我最近写的一个屏保程序
两幅图像在切换时,我用了颜色混合。 Windows的GDI没有比较好的混合颜色的方法。
我写这个屏保时不打算用OpenGL来做。于是自己写了一个混合颜色的class。 主要想法
是用空间换时间,。颜色混合用查表法。 两个颜色,不管红绿蓝,就是一个2维数组的
index,那个位置的颜色就是事先计算好的混合色。
#include
class ColorBlender
{
public:

ColorBlender(double alpha) { mAlpha = alpha;mLookupTable = NULL;
CreateTable(); }
~ColorBlender() {delete [] mLookupTable ;}
unsigned char Blend(unsigned char firstColor, unsigned char
secondColor);
void Blend(const unsigned char * pFirstColor, const unsi... 阅读全帖
1 (共1页)