Noutați

#include Diagnostics in Visual Studio

#include Diagnostics in Visual Studio Mryam Girmay January 8th, 20241 3 We’re excited to announce that the #include Diagnostics feature is now available in Visual Studio 2022 17.9 Preview 2. This new feature allows you to better understand the behavior of #include directives by providing detailed information on each directive’s references and build time.  Download Visual Studio Preview To begin utilizing this feature, activate #include diagnostics by performing a right-click in your editor to display the context menu. Then, navigate to the ‘Include Directives’ option and choose ‘Enable #include Diagnostics’.  #include References  The feature in Visual Studio allows you to analyze the usage of #include directives in your code. It shows where and how often each directive is referenced, which can be particularly useful when dealing with a long list of directives. If you find an #include directive that is infrequently used but significantly impacts your compile time, this tool will help you identify it quickly so you can take the necessary steps to optimize your code.  Once you enable #include diagnostics, you should see a line of text above each #include directive. This is the CodeLens feature in action. The text above the #include directive indicates the count of its references in your current file. Clicking this count opens a window listing these references. Selecting any reference from this list will direct you to its corresponding line of code in your project.  #include Build Time This feature presents the build time for each #include directive. To activate this, you’ll need to run Build Insights by navigating to Build -> Run Build Insights. This action will generate the necessary build time data. This allows you to easily visualize and evaluate the build time for each #include directive by comparing its usage and compilation time. The information provided by #include Diagnostics can be utilized to optimize your #include directives and improve compilation time. In addition to the information provided by the new #include diagnostics you may also want to consider checking out our documentation on C++ modules as an alternative to #include to further improve compilation time. Send us your feedback  Your feedback is invaluable to us as we strive to enhance your experience. Please feel free to leave your comments below. Alternatively, you can share your thoughts through the Visual Studio Developer Community. We’re also available on Twitter (@VisualC) and can be reached via email at visualcpp@microsoft.com. We look forward to hearing from you!    Mryam Girmay Program Manager, C++ Follow

Read More

AI a Key Driver Behind HPE’s $14 Billion Deal for Juniper

Hewlett Packard Enterprise is looking to become a more significant player in the networking space through its planned $14 billion acquisition of Juniper, a deal that it hopes will make it a more formidable rival to longtime market leader Cisco Systems. The deal, announced Tuesday after the markets closed, is a big deal in the early days of the new year for a networking industry that has become central in an IT sector that is becoming more distributed and more cloud-native. During a virtual briefing with analysts and journalists this morning, HPE CEO Antonio Neri described an HPE centered around its networking business that has AI capabilities and its GreenLake edge-to-cloud platform of IT services at its foundation. “HPE will be a new company where networking will be the core foundation of everything we do,” Neri said. “We’re going to accelerate what we call an AI-driven agenda, and that will allow us to capture this massive inflection point.” Even when the deal closes – which is expected to happen later this year or in early 2025 – HPE will still likely be in third place in the global networking space behind Cisco and Huawei, but will have a stronger portfolio that will not only include greater AI capabilities but also a stronger presence in both the enterprise and telecom spaces. Once it closes, Juniper CEO Rami Rahim will lead the combined HPE networking business and report to Neri. Juniper’s Mist AI is at the Center Unsurprisingly, AI was a key component of the deal. In a research note, Will Townsend and Patrick Moorhead, analysts with Moor Insights and Strategy, wrote that their thinking after initial news reports about a possible deal circulated was that HPE likely was looking for a “strong AI anchor” for its portfolio of hardware, software, and GreenLake IT consumption services. “AI is hot, ignited by the attention being directed toward generative AI, the underlying large language models, and many promising use cases,” Townsend and Moorhead wrote. “One could argue that beyond the AIOps capability found in the HPE Aruba Networking portfolio today, HPE needs further AI depth to remain competitive and continue to grow its top-line revenue and profitability. Juniper could deliver on that front.” Rahim called AI “the biggest inflection since the dawn of the internet itself” and added that the combination of HPE and Juniper “will be able to bring the depth and the breadth of the portfolios necessary to capture the full market opportunity that AI presents in front of us.” AI in networking is a strength for Juniper, which in 2019 bought Mist Systems and its AI technologies, including the Mavis virtual network assistant, which the analyst wrote serves “as the tip of the spear for Juniper’s reinvigorated efforts within the enterprise for WLAN, LAN, WAN, and SD-WAN solutions.” “By all measures, the Mist acquisition has been a success, with Juniper growing its enterprise install base at a faster rate than its service provider business over the last 12 to 18 months,” Townsend and Moorhead wrote. AI and Networking AI will play an increasingly important role in networking going forward, from dynamically adjusting bandwidth and self-correcting in the network for maximum uptime to quickly finding root causes for problems and deploying virtual network assistants. In a blog post last month, Liz Centoni, […]

Read More

What Is The New std::sample Algorithm In C++ 17?

The C++ 17 standard bring us a lot of useful methods, templates and algorithms. One of the great algorithms is std::sample defined in the header that samples at most n elements uniformly from a given range. In this post, we explain the std::sample algorithm and how we can use it with an mt19937 random generator. What is the std::sample algorithm in C++ 17 and beyond? The std::sample algorithm is defined in header that samples at most n elements uniformly from a given range into the output iterator and random numbers can be generated by using a random number generator function. Generally std::mt19937{} is used as random generator and std::random_device{}() is used random generator device. The std::sample algorithm is defined as a template algorithm in C++17 as shown below.   template SampleIterator sample( PopulationIterator first_in, PopulationIterator last_in,                        SampleIterator output, Distance n, URBG&& function );   Here, first_in and last_in are the iterators that defines range of input. n is number of elements to be sampled into output iterator, function is random number generator function. Is there a full example about the std::sample algorithm in C++ 17 and beyond? Here is a full example about std::sample in C++ 17. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28   #include #include #include #include #include #include   int main() { std::vector vec_in {“This”, “LearnCPlusPlus.org”, “is”, “really”, “amazing”,“!”}; std::vector vec_out;   std::cout

Read More

MSVC ARM64 optimizations in Visual Studio 2022 17.8 

MSVC ARM64 optimizations in Visual Studio 2022 17.8  Jiong Wang (ARM Ltd) Hongyon Suauthai (ARM) January 9th, 20240 1 Visual Studio 2022 17.8 has been released recently (download it here). While there is already a blog “Visual Studio 17.8 now available!” covering new features and improvements, we would like to share more information with you about what is new for the MSVC ARM64 backend in this blog. In the last couple of months, we have been improving code-generation for the auto-vectorizer so that it can generate Neon instructions for more cases. Also, we have optimized instruction selection for a few scalar code-generation scenarios, for example short circuit evaluation, comparison against immediate, and smarter immediate split for logic instruction. Auto-Vectorizer supports conversions between floating-point and integer The following conversions between floating-point and integer types are common in real-world code. Now, they are all enabled in the ARM64 backend and hooked up with the auto-vectorizer. From To Instruction double float fcvtn double int64_t fcvtzs double uint64_t fcvtzu float double fcvtl float int32_t fcvtzs float uint32_t fcvtzu int64_t double scvtf uint64_t double ucvtf int32_t float scvtf uint32_t float ucvtf For example: void test (double * __restrict a, unsigned long long * __restrict b) { for (int i = 0; i < 2; i++) { a[i] = (double)b[i]; } } In Visual Studio 2022 17.7, the code-generation was the following in which both the computing throughput and load/store bandwidth utilization were suboptimal due to scalar instructions being used. ldp x9, x8, [x1] ucvtf d17, x9 ucvtf d16, x8 stp d17, d16, [x0] In Visual Studio 2022 17.8.2, the code-generation has been optimized into: ldr q16,[x1] ucvtf v16.2d,v16.2d str q16,[x0] A single pair of Q register load & store plus SIMD instructions are used now. The above example is a conversion between double and 64-bit integer, so both types are the same size. There was another issue in the ARM64 backend preventing auto-vectorization on conversion between different sized types and it has been fixed as well. MSVC also auto-vectorizes the following example now: void test_df_to_sf (float * __restrict a, double * __restrict b, int * __restrict c) { for (int i = 0; i < 4; i++) { a[i] = (float) b[i]; c[i] = ((int)a[i])

Read More

Best of 2023: Copilots For Everyone: Microsoft Brings Copilots to the Masses

As we close out 2023, we at DevOps.com wanted to highlight the most popular articles of the year. Following is the latest in our series of the Best of 2023. Microsoft has been doing a lot to extend the coding ‘copilot’ concept into new areas. And at its Build 2023 conference, Microsoft leadership unveiled new capabilities in Azure AI Studio that will empower individual developers to create copilots of their own. This news is exciting, as it will enable engineers to craft copilots that are more knowledgeable about specific domains. Below, we’ll cover some of the major points from the Microsoft Build keynote from Tuesday, May 23, 2023, and explore what the announcement means for developers. We’ll examine the copilot stack and consider why you might want to build copilots of your own. What is Copilot? A copilot is an artificial intelligence tool that assists you with cognitive tasks. To date, the idea of a copilot has been mostly associated with GitHub Copilot, which debuted in late 2021 to bring real-time auto-suggestions right into your code editor. “GitHub Copilot was the first solution that we built using the new transformational large language models developed by OpenAI, and Copilot provides an AI pair programmer that works with all popular programming languages and dramatically accelerates your productivity,” said Scott Guthrie, executive vice president at Microsoft. However, Microsoft recently launched Copilot X, powered by GPT-4 models. A newer feature also offers chat functionality with GitHub Copilot Chat to accept prompts in natural language. But the Copilot craze hasn’t stopped there—Microsoft is actively integrating Copilot into other areas, like Windows and even Microsoft 365. This means end users can write natural language prompts to spin up documents across the Microsoft suite of Word, Teams, PowerPoint and other applications. Microsoft has also built Dynamics 365 Copilot, Power Platform Copilot, Security Copilot, Nuance and Bing. With this momentum, it’s easy to imagine copilots for many other development environments. Having built out these copilots, Microsoft began to see commonalities between them. This led to the creation of a common framework for copilot construction built on Azure AI. At Build, Microsoft unveiled how developers can use this framework to build out their own copilots. Building Your Own Copilot Foundational AI models are powerful, but they can’t do everything. One limitation is that they often lack access to real-time context and private data. One way to get around this is by extending models through plugins with REST API endpoints to grab context for the tasks at hand. With Azure, this could be accomplished by building a ChatGPT plugin inside VS Code and GitHub Codespaces to help connect apps and data to AI. But you can also take this further by creating copilots of your own and even leveraging bespoke LLMs. Understanding The Azure Copilot Stack Part of the Azure OpenAI service is the new Azure AI Studio. This service enables developers to combine AI models like ChatGPT and GPT-4 with their own data. This could be used to build copilot experiences that are more intelligent and contextually aware. Users can tap into an open source LLM, Azure OpenAI or bring their own AI model. The next step is creating a “meta-prompt” that provides a role for how the copilot should function. So, what’s the process like? Well, first, you […]

Read More

Everything You Need To Know About The Copy Assignment Operator In C++ Classes

Classes and Objects are part of object-oriented methods and typically provide features such as properties and methods. One of the great features of an object orientated language like C++ is a copy assignment operator that is used with operator= to create a new object from an existing one. In this post, we explain what a copy assignment operator is and its types in usage with some C++ examples. What is a copy assignment operator in C++? The Copy Assignment Operator in a class is a non-template non-static member function that is declared with the operator=. When you create a class or a type that is copy assignable (that you can copy with the = operator symbol), it must have a public copy assignment operator. Here is a simple syntax for the typical declaration of a copy assignment operator which is defaulted: Syntax (Since C++11).   class_name & class_name :: operator= ( const class_name& ) = default;   Here is an example in a class.   Tmyclass& operator=(const Tmyclass& other) = default; // Copy Assignment Operator   Is there a simple example of using the copy assignment operator in C++? The forced copy assignment operator is default in any class declarations. This means you don’t need to declare it as above. Let’s give examples without using it. Let’s give a simple C++ example to copy assignment operator with default option, here is a simple class:   class myclass {   public:   std::string str;   };   Because this is default in any class declaration, and it is automatically declared. This class is same as below.   class myclass {   public:   std::string str;     Tmyclass& operator=(const Tmyclass& other) = default; // Copy Assignment Operator };   And here is how you can use this “=” copy assignment operator with both class examples above.   Tmyclass o1, o2;   o2 = o1; // Using Copy Assignment Operator   now let’s see different usage types in C++, 1. Typical Declaration of A Copy Assignment Operator with Swap 2. Typical Declaration of A Copy Assignment Operator ( No Swap) 3. Forced Copy Assignment Operator 4. Avoiding Implicit Copy Assignment 5. Implicitly-declared copy assignment operator 6. Deleted implicitly declared copy assignment operator 7. Trivial copy assignment operator 8. Eligible copy assignment operator 9. Implicitly-defined copy assignment operator C++ Builder is the easiest and fastest C and C++ compiler and IDE for building simple or professional applications on the Windows operating system. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for UIs. There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here.

Read More

Skillsoft Survey Sees AI Driving Increased Need to Retrain IT Teams

More organizations than ever will need to invest in IT training as advances in artificial intelligence (AI) transform roles and responsibilities in the coming year. A survey of 2,740 IT decision-makers conducted by Skillsoft, a provider of an online training platform, finds two-thirds (66%) were already dealing with skills gaps in 2023. As AI becomes more pervasively applied to the management of IT, that skills gap is only going to widen given the limited pool of IT professionals that have any experience using AI to manage IT. Skillsoft CIO Orla Daly said it’s already apparent AI creates an imperative for training because there are simply not enough IT people with the requisite skills required. In fact, the survey finds nearly half of IT decision-makers (45%) plan to close skills gaps by training their existing teams. That training is crucial because the primary reason IT staff change jobs is a lack of growth and development opportunities, noted Daly. While there is naturally a lot of consternation over the potential elimination of IT jobs, in the final analysis, AI will add more different types of jobs than it eliminates, adds Daly. Each of those jobs will require new skills that will need to be acquired and honed, she notes. “Training is the price of innovation,” said Daly. In the meantime, there is much interest in finding ways to automate existing IT processes to create more time for IT teams to experiment with AI technologies, said Daly. The report also finds well over half of IT decision-makers (56%) expect their IT budgets to increase to help pay for new platforms and tools, compared with only 12% expecting a decrease. It’s not clear to what degree AI will transform the management of AI, but it’s already apparent that many manual tasks involving, for example, generating reports are about to be automated. The instant summarization capabilities that generative AI enables also promise to dramatically reduce the time required to onboard new members to an incident response team. Rather than having to allocate someone on the team to bring new members up to speed, each new member of the team will use queries framed in natural language to determine for themselves the extent of the crisis at hand. In addition, many tasks that today require expensive specialists to perform might become more accessible to a wider range of organizations as, for example, more DevOps processes are automated. That doesn’t necessarily mean that DevOps as an IT discipline disappears as much as it leads to the democratization of best DevOps practices. Each IT organization in the year ahead will need to determine to what degree to rely on AI to manage IT processes. It may take a while before IT teams have enough confidence in AI to rely on it to manage mission-critical applications but many of the tasks that today conspire to make the management of IT tedious will undoubtedly fade away. The challenge and the opportunity now is identify those tasks today with an eye toward revamping how IT might be managed in the age of AI tomorrow.

Read More

What Is The New Optional Class Template In C++ 17?

The C++17 standard came with a lot of great features and std::optional was one of the main features of today’s modern C++. std::optional is a class template that is defined in the header and represents either a T value or no value. In this post, we explain, what is optional in modern C++ and how we can use it efficiently. What is the optional class template in C++ 17 and beyond? The std::optional feature is a class template that is defined in the header and represents either a T value or no value (which is signified by the tag type nullopt_t). In some respects, this can be thought of as equivalent to variant, but with a purpose-built interface. Here is the definition of the std::optional class template.   template class optional;   Optional can be used to define any type of variables as below.   std::optional a(5); std::optional b;   An optional variable can be checked by has_value() method if it has a value or not.   if (a.has_value()) { }   Here is another example that has a function with an optional return.   std::optional testopt(std::string s) { if(s.length()==0) return {}; else return s; }   as you see our function may return a string as an option or it may have no return value. A common use case for optional is the return value of a function that may fail. Any instance of optional at any given point in time either contains a value or does not contain a value. If an optionalcontains a value, the value is guaranteed to be allocated as part of the optional object footprint, i.e. no dynamic memory allocation ever takes place. Thus, an optional object models an object, not a pointer, even though operator*() and operator->() are defined. Is there a simple example about the optional class template in C++ 17? Here is a simple example about the std::optional, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19   #include #include   int main() { std::optional a(5);  // a = 5 std::optional b;   // b has no value   if (a.has_value())         { int z = a.value() + b.value_or(0); std::cout

Read More

Three Important C++ 17 Posts That Can Be Used In 2024

Happy New Year Developers! We wish you a great new year that brings peace, happiness, health, and success to you and your family. This week, we have 3 more Modern C++ features that can be used in C++ Builder. The contents of the Parallelism Technical Specification are added to C++17, and as a result, make their way into many C++ compilers and IDEs, such as the latest C++ Builder 12. We explain this feature that adds new overloads, taking an additional execution policy argument, to many algorithms, as well as entirely new algorithms. The Parallelism Technical Specification adds several new algorithms to the modern C++ and in the next post, we explain the new algorithms that come with C++17. Another feature in C++17 was basic_string_view (std::basic_string_view) which is a constant string container that can be used for multiple string declarations, and we explain basic_string_view and its types in another post. Our educational LearnCPlusPlus.org site has a broad selection of new and unique posts with examples suitable for everyone from beginners to professionals alike. It is growing well thanks to you, and we have many new readers, thanks to your support! The site features a treasure-trove of posts that are great for learning the features of modern C++ compilers with very simple explanations and examples. RAD Studio’s C++ Builder, Delphi, and their free community editions C++ Builder CE, and Delphi CE are powerful tools for modern application development. Table of Contents Where I can I learn C++ and test these examples with a free C++ compiler? How to use modern C++ with C++ Builder? How to learn modern C++ for free using C++ Builder? Do you want to know some news about C++ Builder 12? Where I can I learn C++ and test these examples with a free C++ compiler? If you don’t know anything about C++ or the C++ Builder IDE, don’t worry, we have a lot of great, easy to understand examples on the LearnCPlusPlus.org website and they’re all completely free. Just visit this site and copy and paste any examples there into a new Console, VCL, or FMX project, depending on the type of post. We keep adding more C and C++ posts with sample code. In today’s round-up of recent posts on LearnCPlusPlus.org, we have new articles with very simple examples that can be used with: The free version of C++ Builder 11 CE Community Edition or a professional version of C++ Builder or free BCC32C C++ Compiler and BCC32X C++ Compiler or the free Dev-C++ Read the FAQ notes on the CE license and then simply fill out the form to download C++ Builder 11 CE. How to use modern C++ with C++ Builder? With the C++17 standard, the contents of the Parallelism Technical Specification are added to modern C++, and as a result, make their way into many C++ compilers and IDEs, such as the latest C++ Builder 12. This feature adds new overloads, taking an additional execution policy argument, to many algorithms, as well as entirely new algorithms. Three execution policies are supported, which respectively provide sequential, parallel, and vectorized execution. In the first post, we explain what are the Parallelism Features that come with C++ 17 The Parallelism Technical Specification adds several new algorithms to the modern C++. These are modernized in the  header in the standard library. In the next post, we explain the new algorithms that come with C++17. […]

Read More

Best of 2023: Microservices Sucks — Amazon Goes Back to Basics

As we close out 2023, we at DevOps.com wanted to highlight the most popular articles of the year. Following is the latest in our series of the Best of 2023. Welcome to The Long View—where we peruse the news of the week and strip it to the essentials. Let’s work out what really matters. This week: Amazon Prime Video has ditched its use of microservices-cum-serverless, reverting to a traditional, monolithic architecture. It vastly improved the workload’s cost and scalability. I’m Shocked. Shocked. Analysis: But it depends what you mean by “monolithic” None of this is a surprise to us old-skool devs. Although the team did need to clone the monolith a few times, splitting up the tasks so as to retain enough scaling headroom. But it shouldn’t be at all shocking—unless you’ve drunk the µservices Kool-Aid. What’s the story? Joab Jackson reports—“Return of the Monolith”: “Hopelessly archaic”The engineering team at Amazon Prime Video has been roiling the cloud native computing community with its explanation that … a monolithic architecture has produced superior performance over a microservices- and serverless-led approach. … Shocking!…In theory, the use of serverless would allow the team to scale each service independently. It turned out … they hit a hard scaling limit at only 5%. … Initially, the team tried to optimize individual components, but this did not bring about significant improvements. So, the team moved all the components into a single process, hosting them on … EC2 and … ECS.…The IT world is nothing but cyclical, where an architectural trend is derided as hopelessly archaic one year [and] the new hot thing the following year. Certainly, over the past decade when microservices ruled—and the decade before when web services did—we’ve heard more than one joke … about “monoliths being the next big thing.” Now it may actually come to pass. Not just a scaling advantage? Rafal Gancarz also notes huge cost savings—“Prime Video Switched from Serverless to EC2 and ECS”: “Single application process”Prime Video, Amazon’s video streaming service … achieved a 90% reduction in operational costs as a result. … The initial architecture of the solution was based on microservices … implemented on top of the serverless infrastructure stack. The microservices included splitting audio/video streams into video frames or decrypted audio buffers as well as detecting various stream defects … using machine-learning algorithms.…The problem of high operational cost was caused by a high volume of read/writes to the S3 bucket storing intermediate work items … and a large number of step function state transitions. … In the end, the team decided to consolidate all of the business logic in a single application process. … The resulting architecture had the entire … process running [as] instances distributed across different ECS tasks to avoid hitting vertical scaling limits. Horse’s mouth? Marcin Kolny, a Prime Video dev—“The move from a distributed microservices architecture to a monolith application helped achieve higher scale, resilience, and reduce costs”: “Also simplified the orchestration”We took a step back and revisited the architecture. … The main scaling bottleneck in the architecture was the orchestration management that was implemented using AWS Step Functions. Our service performed multiple state transitions for every second of the stream.…We realized that distributed approach wasn’t bringing a lot of benefits in our specific use case, so … we moved all components into a single process to keep the data transfer within the process memory, which also simplified the orchestration logic. [Then] we cloned […]

Read More