Page tree
Skip to end of metadata
Go to start of metadata

Specifying CPU cores for node-locked or floating licenses can be useful in cases such as high-tech computing and application virtualization. This license model enables you to base licensing on your customer's computing resource requirements, increasing the pricing depth for your software offerings. For example, since a 4-CPU machine is double the speed of a 2-CPU machine, licensing the 4-CPU machine would be double the cost of licensing the 2-CPU machine.

Detailed instructions for using CPU cores for both node-locked and floating licenses are described in the following sections. 

Using CPU cores for node-locked licenses

To base node-locked licensing on CPU cores (example is for a Windows environment):

  1. Start a new project in your IDE. Base your code on the example in LM-X_installation_directory\examples\local\local.c.

  2. Include the LM-X library into your application (see License your first application for more information).

  3. Generate a node-locked license file using xmllicgen, located in LM-X_installation_directory\platform-specific_directory; for example, C:\LM-X\Win32_x86.

  4. Using the OPTIONS setting, specify the number of processor cores that the license will be limited to. For example, "CPU=1" limits the license to one processor core, "CPU = 2" limits the license to two processor cores, etc. (We are using the syntax "CPU=x," but you may use different syntax if desired.)

    An example XML template for a node-locked license looks like the following:
     

    <?xml version="1.0" encoding="utf-8"?>
    <LICENSEFILE>
    <FEATURE NAME="F1">
    <SETTING MAJOR_VERSION="1" />
    <SETTING MINOR_VERSION="0" />
    <SETTING END="2015-01-01" />
    <SETTING OPTIONS="CPU=1" />
    <CLIENT_HOSTID>
    <SETTING ETHERNET="D71D90A3763DD3BF" />
    </CLIENT_HOSTID>
    </FEATURE>
    </LICENSEFILE>


  5. To take the number of cores into account in your code (based on the local.c example), change the checkout parameter using LMX_Checkout:

    LMX_Checkout(LmxHandle, "F1", 1, 0, 1)

    For processor-based licensing that sets the count to the number of logical CPUs, change the checkout parameter to:

    LMX_Checkout(LmxHandle, "F1", 1, 0, LMX_LOGICAL_CPU_COUNT)

    For processor-based licensing that sets the count to the number of physical CPUs, change the checkout parameter to:

    LMX_Checkout(LmxHandle, "F1", 1, 0, LMX_PHYSICAL_CPU_COUNT)

  6. To access the license setting OPTIONS "CPU=1” use FI.szOptions, which is available after calling LMX_GetFeatureInfo(LmxHandle, "F1").

    Retrieve the integer from string FI.szOptions and compare it with FI.nUsedLicCount, which is the actual number of CPUs. If the comparison does not match your limitation, you can force the program to exit (remember to use LMX_Free(LmxHandle) upon exit to free allocated memory). Otherwise, license restrictions are fulfilled and you can continue.

  7. Compile and run your application to test that it works as expected.

Using CPU cores for floating licenses

To base floating licenses on CPU cores (example is for a Windows environment):

  1. Start a new project in your IDE. Base your code on the example in LM-X_installation_directory\examples\network\network.c.

  2. Include the LM-X library into your application (see License your first application for more information).

  3. Generate a floating license file using xmllicgen, located in LM-X_installation_directory\platform-specific_directory; for example, C:\LM-X\Win32_x86.

    An example XML template for a floating license looks like the following: 

     

    <?xml version="1.0" encoding="utf-8"?>
    <LICENSEFILE>
    <SETTING END="2015-01-01" />
    <FEATURE NAME="F1" />
    <SETTING MAJOR_VERSION="1" />
    <SETTING MINOR_VERSION="0" />
    <SETTING COUNT="5" />
    <SERVER_HOSTID>
    <SETTING ETHERNET="C8A516AD01AFC9FA" />
    </SERVER_HOSTID?>
    </FEATURE>
    </LICENSEFILE>



  4. To take the number of cores into account in your code (based on the local.c example), change the checkout parameter using LMX_Checkout:

    LMX_Checkout(LmxHandle, "F1", 1, 0, 1)

    For processor-based licensing that sets the count to the number of logical CPUs, change the checkout parameter to:


    LMX_Checkout(LmxHandle, "F1", 1, 0, LMX_LOGICAL_CPU_COUNT)

    For processor-based licensing that sets the count to the number of physical CPUs, change the checkout parameter to:

    LMX_Checkout(LmxHandle, "F1", 1, 0, LMX_PHYSICAL_CPU_COUNT)

  5. Compile your application and start the license server to test that your application works as expected.