DrTimothyAldenDavis / GraphBLAS

SuiteSparse:GraphBLAS: graph algorithms in the language of linear algebra. For production: (default) STABLE branch. Code development: ask me for the right branch before submitting a PR. video intro: https://youtu.be/Tj5y6d7FegI .
http://faculty.cse.tamu.edu/davis/GraphBLAS.html
Other
364 stars 63 forks source link

no JIT kernels produced? #227

Open victorstewart opened 1 year ago

victorstewart commented 1 year ago

i compiled like so: make static -j CMAKE_OPTIONS='-DCOMPACT=1'

got the ~11.8 MB static library file

root@clr-b5df9984821e4d129387e172044f5754~/xxx/libraries/lib # stat libgraphblas.a
File: libgraphblas.a
Size: 11829168      Blocks: 23104      IO Block: 4096   regular file

compiled and ran the below code:

g++ -O3 -I/root/xxx/libraries/include /root/xxx/test/factoryKernelExtractor.cpp -L/root/xxx/libraries/lib -Wl,-Bstatic -lgraphblas -lgomp -Wl,-Bdynamic -o factoryKernelExtractor.test
rm -rf GB_JIT_Cache && ./factoryKernelExtractor.test
#include <stdlib.h>
#include <random>

extern "C" {
#include <GraphBLAS/GraphBLAS.h>
}

static void test1()
{
   GrB_Info result;

   uint32_t dimension = 1'000;

   std::random_device rd;
   std::mt19937 gen(rd());
   std::uniform_int_distribution<> dis(0, dimension);

   GrB_Matrix A;
   GrB_Matrix_new(&A, GrB_UINT8, dimension, dimension);
   GxB_Matrix_Option_set(A, GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER);

   for (uint32_t index = 0; index < 5'000; index++)
   {
      uint32_t randomRow = dis(gen);
      uint32_t randomColumn = dis(gen);

      GrB_Matrix_setElement_UINT8(A, uint8_t(1), randomRow, randomColumn);
   }

   GrB_Descriptor invertMaskAndTransposeMatrixFirstThenReplaceOutput;
   GrB_Descriptor_new(&invertMaskAndTransposeMatrixFirstThenReplaceOutput);
   GrB_Descriptor_set(invertMaskAndTransposeMatrixFirstThenReplaceOutput, GrB_MASK, GrB_COMP); // invert the mask
   GrB_Descriptor_set(invertMaskAndTransposeMatrixFirstThenReplaceOutput, GrB_INP0, GrB_TRAN);
   GrB_Descriptor_set(invertMaskAndTransposeMatrixFirstThenReplaceOutput, GrB_OUTP, GrB_REPLACE);

   GrB_Vector mask;
   GrB_Vector_new(&mask, GrB_UINT8, dimension); // column vector

   for (uint32_t index = 0; index < 70; index++)
   {
      uint32_t randomRow = dis(gen);

      GrB_Vector_setElement_UINT8(mask, uint8_t(1), randomRow);
   }

   GrB_Vector input;
   GrB_Vector_new(&input, GrB_UINT8, dimension);

   for (uint32_t index = 0; index < 150; index++)
   {
      uint32_t randomRow = dis(gen);

      GrB_Vector_setElement_UINT8(input, uint8_t(1), randomRow);
   }

   GrB_Vector output;
   GrB_Vector_new(&output, GrB_UINT8, dimension);

   result = GrB_mxv(output, mask, GrB_NULL, GxB_LOR_LAND_BOOL, A, input, invertMaskAndTransposeMatrixFirstThenReplaceOutput);
}

int main()
{
   setenv("GxB_JIT_ERROR_LOG", "/root/GB_JIT.error", 1);
   setenv("GRAPHBLAS_CACHE_PATH", "/root/GB_JIT_Cache", 1);

   GrB_init(GrB_NONBLOCKING);

   test1();

   return 0;
}

GrB_mxv returned GrB_Sucess. no error output. the directory structure was created in GB_JIT_Cache... but no files outputted into /c or libraries created. weird? clearly i'm missing something.

DrTimothyAldenDavis commented 1 year ago

If I can't run the JIT (because of a compiler error in user code, unable to write to the cache folder, etc), then I punt to the generic kernel and return GrB_SUCCESS.

Turn on the burble and see what it says.

DrTimothyAldenDavis commented 1 year ago

The error log comes from the stderr of the compiler command. If the compiler finds a syntax error or has some other error, the error might not get logged in the error log file.

victorstewart commented 1 year ago

sorry i'll get to this this week!