Bitcoin Forum
May 13, 2024, 03:33:35 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 [48] 49 »
941  Other / CPU/GPU Bitcoin mining hardware / Re: [BOUNTY] sha256 shader for Linux OSS video drivers (195 BTC pledged) on: February 12, 2012, 04:09:18 PM
Completed 'and' and fixed bug in 'not' function. This is the brook version, but it should be easy to port the change back to GLSL if wanted:

Code:
/**
 * Some utility functions to process integers represented as float2.
 */

/**
 * Add 2 integers represented as float2.
 *
 * Do not let overflow happen with this function, or use sum_c instead!
 */
kernel float2 add( float2 a, float2 b) {
        float2 ret;

        ret.x = a.x + b.x;
        ret.y = a.y + b.y;

        if (ret.y >= 65536.0) {
                ret.y -= 65536.0;
                ret.x += 1.0;
        }

        if (ret.x >= 65536.0) {
                ret.x -= 65536.0;
}

        return ret;
}

/**
 * Shift an integer represented as a float2 by log2(shift).
 *
 * Note: shift should be a power of two, e.g. to shift 3 steps, use 2^3.
 */
kernel float2 shiftr( float2 a, float shift) {
        float2 ret;

ret.x = a.x / shift;

ret.y = floor( a.y / shift) + frac( ret.x) * 65536.0;

ret.x = floor( ret.x);

        return ret;
}

/**
 * Rotate an integer represented as a float2 by log2(shift).
 *
 * Note: shift should be a power of two, e.g. to rotate 3 steps, use 2^3.
 */
kernel float2 rotater( float2 a, float shift) {
        float2 ret;

ret.x = a.x / shift;  // Shipt words and keep fractions to shift those bits later.
ret.y = a.y / shift;

ret.y += frac( ret.x) * 65536.0;  // Shift low bits from x into y;
ret.x += frac( ret.y) * 65536.0;  // Rotate low bits from y into x;

ret.x = floor( ret.x);  // Cut shifted bits.
ret.y = floor( ret.y);

        return ret;
}

/**
 * Xor half of an integer, represented as a float.
 */
kernel float xor16( float a<>, float b<>) {

        float ret = 0;
        float fact = 32768.0;

        while (fact > 0) {
                if( ( ( a >= fact) || ( b >= fact)) && ( ( a < fact) || ( b < fact))) {
                  ret += fact;
}

                if( a >= fact) {
                  a -= fact;
}
                if (b >= fact) {
                  b -= fact;
}

                fact /= 2.0;
        }
        return ret;
}

/**
 * Xor a complete integer represetended as a float2.
 */
kernel float2 xor( float2 a<>, float2 b<>) {
       float2 ret = { xor16( a.x, b.x), xor16( a.y, b.y) };

       return ret;
}

/**
 * And operation on half of an integer, represented as a float.
 */
kernel float and16( float a<>, float b<>) {
        float ret = 0;
        float fact = 32768.0;

        while (fact > 0) {
                if( ( a >= fact) && ( b >= fact)) {
                  ret += fact;
}

                if( a >= fact) {
                  a -= fact;
}
                if (b >= fact) {
                  b -= fact;
}

                fact /= 2.0;
        }
        return ret;
}

/**
 * And operation on a full integer, represented as a float2.
 */
kernel float2 and( float2 a<>, float2 b<>) {
        float2 ret =  { and16( a.x, b.x), and16( a.y, b.y) };

        return ret;
}

/*
 * Logical complement ("not")
 */
kernel float2 not( float2 a<>) {
       float2 ret = { 65535.0 - a.x, 65535.0 - a.y};

       return ret;
}

/**
 * Swap the 2 words of an int.
 */
kernel swapw( float2 a) {
       float2 ret;

       ret.x = a.y;
       ret.y = a.x;

       return ret;
}

kernel float2 blend( float2 m16, float2 m15, float2 m07, float2 m02) {
        float2 s0 = xor( rotater( m15, 128.0), xor( rotater( swapw( m15), 4.0), shiftr( m15, 8)));
        float2 s1 = xor( rotater( swapw( m02), 2.0), xor( rotater( swapw( m02), 8.0), shiftr( m02, 1024.0)));

        return add( add( m16, s0), add( m07, s1));
}

kernel float2 e0( float2 a) {
        return xor( rotater( a, 4.0), xor( rotater( a, 8192.0), rotater( swapw( a), 64.0)));
}

kernel float2 e1( float2 a) {
        return xor( rotater( a, 64.0), xor( rotater( a, 2048.0), rotater( swapw( a), 512.0)));
}

kernel float2 ch( float2 a, float2 b, float2 c) {
        return xor( and( a, b), and( not( a), c));
}

kernel float2 maj( float2 a, float2 b, float2 c) {
        return xor( xor( and( a, b), and( a, c)), and( b, c));
}

This code compiles here at least. Don't know if it actually works, since I don't have the actually sha256 code in brook yet.

Ciao,
Andreas
942  Other / CPU/GPU Bitcoin mining hardware / Re: [BOUNTY] sha256 shader for Linux OSS video drivers (195 BTC pledged) on: February 12, 2012, 02:25:09 PM
Getting the GLSL code to work properly is really tricky to me. Here's a tutorial that describes some of the issues:

http://www.mathematik.tu-dortmund.de/~goeddeke/gpgpu/tutorial.html

You have to render the GLSL output to a texture and read it back to the host.

At this point, I'm not really sure how Xaci wants to pass the header and the nonce to the shader. Is the header supposed to be variable in a way, too?

I'm trying to simplify things for me a bit, so I translated some of the code to BrookGPU to get float2 streams. This might give a performance hit, since I'm not sure yet, what kind of texture brook generates and passes to the GPU (I've found some posting that said it's a streamlength^2 * 4 * sizeof(float) texture, which would be really big.

So as I'm trying to simplyfy things, I just assume the header as constant and pass an array of nonces to the kernel. The shader should then replace the header nonce with the current nonce and do the double sha256 computation. I guess I'll have to pass the decoded difficulty, too, but I'll see that later...

Ciao,
Andreas
943  Economy / Services / Re: Looking for someone to create/modify software for this forum [1100+ BTC] on: February 08, 2012, 12:43:37 PM
You want PHP? So I would try to generate as much code as possible and use a RAD tool like CakePHP.

Determine what the user should/could do here in this forum and create a nice use case diagram.

Do the next step from there and create a data model. I would recommend ArgoUML with the data modeling profile, since it freely availabe and everyone could download and contribute.

Generate sql from the model (I've to admit here, that the available db modules are a bit dated and might have to be modified, but that shouldn't pose a big issue, since everything is Opensource and pretty straightforward).

Once the sql is there, create a database and feed the mysql into it to get a running database.

Install Cake and point it to the existing database and let in create model, controller and views for each table.

944  Other / CPU/GPU Bitcoin mining hardware / Re: [BOUNTY] sha256 shader for Linux OSS video drivers (195 BTC pledged) on: February 07, 2012, 09:50:36 PM
After some more debugging, it seems I've found the problem:

in line 210 nonce is declared as a vec2, so it has 2 elements x and y. But in line 232 and 233 (IIRC), nonce.zw is used for computation. Doesn't work as nonce has no element z and w. When I change those expression to nonce.xy the code compiles and it seems there's even something started, although I get no output so far. Will have to investigate that further and fix more issues of the test code.

Any help is really appreciated!

Ciao,
Andreas
945  Other / CPU/GPU Bitcoin mining hardware / Re: [BOUNTY] sha256 shader for Linux OSS video drivers (195 BTC pledged) on: February 07, 2012, 09:13:21 PM
Did anyone got the sha256 GLSL code to work?

So far I was reading GLSL tutorials hacked me a test app together (from too many sources to recall all the authors... sorry Sad ):

Code:
#include <stdio.h>                      //C standard IO
#include <stdlib.h>                     //C standard lib
#include <string.h>                     //C string lib

#include <GL/glew.h>                    //GLEW lib
#include <GL/glut.h>                    //GLUT lib


//Function from: http://www.evl.uic.edu/aej/594/code/ogl.cpp
//Read in a textfile (GLSL program)
// we need to pass it as a string to the GLSL driver
char *textFileRead(char *fn) {
  FILE *fp;
  char *content = NULL;
  
  int count=0;
  
  if (fn != NULL) {
    
    fp = fopen(fn,"rt");
    
    if (fp != NULL) {
      
      fseek(fp, 0, SEEK_END);
      count = ftell(fp);
      rewind(fp);
      
      if (count > 0) {
        content = (char *)malloc(sizeof(char) * (count+1));
        count = fread(content,sizeof(char),count,fp);
        content[count] = '\0';
      }
      fclose(fp);
      
    }
  }
  
  return content;
}

//Function from: http://www.evl.uic.edu/aej/594/code/ogl.cpp
//Read in a textfile (GLSL program)
// we can use this to write to a text file
int textFileWrite(char *fn, char *s) {
  FILE *fp;
  int status = 0;
  
  if (fn != NULL) {
    fp = fopen(fn,"w");
    
    if (fp != NULL) {                  
      if (fwrite(s,sizeof(char),strlen(s),fp) == strlen(s))
        status = 1;
      fclose(fp);
    }
  }
  return(status);
}

/**
 * Setup shaders
 */
void setShaders() {
  char *my_fragment_shader_source;
  // char * my_vertex_shader_source;
  GLenum error;

  GLenum my_program;
  // GLenum my_vertex_shader;
  GLenum my_fragment_shader;
  
  // Get Vertex And Fragment Shader Sources
  my_fragment_shader_source = textFileRead( "sha256.glsl");
  // my_vertex_shader_source = GetVertexShaderSource();

  // my_vertex_shader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
  my_fragment_shader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
 
  // Load Shader Sources
  // glShaderSourceARB(my_vertex_shader, 1, &my_vertex_shader_source, NULL);
  glShaderSourceARB( my_fragment_shader, 1, (const GLcharARB** )&my_fragment_shader_source, NULL);
 
  // Compile The Shaders
  // glCompileShaderARB(my_vertex_shader);
  glCompileShaderARB(my_fragment_shader);
  
  // Check for compile errors
  int compiled = 0;
  glGetObjectParameterivARB( my_fragment_shader, GL_OBJECT_COMPILE_STATUS_ARB, &compiled );

  if  ( !compiled ) {
    int maxLength;

    glGetShaderiv( my_fragment_shader, GL_INFO_LOG_LENGTH, &maxLength);
 
    /* The maxLength includes the NULL character */
    char *fragmentInfoLog = malloc( maxLength *sizeof(char));
    
    glGetShaderInfoLog( my_fragment_shader, maxLength, &maxLength, fragmentInfoLog);
 
    printf( "Compile error log: %s\n\n", fragmentInfoLog);

    /* Handle the error in an appropriate way such as displaying a message or writing to a log file. */
    /* In this simple program, we'll just leave */
    free( fragmentInfoLog);

    // printf( "compile error...\n" );
  }

  // Create Shader And Program Objects
  my_program = glCreateProgramObjectARB();

  if(( error=glGetError()) != GL_NO_ERROR) {
    exit( error);
  }

  // Attach The Shader Objects To The Program Object
  // glAttachObjectARB(my_program, my_vertex_shader);
  glAttachObjectARB(my_program, my_fragment_shader);
 
  // Link The Program Object
  glLinkProgramARB(my_program);
  
  // Use The Program Object Instead Of Fixed Function OpenGL
  glUseProgramObjectARB(my_program);
}

int main( int argc, char *argv[]) {

  glutInit(&argc, argv);
  //glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
  glutInitWindowPosition(100,100);
  glutInitWindowSize(320,320);
  glutCreateWindow("GPU");
  
  //  glutDisplayFunc(renderScene);
  // glutIdleFunc(renderScene);
  // glutReshapeFunc(changeSize);
  // glutKeyboardFunc(processNormalKeys);
  
  glewInit();
  if (glewIsSupported("GL_VERSION_2_1"))
    printf("Ready for OpenGL 2.1\n");
  else {
    printf("OpenGL 2.1 not supported\n");
    exit(1);
  }
  if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader && GL_EXT_geometry_shader4)
    printf("Ready for GLSL - vertex, fragment, and geometry units\n");
  else {
    printf("Not totally ready :( \n");
    exit(1);
  }

  setShaders();
  
  glutMainLoop();
  
  // just for compatibiliy purposes
  return 0;

  // glDeleteObjectARB( my_program);
  // glDeleteObjectARB( my_fragment_shader);
}

There are lots of bugs in this code, but at the moment, I just want to compile the shader and start it to do further checks.

I also wrote me a small makefile:
Code:
PROGRAM := glslminer

SOURCES := $(wildcard *.c)

CC = gcc
CCOPTS =
LINKEROPTS = -lGL -lGLEW -lglut

.PHONY: all
all:
        $(CC) $(CCOPTS) $(LINKEROPTS) $(SOURCES) -o $(PROGRAM)

.PHONY: clean
        rm *.o

and when I compile and start the code as root (as a regular user, I don't get access the the nvidia card here), I get:

Code:
localhost glsl # ./glslminer 
Ready for OpenGL 2.1
Ready for GLSL - vertex, fragment, and geometry units
Compile error log: 0(232) : error C1031: swizzle mask element not present in operand "zw"
0(233) : error C1031: swizzle mask element not present in operand "zw"

, which seems to mean, that some of the <something>.zw operations fail (I don't know the linenumber yet, since the newlines seems to get lost in my shader source import).

Anyone with more luck?

Ciao,
Andreas
946  Bitcoin / Development & Technical Discussion / Re: Block chains are too long? on: February 07, 2012, 01:59:59 PM
I just downloaded the daily snapshot within a few minutes and then updated from there...
947  Other / Beginners & Help / Re: Newbies Hangout on: February 06, 2012, 10:13:01 PM
Definitely. I can code but not design, so folks like me need a designer to get something done.

Or post your service on a site like this: http://forbitcoin.com/
948  Other / CPU/GPU Bitcoin mining hardware / Re: [BOUNTY] sha256 shader for Linux OSS video drivers (195 BTC pledged) on: February 04, 2012, 02:06:28 AM
@xaci: thanks a lot for your sha256 code. Do you know the NVidia cg compiler? It has 32 bit ints AFAIK? I have a Geforce 7 card, that is supported by cgc, but has only OpenGL 2.1 support AFAIK at the moment (can't check it at the moment, since I'm at another machine). If I'd write a BrookGPU kernel and use the cgc compiler, I'd have 32 bit integers, right?

TIA,
Andreas
949  Other / Beginners & Help / Re: Newbies Hangout on: February 03, 2012, 06:05:00 PM
What kinda site are you interested in? Just trading or a pool? I'm interested in stealth mode for older GPUs.
950  Other / Off-topic / Re: Self powered car? on: February 03, 2012, 05:27:30 PM
http://www.youtube.com/watch?v=MjEKi9D2hh0&feature=related
951  Other / Beginners & Help / Re: GPU Mining on stock/onboard. Also NVidia FX3000 on: February 03, 2012, 03:32:16 PM
BrookGPU should run on a GForce 6. But I don't know of any working miner yet. Would like to get one implemented, though. My biggest problem are the streams at the moment, as they only allow float base types. So either encode the ints as floats or extend the compiler to allow ints. It seems the compiler accepts the ints as a syntatic correct type but then complains about a 'strange' base type. 
952  Other / Beginners & Help / Re: What's your Mhash/s? (Pissing contest here) on: January 30, 2012, 07:42:03 PM
Without any assembler optimizations, my vice c64 emulator made about 0,000001 MHashes / s. With some assembler it should be feasable to bring it up to 0,00001 MHashes / s ... that was just a dummy loop to test nonces, I have to admit... Sad
953  Local / Anfänger und Hilfe / Re: mining mal einfach erklärt? on: January 28, 2012, 01:33:16 PM
Öhmm...ich bin verwirrt...wenn Du einen neuen Block starten willst, wozu brauchst Du Transaktionen darin?

Bis jetzt nehm ich erstmal einen einfachen Block-Header:

https://en.bitcoin.it/wiki/Block_hashing_algorithm

und betrachte nonce als Variable darin.

Jetzt bilde ich 2x den Hash und checke, ob er kleiner als Difficulty ist.

Falls ja: Treffer.

Falls nein, erhöhe nonce um 1 und bilde wieder die Hashes.

Klappt das mit dem Erhöhen der Nonce nicht, ändert sich ja z.B. die timestamp, so dass man mit nonce = 0 wieder anfangen kann.
954  Local / Mining (Deutsch) / Re: Aktuelle Mining Situation in Deutschland on: January 27, 2012, 01:41:44 PM
Na ja....die Idee ist halt, dass von nichts vielleicht meisten nichts kommt, aber manchmal auch ein ganz klein wenig... Smiley

Und wenn der Aufwand entsprechend gering ist, dann machen ja vielleicht mehr Leute mit, so dass insgesamt vielleicht doch wieder was rumkommt...

Ich versuche hier aktuell ne billige NVidia-Karte (7600gs) zum Minen zu bewegen. Die liegt in dem Rechner quasi brach, weil darauf i.d.R. nur editiert und compiliert wird. Die CPU müsste dann nur noch die Daten auf die Karte schieben, was mir auch bei ner billigen Sempron CPU machbar erscheint. Bei einem anderen Rechner mit ATI-Karte kann ich jedenfalls aktuell arbeiten, surfen, h264-Enkodieren und Minen parallel. Sogar 2d-Spiele laufen parallel problemlos. Das möchte ich halt auf den kleineren Rechner übertragen.
955  Local / Mining (Deutsch) / Re: Aktuelle Mining Situation in Deutschland on: January 26, 2012, 02:53:00 PM
Das mit den dedicated Karten scheint mir im Moment keine so grosse Zukunft hier zu haben bei den Stromkosten? Deshalb interessiere ich mich im Moment eher für die echten Idle-Cycles, also Rechner die sowieso laufen, weil sie was anderes machen müssen und dabei aber z.B. Rechenleistung auf der GPU oder evtl. auch der CPU über haben. So gesehen wäre der perfekte Miner für mich derjenige, den ich auf meinem Rechner quasi überhaupt nicht bemerke.
956  Local / Anfänger und Hilfe / Re: Suche CPU-Miner für Linux auf der Konsole on: January 25, 2012, 06:46:46 PM
Sowas?

https://de.bitcoin.it/wiki/CPU_Miner
957  Other / Beginners & Help / Re: What interests you? on: January 25, 2012, 02:12:42 PM
Programming or software engineering to be more precise. I'm mainly interested in the algorithms to mine bitcoins, so I'm working on my own code. Retro-computing is another interest, so I ran some of my code on a c64 emulator.  RC-helicopters are also a hobby of mine. Model trains is another interest.
958  Other / Beginners & Help / Re: Are Bitcoins Worthwhile? on: January 23, 2012, 11:51:36 PM
lucrative...that's the problem...over here I pay about 20 (Euro-)cent per kWh, so I think building a dedicated mining rig is not reasonable. That's why I'm after those cycles, when average machines are idling. Maybe it makes more sense, when you don't have to buy an expensive graphics adapter...
959  Other / Beginners & Help / Re: Newbies Hangout on: January 22, 2012, 02:00:37 PM
that was the first thing, I googled, when I came here... Smiley

http://www.odditycentral.com/pics/ministers-house-the-worlds-biggest-treehouse.html
960  Other / Beginners & Help / Re: A newbie wants to understand the bitcoin mining concept on: January 22, 2012, 01:53:59 PM
Uh....not really... Smiley

I just write some code and want to keep it portable, so compiling it for the c64 is a good test.

Problem is the poor performance of the old breadbox. It computes about 2 hashes per second at the moment... Sad

Maybe a c64 cluster would be a solution... Smiley

But exactly the same code without any modifications, 32-bit optimizations, multithreading etc. computes about 2 million hashed on my Ahtlon 840 3,2 GHz.

My actual target platform are cheap GPUs. Older NVidia cards and such. Maybe the idle times of such machines could be used for a low performance pool, or so...

Ciao,
Andreas
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 [48] 49 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!