<commit_before>#include "stdafx.h"
#pragma hdrstop

#include "hwcaps.h"
#include "hw.h"

#ifndef _EDITOR
	#include "NVAPI/nvapi.h"
	#include "ATI/atimgpud.h"
#endif

namespace
{

#ifndef _EDITOR
u32 GetNVGpuNum()
{
	NvLogicalGpuHandle  logicalGPUs[NVAPI_MAX_LOGICAL_GPUS];
	NvU32               logicalGPUCount;
	NvPhysicalGpuHandle physicalGPUs[NVAPI_MAX_PHYSICAL_GPUS];
	NvU32               physicalGPUCount;

//	int result = NVAPI_OK;

	int iGpuNum = 0;

	NvAPI_Status	status;
	status = NvAPI_Initialize();

	if (status != NVAPI_OK)
	{
		Msg("* NVAPI is missing.");
		return iGpuNum;
	}

	// enumerate logical gpus
	status = NvAPI_EnumLogicalGPUs(logicalGPUs, &logicalGPUCount);
	if (status != NVAPI_OK)
	{
		Msg("* NvAPI_EnumLogicalGPUs failed!");
		return iGpuNum;
		// error
	}

	// enumerate physical gpus
	status = NvAPI_EnumPhysicalGPUs(physicalGPUs, &physicalGPUCount);
	if (status != NVAPI_OK)
	{
		Msg("* NvAPI_EnumPhysicalGPUs failed!");
		return iGpuNum;
		// error
	}

	Msg	("* NVidia MGPU: Logical(%d), Physical(%d)", physicalGPUCount, logicalGPUCount);

	//	Assume that we are running on logical GPU with most physical GPUs connected.
	for ( u32 i = 0; i<logicalGPUCount; ++i )
	{
		status = NvAPI_GetPhysicalGPUsFromLogicalGPU( logicalGPUs[i], physicalGPUs, &physicalGPUCount);
		if (status == NVAPI_OK)
			iGpuNum = std::max( iGpuNum, (int)physicalGPUCount);
	}

	if (iGpuNum>1)
	{
		Msg	("* NVidia MGPU: %d-Way SLI detected.", iGpuNum);
	}

	return iGpuNum;
}

u32 GetATIGpuNum()
{
	int iGpuNum = AtiMultiGPUAdapters();
	
	if (iGpuNum <= 0)
		return 0;

	Msg	("* ATI MGPU: %d-Way CrossFire detected.", iGpuNum);<commit_msg>Missing iGPUNum > 1 for Crossfire detect<commit_after>#include "stdafx.h"
#pragma hdrstop

#include "hwcaps.h"
#include "hw.h"

#ifndef _EDITOR
	#include "NVAPI/nvapi.h"
	#include "ATI/atimgpud.h"
#endif

namespace
{

#ifndef _EDITOR
u32 GetNVGpuNum()
{
	NvLogicalGpuHandle  logicalGPUs[NVAPI_MAX_LOGICAL_GPUS];
	NvU32               logicalGPUCount;
	NvPhysicalGpuHandle physicalGPUs[NVAPI_MAX_PHYSICAL_GPUS];
	NvU32               physicalGPUCount;

//	int result = NVAPI_OK;

	int iGpuNum = 0;

	NvAPI_Status	status;
	status = NvAPI_Initialize();

	if (status != NVAPI_OK)
	{
		Msg("* NVAPI is missing.");
		return iGpuNum;
	}

	// enumerate logical gpus
	status = NvAPI_EnumLogicalGPUs(logicalGPUs, &logicalGPUCount);
	if (status != NVAPI_OK)
	{
		Msg("* NvAPI_EnumLogicalGPUs failed!");
		return iGpuNum;
		// error
	}

	// enumerate physical gpus
	status = NvAPI_EnumPhysicalGPUs(physicalGPUs, &physicalGPUCount);
	if (status != NVAPI_OK)
	{
		Msg("* NvAPI_EnumPhysicalGPUs failed!");
		return iGpuNum;
		// error
	}

	Msg	("* NVidia MGPU: Logical(%d), Physical(%d)", physicalGPUCount, logicalGPUCount);

	//	Assume that we are running on logical GPU with most physical GPUs connected.
	for ( u32 i = 0; i<logicalGPUCount; ++i )
	{
		status = NvAPI_GetPhysicalGPUsFromLogicalGPU( logicalGPUs[i], physicalGPUs, &physicalGPUCount);
		if (status == NVAPI_OK)
			iGpuNum = std::max( iGpuNum, (int)physicalGPUCount);
	}

	if (iGpuNum>1)
	{
		Msg	("* NVidia MGPU: %d-Way SLI detected.", iGpuNum);
	}

	return iGpuNum;
}

u32 GetATIGpuNum()
{
	int iGpuNum = AtiMultiGPUAdapters();
	
	if (iGpuNum <= 0)
		return 0;

	if (iGPUNum > 1)
		Msg	("* ATI MGPU: %d-Way CrossFire detected.", iGpuNum);
{'fraction_non_alphanumeric': 0.12492492492492492, 'fraction_numerical': 0.00960960960960961, 'mean_word_length': 4.196567862714509, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4033346', 'n_tokens_mistral': 1441, 'n_tokens_neox': 1341, 'n_words': 293}