Link Error using Cilk with C program

Link Error using Cilk with C program

I am starting to use Cilk in my work. In this case I am trying to embed Cilk in some legacy C code. Here is the relevant code.

#ifdef __INTEL_COMPILER

      CILK_C_REDUCER_OPADD(sum1, double, 0.0);
      
      CILK_C_REGISTER_REDUCER(sum1);
      cilk_for(L = L1; L <= L2; L++)
      {
        REDUCER_VIEW(sum1) += a[L]*V[ind[L]];
      }
      CILK_C_UNREGISTER_REDUCER(sum1);
#endif

I am using the __stdcall convention.

I am using Intel Parallel Studio 2013 with VS 2012. I am getting the following link errors:

1>test.obj : error LNK2019: unresolved external symbol __imp____cilkrts_hyperobject_noop_destroy@8 referenced in function _LU6LT@16
1>test.obj : error LNK2019: unresolved external symbol __imp__cilk_c_reducer_opadd_reduce_int@12 referenced in function _LU6LT@16
1>test.obj : error LNK2019: unresolved external symbol __imp__cilk_c_reducer_opadd_identity_int@8 referenced in function _LU6LT@16
1>test.obj : error LNK2019: unresolved external symbol __imp____cilkrts_hyperobject_alloc@8 referenced in function _LU6LT@16
1>test.obj : error LNK2019: unresolved external symbol __imp____cilkrts_hyperobject_dealloc@8 referenced in function _LU6LT@16
1>C:\Apps\test.dll : fatal error LNK1120: 5 unresolved externals

Any ideas on what could be causing this? Any help is greatly appreciated.

Regards

Chris

3 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

The compiler should be automatically including a reference to the Cilk runtime when it recognizes the use of Cilk features.  This might be a bug, or you might have told the linker to ignore default libraries.

Either way, you can add cilkrts.lib to your link command manually by specifying it as an additional dependency.

  1. Open the project's properites by right-clicking on the project and select Properties from the context menu
  2. Expand the list of Linker pages by clicking on the little plus next to "Linker" in the treelist on the left.
  3. Select the "Input" page
  4. Add "cilkrts.lib" to the list of "Additional Dependencies"

Be sure to do this for all of your configurations (Release, Debug) and platforms (Win32, x64).

    - Barry

Barry,

Thank you for your help.

Regards

Chris

Connectez-vous pour laisser un commentaire.