Not entry point found tiledb_query_get_field C#

I have some C# code which looks like following

//Create array

public void CreateArray(string uri, ArrayDimension rowDimension, ArrayDimension columnDimension)
{
try
{
using (var ctx = new Context())
{
var domain = new Domain(ctx);
domain.AddDimensions(
Dimension.Create(ctx, “rows”, rowDimension.Start, rowDimension.End, rowDimension.TileExtent),
Dimension.Create(ctx, “cols”, columnDimension.Start, columnDimension.End, columnDimension.TileExtent)
);

  	    // The array will be dense.
  	    var schema = new ArraySchema(ctx, ArrayType.Dense);
  	    schema.SetDomain(domain);
  
  	    var xNorm = new TileDB.CSharp.Attribute(ctx, "x_norm", DataType.Float64);
  	    var yNorm = new TileDB.CSharp.Attribute(ctx, "y_norm", DataType.Float64);
  
  	    schema.AddAttributes(xNorm, yNorm);
  	    Array.Create(ctx,uri,schema);
      }
  }
  catch (Exception e)
  {
      Console.WriteLine(e);
      throw;
  }

}

and then write to the array using following code:

public void WriteArrayFloat(string arrayName, List xNorm, List yNorm, int index, int size)
{
try
{
using var ctx = new Context();
using (var array = new Array(ctx, arrayName))
{
array.Open(QueryType.Write);
using Subarray subArray = new Subarray(array);
subArray.SetSubarray(index, index, 1, size);
using (var query = new Query(ctx, array, QueryType.Write))
{
query.SetLayout(LayoutType.RowMajor);
query.SetDataBuffer(“x_norm”, xNorm.ToArray());
query.SetDataBuffer(“y_norm”, yNorm.ToArray());
query.SetSubarray(subArray);

  		    Console.WriteLine("Writing started");
  		    // Perform the write and close the array.
  		    query.Submit();
  		    array.Close();
  	    }
      }
      Console.WriteLine("Writing done!!");
  }
  catch (Exception e)
  {
      Console.WriteLine(e);
      throw;
  }

}

when it tries to setBuffer, it throws the following error:

not entry point found tiledb_query_get_field tiledb Why idea why? I am using Tiledb.Csharp 5.10.0

Hello @kunaal_desai. I tried reproducing the issue by running a program similar to yours but failed.

Under normal circumstances, the native TileDB library is downloaded from NuGet but the error message you encountered indicates that it did not happen, and a mismatched version of TileDB got picked from somewhere else. Could you add a Console.WriteLine($"Using TileDB {CoreUtil.GetCoreLibVersion()}"); in your program and tell me the result?

Furthermore, in order for NuGet to download the binaries for the correct platform, you should be specifying a runtime identifier when building (if you don’t you should be getting a warning). Are you doing that, and if not, are you getting a warning?

Could you also tell me more about your environment? What is the operating system and .NET version that you are using?

Thanks

The console.writeline has a result:

Using TileDB 2.15.0

The only warning that I see when I build is

warning : The TileDB native library will be imported only when performing an RID-specific build. See the README of the TileDB.CSharp package for more information.

I also added the following code to my .csproj

<PropertyGroup>
		<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
	</PropertyGroup>

I also have following packages referenced.

<PackageReference Include="TileDB.CSharp" Version="5.10.0" />
	  <PackageReference Include="TileDB.Native" Version="2.20.0" />

One. a side note, I have brew installed tile-db on the machine. Could that version be in conflict with this version? How is it related with the package Tiledb.csharp?

The TileDB Homebrew packages are deprecated since version 2.15. I suggest you uninstall it and try again.

What package should my tile-db be?

What package should my tile-db be?

For C#, TileDB will be downloaded with the TileDB.Native NuGet package. Other languages have their own mechanism of acquiring TileDB (such as Conda or pip for Python).

Thank you. It worked. I really appreciate your help. On a side note, I am trying to port some of the c++ code to C# and I was already expecting some lag but what I saw was a Huge difference in performance. Is this expected?

Hi @kunaal_desai, if you are specifically comparing usage of the TileDB C++ API vs equivalent usage of the TileDB C# API, then could you please share a minimal, non-proprietary reproduction? (both original C++, and comparable C#).

Do you want me to post it here or on a new thread?

When I call this c++ code from my C# adapter:

void write_array_float(char* array_name,
                    std::vector<float> x_norm,std::vector<float> y_norm,
                    int index, int size) {
    Context ctx;
    unsigned int microseconds;
   std::cout<< "The first element being written in tiledb.h is " + std::to_string(x_norm[0])  << std::endl;
   std::vector<int> subarray = {index, index, 1 ,size};

    // Open the array for writing and create the query.
    Array array(ctx, array_name, TILEDB_WRITE);
    Query query(ctx, array, TILEDB_WRITE);

     query.set_layout(TILEDB_ROW_MAJOR)
           .set_buffer("x_norm", x_norm)
           .set_buffer("y_norm", y_norm)
           .set_subarray(subarray);

      std::cout<<"Writting started" << std::endl;
    // Perform the write and close the array.
      query.submit();
      array.close();
      std::cout<<"Writting done!!" << std::endl;
}

However, when I translated this code into a C# code:

public void WriteArrayFloat(string arrayName, List<float> xNorm, List<float> yNorm, int index, int size)
    {
	    try
	    {
		    using var ctx = new Context();
		    using (var array = new Array(ctx, arrayName))
		    {
			    array.Open(QueryType.Write);
			    using Subarray subArray = new Subarray(array);
			    subArray.SetSubarray(index, index, 1, size);
			    using (var query = new Query(ctx, array, QueryType.Write))
			    {
				    query.SetLayout(LayoutType.RowMajor);
				    query.SetDataBuffer("x_norm", xNorm.ToArray());
				    query.SetDataBuffer("y_norm", yNorm.ToArray());
				    query.SetSubarray(subArray);

				    Console.WriteLine("Writing started");
				    // Perform the write and close the array.
				    query.Submit();
				    array.Close();
			    }
		    }
		    Console.WriteLine("Writing done!!");
	    }
	    catch (Exception e)
	    {
		    Console.WriteLine(e);
		    throw;
	    }

    }

This one is pretty slow. And just for some context, the difference is the magnitude of the difference. I can post more code if needed.

Thanks - if you can post a complete example that will definitely save us some time (build files etc.). Maybe a new github repo and share?

I think I found the issue. The issue was with my tile configuration of tile-element. While porting the code from C++ to C#, I by mistake, changed the tile-element configuration and that caused the issue with the writing speed. The issue is resolved now.

1 Like