Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - rain_storm

Pages: 1 2 3 [4] 5 6 7 8 9 10 11 ... 69
61
C / C++ /C# / Re: Anyone using the Intel C Compiler?
« on: August 16, 2011 »
Quick test to see how icc compares to msvc using crinkling. Note that this is a minimalist example and should not reflect a production level demo. There is no telling which compiler would produce better compression without explicitly testing the specific demo on various compiler / compressor combinations.

This test is a simple "Hello World" MessageBox compiled with icc and msvc then linked using crinkler. As I am still trying to figure out all the commandline options I decided to run this test without any optimizations. Surprisingly msvc shaved off 3 bytes by turning off the optimize for size switch (/Os). Results for this test favour msvc with a 10 byte advantage over icc.

580 bytes : crinkler + icc
570 bytes : crinkler + msvc

62
Yabasic / Re: ID10T problem
« on: August 16, 2011 »
Code: [Select]
cos(angle+pi*0/2),  sin(angle+pi*0/2) // forward
cos(angle+pi*1/2),  sin(angle+pi*1/2) // right
cos(angle+pi*2/2),  sin(angle+pi*2/2) // backward
cos(angle+pi*3/2),  sin(angle+pi*3/2) // left

pi = 180 degrees, that means that pi/180 = 1 degree expressed in radians, if you wish to stick with degrees it requires expensive multiplications (by preprocessing the conversion ration pi/180). If you keep the angles in radians then its simply additions (by preprocessing pi/2)

Code: [Select]
open window 640, 512
window origin "cc"

repeat
    setdispbuf draw
    draw = 1 - draw
    setdrawbuf draw
    clear window
   
    c = peek("port1")
    if (and(c, 32) > 0) angle = angle + pi/64
    if (and(c,128) > 0) angle = angle - pi/64

    line 0,0 to 64*cos(angle+pi*0/2), 64*sin(angle+pi*0/2)
    line 0,0 to 64*cos(angle+pi*1/2), 64*sin(angle+pi*1/2)
    line 0,0 to 64*cos(angle+pi*2/2), 64*sin(angle+pi*2/2)
    line 0,0 to 64*cos(angle+pi*3/2), 64*sin(angle+pi*3/2)
until (0 = 1)

Code: [Select]
open window 640, 512
window origin "cc"

repeat
    setdispbuf draw
    draw = 1 - draw
    setdrawbuf draw
    clear window
   
    c = peek("port1")
    if (and(c, 32) > 0) angle = angle + 1
    if (and(c,128) > 0) angle = angle - 1

    line 0,0 to 64*cos((angle+000)*pi/180), 64*sin((angle+000)*pi/180)
    line 0,0 to 64*cos((angle+090)*pi/180), 64*sin((angle+090)*pi/180)
    line 0,0 to 64*cos((angle+180)*pi/180), 64*sin((angle+180)*pi/180)
    line 0,0 to 64*cos((angle+270)*pi/180), 64*sin((angle+270)*pi/180)
until (0 = 1)

63
Yabasic / Re: ID10T problem
« on: August 16, 2011 »
Code: [Select]
variable= (anything betwen 0 and 2*pi)
sin((variable)*pi/180)=a
sin((variable+90)*pi/180)=b
sin((variable+180)*pi/180)=c
sin((variable+270)*pi/180)=d

It's the input that is expected in radians the output is the y component of a unit vector

64
C / C++ /C# / Re: Anyone using the Intel C Compiler?
« on: August 16, 2011 »
hmm will have to look into this VTune, sounds interesting, the intel manual for using rdtsc to benchmark software is full of flaws, their method only works correctly if your software happens to be the only software running on the CPU, as in no operating system / no task switching.

One more thing I was amazed by is how little bloat icc produces compared to msvc the exact same source code compiles to 103KB using cl.exe but only 35.5KB using icl.exe thats a whole lotta dead code removal using icc's libraries, also you should still have access to icc's optimised math kernel even if you specify NODEFAULTLIB, though I haven't tested this yet.

65
C / C++ /C# / Re: Anyone using the Intel C Compiler?
« on: August 15, 2011 »
I've cracked it. It still throws errors but at least it compiles. The bach file I made is compatible with icc version 11.1 [054] and it looks like this:

edit - tested icc out on my voxel engine using SSE3 (the limit supported by my CPU) and I'm happy to report that there is in fact an increase in performance compared to cl.exe, I'm getting about 5%-10% increase in framerate. (fps fluctuates but icc always stays slightly above cl)

Code: [Select]
set CURDIR=%CD%
set ICLVAR="C:\Program Files\Intel\Compiler\11.1\054\bin\ia32\iclvars_ia32.bat"
set TBBVAR="C:\Program Files\Intel\Compiler\11.1\054\tbb\ia32\vc9\bin\tbbvars.bat"
set MKLVAR="C:\Program Files\Intel\Compiler\11.1\054\mkl\tools\environment\mklvars32.bat"
set IPPENV="C:\Program Files\Intel\Compiler\11.1\054\ipp\ia32\tools\env\ippenv.bat"
if exist %ICLVAR% @call %ICLVAR%
if exist %TBBVAR% @call %TBBVAR%
if exist %MKLVAR% @call %MKLVAR%
if exist %IPPENV% @call %IPPENV%

SET ICPP_COMPILER11=C:\Program Files\Intel\Compiler\11.1\054
SET INTEL_LICENSE_FILE=C:\Program Files\Common Files\Intel\Licenses;%INTEL_LICENSE_FILE%
SET PATH=%ICPP_COMPILER11%\Bin\ia32;%PATH%
SET LIB=%ICPP_COMPILER11%\Lib\ia32;%LIB%
SET INCLUDE=%ICPP_COMPILER11%\Include;%INCLUDE%

icl  hello.cpp hello.obj
link hello.obj user32.lib

66
Congrats Padman, Raizer and Shockwave! Really cool competition the top three were well chosen by the community. Awesmoe work guys.

67
Code: [Select]
int *data = (int*)malloc(65536*sizeof(int)); // allocate memory
memset(data,0,65536); // zero the data
data[65535] = 0xDEADF00D; // place an end of data marker
while (*data != 0xDEADF00D) { // continue until we reach that marker
    // do you effect and place it in memory through the pointer
    data++;
}

Would I be allowed to use registers...
Code: [Select]
register counter = 65536;
while (counter) {
 counter--;
}

68
Excellent, have no idea how that painter effect works but its looking great.

69
Awesome stuff, Kirl

70
Sweet! Loving the way you save the output to disc, I can see myself using this from time to time. Nice work.

71
Thats amazing Raizor, absolutely genius!

72
interpolation is the process of taking a few sample points and trying to fill in the missing points in between, so that the new points transition smoothly from one extreme to the other. The most simple form is linear interpolation (the pseudocode I gave above), in which the points inbetweens fall apon a straight line with both ends being the sample points.

you can use that equation to transition from a given initial colour to a desired colour doesn't have to be black it could just as easily be red or white. It doesn't even have to be colours, anything can be interpolated.

73
you just have to interpolate from one value to another
Code: [Select]
interpolate = firstvalue + curstep*(finalvalue-firstvalue)/numsteps;

74
Yabasic / Re: word string fade - emulation
« on: July 27, 2011 »
Neat.

75
General chat / Re: UK : Shit country.
« on: July 27, 2011 »
I'm feeling the same thing at the moment. But in my case it's not juvenile deliquents but a couple of drug addicts living two doors up. There's about 8 or 9 of them staying in a 3 bedroom. They range from late teens to late 20's but one of them is well into his 40's and still hasn't copped on (such a loser). They're always fighting and messing. They'd be roaring and shouting at all hours of the morning.

Last week I found the door of my car open and the head lights left on. This has happened a few times and it certainly wasn't me who left it like that (I've become somewhat security concious these days manually checking each door twice to see if they're locked). This time though they put a hedgehog in my car. I didn't spot the thing til the next day after I finished work. By that time the poor thing had made shit of the back seat. All clawed up and chewed. And a mess left for me to clean.

Where I'm originally from has a bad reputation for being a deprived area. But at least back there I knew everyone for a mile around me. And because of that nothing much ever happened. Here I really know no one. I'll be moving soon I'm only renting this place so for me moving is an easy decision. I'm tired of having to look out the window every time I pass the hallway.

These people are such a waste of life. I know plenty of similar people from my old neck of the woods who just live for drugs and cheap cider. Never had a job and at this stage of the recession they are truely unemployable. That middle aged yob sums my point up nicely. Who would employ a middle aged man who lives in the same tracksuit every day.

The funny thing is that most of the people in my old area would make you wonder why the place had such a bad name. They are honest people who work hard for a living. But then you see those losers hanging out in a feild getting drunk at that hour of their lives, acting like they're homeless tapping change.

It's not the world that's changing. Those mountains were always there. It's the people in the world that change.

76
In the context of yabasic you can ignore that precaution with comparing strings of different lengths. All strings are zero terminated so asc() will return zero for the terminator as well as any queries beyond the terminator. Yet another reason why interpretive languages rock.

77
you could use RayFryers fairly fast z buffer sort, it can be found at Jims Repository

Heres the source code:
Code: [Select]
// By Fryer - Please Upload.
// Fast linear z-sort for large numbers of values.
//
// currently set up for 20 bit positive integers.
// sorts list by 4 bits on each pass with 6 passes but
// can be customised to suit ranges and memory.
// MUST HAVE even No. of passes and last pass MUST
// be above range for values (in this case bits 21 to 24
// are always 0)
//
// set No. of values and allocate memory
// if mx is less than 11 display sorted list
  //mx=10000
  //i = ran(65536) // random seed
  mx = 256
  dim c(15),oc(15),sort(mx*32),z(mx)

'create random list and put unsorted order into sort array
  for i=1 to mx
    z(i)=int(ran(65536))
    sort(i)=i
  next i

'initialise sort variables (only required once)
  store=mx*16+1
  retrieve=1
  final=1/16/16/16/16/16/16

'start timer
  t1$=time$

'sort
  bit=1
  c(0)=mx+1
  repeat
    for i=0 to 15 oc(i)=c(i)
      c(i)=store+mx*i next i
    for i=0 to 15 p=retrieve+mx*i
      oc=oc(i)
      while(p<oc) sort=sort(p)
        b=and(15,z(sort)*bit)
        c=c(b)
        sort(c)=sort
        c(b)=c+1
        p=p+1 wend next i
    bit=bit/16
    t=retrieve
    retrieve=store
    store=t until(bit=final)

'stop timer
  t2$=time$

'check and display results
ocs=0:scs=0
fail=0
for i=1 to mx
if mx<11 print "  "+str$(z(sort(i)))+"  "+str$(z(i))
z=z(sort(i))
ocs=ocs+z(i)
scs=scs+z(sort(i))
if i>1 then
if z<oz fail=fail+1
fi
oz=z
next i
cs=ocs-scs



i = 1
for a = 0 to (mx-16)/16
    b$ = upper$(hex$(i-1))
    while(len(b$) < 2) b$ = "0" + b$ wend
    for b = 0 to 15
        a$ = upper$(hex$(z(sort(i))))
        while(len(a$) < 4) a$ = "0" + a$ wend
        b$ = b$ + " " + a$
        i = i + 1
    next b
    print b$
next a
print "   sorted "+str$(mx)+" values"
print "   failure="+str$(fail)
print "   Checksum="+str$(cs)
//print" sorted "+str$(mx)+" values"
//print" failure="+str$(fail)+"   Checksum="+str$(cs)
//print" from "+t1$
//print"   to "+t2$

It works like this:
[1] start with the most significant bit in the number descend to the least significant
[2] for each item in the array
[3] if this bit is set move this item towards the start of the sorted array
[4] otherwise move this item towards the end of the array
[5] move on to the next item in the array and repeat steps 3,4,5
[6] shift the bit mask to the right one bit and repeat steps 2,3,4,5,6

So the first pass sorts the array into two halves
the next pass it sortes the array into quarters
then eighths, then sixteenths, etc
until you are at the least significant bit, at which point you are only looking at whether or not the number is even or odd.

This may sound slow (and it is somewhat slow) but its fast enough to be used in realtime. I have used this Z Buffer routine with success in real time 3D renderings.

78
Code: [Select]
Project : error PRJ0002 : Error result -1073741515 returned from
'C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe'
That's the error I get when I rename icc to cl.exe and put it in the "...\VC\bin\" folder

I'm using the trial version of Intel C++ Composer XE 2011 for Windows

79
icc is a drop in replacement for cl.exe, you can build using icc from within Visual Studio but not with the Express Editions, which is what I have. So my only option is to build from the command line. Which is a process I'm unfamiliar with.

I've been following this walkthrough but am missing information about setting up the build environment. running vcvars32.bat should be all that's necessary to set up the environment (and it does work for cl.exe) but it doesn't work for icc. As soon as I include "windows.h" it fails.

80
C / C++ /C# / Anyone using the Intel C Compiler?
« on: July 23, 2011 »
I downloaded icc but it doesn't work with Visual Studio Express (only works with the non free versions?). I'm trying to get icc to compile from the commandline but it's not working out for me yet. Just wondering if anyone here has looked into it before I spend too much time trying to figure out the whole commandline interface.

From what I've read icc generates code that is much more optimized than anything else in the feild but only for intel compatible machines. Also I heard rumours that the intel libraries test if the machine is AMD and if so uses the slowest versions of each function.

Pages: 1 2 3 [4] 5 6 7 8 9 10 11 ... 69